diff options
author | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-07-13 14:36:24 +0200 |
---|---|---|
committer | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-07-13 14:36:24 +0200 |
commit | fd90f23f3a727dc80e4fa0be1a2a967feee8cb43 (patch) | |
tree | d5dd671ec5249774c3efdd741a0964181b802c49 /scripting | |
parent | e8ec11b41233376724acd0f58bf3f6439c0e21d8 (diff) | |
parent | a2e7c2e0d002d75a6b77a629a4e904ab54bf8375 (diff) |
CWS gnumake2: resync to DEV300_m84
Diffstat (limited to 'scripting')
23 files changed, 214 insertions, 104 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java index 3b9e04a27210..edf6a2d806b7 100644 --- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java @@ -44,15 +44,21 @@ import com.sun.star.io.XOutputStream; import com.sun.star.io.XTruncate; import com.sun.star.deployment.XPackage; +import com.sun.star.deployment.ExtensionRemovedException; public class UnoPkgContainer extends ParcelContainer { private Map registeredPackages = new HashMap(); + protected String extensionDb; + protected String extensionRepository; - public UnoPkgContainer( XComponentContext xCtx, String locationURL, String language ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException + public UnoPkgContainer( XComponentContext xCtx, String locationURL, + String _extensionDb, String _extensionRepository, String language ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException { super( xCtx, locationURL, language, false ); + extensionDb = _extensionDb; + extensionRepository = _extensionRepository; init(); } @@ -217,8 +223,8 @@ public class UnoPkgContainer extends ParcelContainer DeployedUnoPackagesDB dp = null; try { - String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); - String packagesUrl = PathUtils.make_url( path, "Scripts/unopkg-desc.xml" ); +// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); + String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" ); LogUtils.DEBUG("getUnoPackagesDB() looking for existing db in " + packagesUrl ); if ( m_xSFA.exists( packagesUrl ) ) { @@ -276,8 +282,8 @@ public class UnoPkgContainer extends ParcelContainer OutputStream os = null; try { - String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); - String packagesUrl = PathUtils.make_url( path, "Scripts/unopkg-desc.xml" ); +// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); + String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" ); xos = m_xSFA.openFileWrite( packagesUrl ); XTruncate xTrc = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xos ); if ( xTrc != null ) @@ -336,7 +342,15 @@ public class UnoPkgContainer extends ParcelContainer LogUtils.DEBUG("** processUnoPackage getURL() -> " + uri ); LogUtils.DEBUG("** processUnoPackage getName() -> " + dPackage.getName() ); LogUtils.DEBUG("** processUnoPackage getMediaType() -> " + dPackage.getPackageType().getMediaType() ); - LogUtils.DEBUG("** processUnoPackage getDisplayName() -> " + dPackage.getDisplayName() ); + try + { + LogUtils.DEBUG("** processUnoPackage getDisplayName() -> " + dPackage.getDisplayName() ); + } + catch (com.sun.star.deployment.ExtensionRemovedException e) + { + throw new com.sun.star.lang.WrappedTargetException(e.toString(), this, e); + } + processUnoPackage( uri, language ); db = getUnoPackagesDB(); @@ -366,7 +380,10 @@ public class UnoPkgContainer extends ParcelContainer String parentUrl = uri; if ( uri.indexOf( "%2Funo_packages%2F" ) > -1 || - uri.indexOf( "/uno_packages/" ) > -1 ) + uri.indexOf( "/uno_packages/" ) > -1 || + uri.indexOf("$UNO_USER_PACKAGES_CACHE/") > -1 || + uri.indexOf("$UNO_SHARED_PACKAGES_CACHE/") > -1 || + uri.indexOf("$BUNDLED_EXTENSIONS/") > -1 ) { //its in a bundle need to determine the uno-package file its in LogUtils.DEBUG("processUnoPackage - is part of a uno bundle"); diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java index c43756072ba3..e83410f3f35c 100755 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java @@ -213,26 +213,40 @@ public abstract class ScriptProvider } else { + String extensionDb = null; + String extensionRepository = null; + if ( originalContextURL.startsWith( "bundled" ) ) + { + contextUrl = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS"; + extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionRepository = "bundled"; + } + if ( originalContextURL.startsWith( "share" ) ) { contextUrl = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::BaseInstallation}/share"; + extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionRepository = "shared"; } else if ( originalContextURL.startsWith( "user" ) ) { contextUrl = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionRepository = "user"; } if ( originalContextURL.endsWith( "uno_packages") ) { isPkgProvider = true; } - if ( originalContextURL.endsWith( "uno_packages") && !originalContextURL.equals( contextUrl ) ) + if ( originalContextURL.endsWith( "uno_packages") && !originalContextURL.equals( contextUrl ) + && !extensionRepository.equals("bundled")) { contextUrl = PathUtils.make_url( contextUrl, "uno_packages" ); } if ( isPkgProvider ) { - m_container = new UnoPkgContainer( m_xContext, contextUrl, language ); + m_container = new UnoPkgContainer( m_xContext, contextUrl, extensionDb, extensionRepository, language ); } else { diff --git a/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties index 3137b89dde94..f776ff9e7933 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties @@ -1,5 +1,6 @@ # Filesystems API # {0} - root path +# x-no-translate LAB_invalid_file_system=invalid OpenOffice.org document {0} # {0} - root path LAB_valid_file_system={0} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties index a3bf47447607..eab2fa1f3fbc 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties @@ -3,6 +3,7 @@ #HINT_myProp=<description of my property> #LBL_DataNode_exec_sheet=Execution #HINT_DataNode_exec_sheet=Properties pertaining to compiling, running, and debugging. +# x-no-translate LBL_loaderName=<display name of the data loader> # Datasystems API #PROP_myProp=<name of my property> diff --git a/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties index b823204cb227..6a9112e8c768 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties @@ -1,4 +1,5 @@ # Options API +# x-no-translate LBL_settings=Office Settings PROP_OfficeDirectory=Path to Office installation HINT_OfficeDirectory=Path to the Office installation diff --git a/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties index 58989c2506b7..22aea6525f3d 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties @@ -1,3 +1,4 @@ +# x-no-translate Templates/OfficeScripting=Office Scripting Templates/OfficeScripting/parcel.xml=Script Parcel Descriptor Services/MIMEResolver/org-netbeans-modules-office-mime-resolver.xml=Script Parcel Descriptor File diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties index 0e4f2bd100c7..a40b4b373959 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties @@ -1,4 +1,5 @@ # Window System API +# x-no-translate # TopComponent LBL_component_name=<name of component> diff --git a/scripting/prj/build.lst b/scripting/prj/build.lst index fc332384e047..7d5162173eae 100644..100755 --- a/scripting/prj/build.lst +++ b/scripting/prj/build.lst @@ -1,4 +1,4 @@ -tc scripting : oovbaapi bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL +tc scripting : oovbaapi vbahelper bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL tc scripting usr1 - all tc1_mkout NULL tc scripting\inc nmake - all tc1_inc NULL tc scripting\source\provider nmake - all tc1_scriptingprovider tc1_inc NULL diff --git a/scripting/source/basprov/basprov.map b/scripting/source/basprov/basprov.map deleted file mode 100644 index 737cddbfe3df..000000000000 --- a/scripting/source/basprov/basprov.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scripting/source/basprov/makefile.mk b/scripting/source/basprov/makefile.mk index 1555a74926e2..5001e5db288e 100644 --- a/scripting/source/basprov/makefile.mk +++ b/scripting/source/basprov/makefile.mk @@ -50,7 +50,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index fedbce79b218..6c3694ea237d 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -50,9 +50,9 @@ #include <com/sun/star/beans/MethodConcept.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> -#ifdef FAKE_VBA_EVENT_SUPPORT #include <ooo/vba/XVBAToOOEventDescGen.hpp> -#endif +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <vbahelper/vbaaccesshelper.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::awt; @@ -104,7 +104,6 @@ namespace dlgprov }; -#ifdef FAKE_VBA_EVENT_SUPPORT class DialogVBAScriptListenerImpl : public DialogScriptListenerImpl { protected: @@ -157,7 +156,6 @@ namespace dlgprov } } } -#endif //......................................................................... @@ -166,7 +164,7 @@ namespace dlgprov // ============================================================================= DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener ) - :m_xContext( rxContext ) + :mbUseFakeVBAEvents( false ), m_xContext( rxContext ) { // key listeners by protocol when ScriptType = 'Script' // otherwise key is the ScriptType e.g. StarBasic @@ -177,9 +175,22 @@ namespace dlgprov // handler for Script & ::rtl::OUString::createFromAscii( "vnd.sun.star.UNO:" ) listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode ); listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel ); -#ifdef FAKE_VBA_EVENT_SUPPORT - listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel ); -#endif + // Note: in a future cws ( npower13_ObjectModule ) it will be possible + // to determine the vba mode from the basiclibrary container, the tunnel hack + // below can then be replaced + SfxObjectShell* pFoundShell = NULL; + if ( rxModel.is() ) + { + uno::Reference< lang::XUnoTunnel > xObjShellTunnel( rxModel, uno::UNO_QUERY ); + if ( xObjShellTunnel.is() ) + { + pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); + if ( pFoundShell ) + mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ); + } + } + if ( mbUseFakeVBAEvents ) + listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel ); } // ----------------------------------------------------------------------------- @@ -197,7 +208,6 @@ namespace dlgprov throw RuntimeException(); // more text info here please return it->second; } -#ifdef FAKE_VBA_EVENT_SUPPORT Reference< XScriptEventsSupplier > DialogEventsAttacherImpl::getFakeVbaEventsSupplier( const Reference< XControl >& xControl, rtl::OUString& sControlName ) { Reference< XScriptEventsSupplier > xEventsSupplier; @@ -210,7 +220,6 @@ namespace dlgprov } return xEventsSupplier; } -#endif // ----------------------------------------------------------------------------- void SAL_CALL DialogEventsAttacherImpl::attachEventsToControl( const Reference< XControl>& xControl, const Reference< XScriptEventsSupplier >& xEventsSupplier, const Any& Helper ) @@ -312,7 +321,6 @@ namespace dlgprov // go over all objects const Reference< XInterface >* pObjects = Objects.getConstArray(); sal_Int32 nObjCount = Objects.getLength(); -#ifdef FAKE_VBA_EVENT_SUPPORT Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog rtl::OUString sDialogCodeName; if ( xDlgControl.is() ) @@ -324,7 +332,6 @@ namespace dlgprov } catch( Exception& ){} } -#endif for ( sal_Int32 i = 0; i < nObjCount; ++i ) { @@ -339,10 +346,11 @@ namespace dlgprov Reference< XControlModel > xControlModel = xControl->getModel(); Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY ); attachEventsToControl( xControl, xEventsSupplier, Helper ); -#ifdef FAKE_VBA_EVENT_SUPPORT - xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) ); - attachEventsToControl( xControl, xEventsSupplier, Helper ); -#endif + if ( mbUseFakeVBAEvents ) + { + xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) ); + attachEventsToControl( xControl, xEventsSupplier, Helper ); + } } } diff --git a/scripting/source/dlgprov/dlgevtatt.hxx b/scripting/source/dlgprov/dlgevtatt.hxx index 4b9028718a55..85b0bfcd087d 100644 --- a/scripting/source/dlgprov/dlgevtatt.hxx +++ b/scripting/source/dlgprov/dlgevtatt.hxx @@ -44,8 +44,6 @@ #include <hash_map> -#define FAKE_VBA_EVENT_SUPPORT 1 - //......................................................................... namespace dlgprov { @@ -66,13 +64,12 @@ namespace dlgprov class DialogEventsAttacherImpl : public DialogEventsAttacherImpl_BASE { private: + bool mbUseFakeVBAEvents; ListenerHash listernersForTypes; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacher > m_xEventAttacher; ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > getScriptListenerForKey( const rtl::OUString& sScriptName ) throw ( ::com::sun::star::uno::RuntimeException ); -#ifdef FAKE_VBA_EVENT_SUPPORT ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, rtl::OUString& sCodeName ); -#endif void SAL_CALL attachEventsToControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& events, const ::com::sun::star::uno::Any& Helper ); public: DialogEventsAttacherImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index c372e1f660af..aa6c6cfb966a 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -28,26 +28,22 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_scripting.hxx" -#ifndef SCRIPTING_DLGPROV_HXX #include "dlgprov.hxx" -#endif #include "dlgevtatt.hxx" #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> -#ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_ #include <com/sun/star/io/XInputStreamProvider.hpp> -#endif #include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/script/XLibraryContainer.hpp> -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ #include <cppuhelper/implementationentry.hxx> -#endif +#include <cppuhelper/exc_hlp.hxx> #include <com/sun/star/beans/XIntrospection.hpp> #include <com/sun/star/resource/XStringResourceSupplier.hpp> #include <com/sun/star/resource/XStringResourceManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include "com/sun/star/resource/XStringResourceWithLocation.hpp" +#include <com/sun/star/resource/XStringResourceWithLocation.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> #include <sfx2/app.hxx> #include <sfx2/objsh.hxx> @@ -691,13 +687,22 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs //Reference< XDialog > xDialog; Reference< XControl > xCtrl; Reference< XControlModel > xCtrlMod; - // add support for basic RTL_FUNCTION - if ( m_BasicInfo.get() ) - xCtrlMod = createDialogModelForBasic(); - else + try + { + // add support for basic RTL_FUNCTION + if ( m_BasicInfo.get() ) + xCtrlMod = createDialogModelForBasic(); + else + { + OSL_ENSURE( URL.getLength(), "DialogProviderImpl::getDialog: no URL!" ); + xCtrlMod = createDialogModel( URL ); + } + } + catch ( const RuntimeException& ) { throw; } + catch ( const Exception& ) { - OSL_ENSURE( URL.getLength(), "DialogProviderImpl::getDialog: no URL!" ); - xCtrlMod = createDialogModel( URL ); + const Any aError( ::cppu::getCaughtException() ); + throw WrappedTargetRuntimeException( ::rtl::OUString(), *this, aError ); } if ( xCtrlMod.is() ) { diff --git a/scripting/source/dlgprov/dlgprov.map b/scripting/source/dlgprov/dlgprov.map deleted file mode 100644 index 737cddbfe3df..000000000000 --- a/scripting/source/dlgprov/dlgprov.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scripting/source/dlgprov/makefile.mk b/scripting/source/dlgprov/makefile.mk index 0ad861d5c281..6c8ec298c760 100644 --- a/scripting/source/dlgprov/makefile.mk +++ b/scripting/source/dlgprov/makefile.mk @@ -46,7 +46,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) @@ -59,6 +59,7 @@ SHL1STDLIBS= \ $(COMPHELPERLIB) \ $(UCBHELPERLIB) \ $(CPPULIB) \ + $(BASICLIB) \ $(SALLIB) SHL1DEPN= diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx index f8400ed77950..3c6206d8d051 100644 --- a/scripting/source/provider/ActiveMSPList.cxx +++ b/scripting/source/provider/ActiveMSPList.cxx @@ -59,6 +59,7 @@ ActiveMSPList::ActiveMSPList( const Reference< XComponentContext > & xContext ) { userDirString = ::rtl::OUString::createFromAscii("user"); shareDirString = ::rtl::OUString::createFromAscii("share"); + bundledDirString = ::rtl::OUString::createFromAscii("bundled"); } ActiveMSPList::~ActiveMSPList() @@ -307,6 +308,12 @@ ActiveMSPList::createNonDocMSPs() Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); // should check if provider reference is valid m_hMsps[ shareDirString ] = shareMsp; + + args[ 0 ] <<= bundledDirString; + Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); + // should check if provider reference is valid + m_hMsps[ bundledDirString ] = bundledMsp; + created = true; } diff --git a/scripting/source/provider/ActiveMSPList.hxx b/scripting/source/provider/ActiveMSPList.hxx index 5adf2fc5a961..b127f3c41b16 100644 --- a/scripting/source/provider/ActiveMSPList.hxx +++ b/scripting/source/provider/ActiveMSPList.hxx @@ -107,6 +107,7 @@ private: osl::Mutex m_mutex; ::rtl::OUString userDirString; ::rtl::OUString shareDirString; + ::rtl::OUString bundledDirString; css::uno::Reference< css::uno::XComponentContext > m_xContext; }; } // func_provider diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index f9c2f0f70b09..55c204f87dbf 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -16,6 +16,8 @@ import uno import re #to implement com::sun::star::mail::XMailServiceProvider +#and +#to implement com.sun.star.mail.XMailMessage from com.sun.star.mail import XMailServiceProvider from com.sun.star.mail import XMailService @@ -37,7 +39,7 @@ from email import Encoders from email.Header import Header from email.MIMEMultipart import MIMEMultipart from email.Utils import formatdate -from email.Utils import formataddr +from email.Utils import parseaddr import sys, smtplib, imaplib, poplib @@ -118,30 +120,46 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): print >> sys.stderr, "PyMailSMPTService sendMailMessage" recipients = xMailMessage.getRecipients() sendermail = xMailMessage.SenderAddress - sendername = xMailMessage.SenderName + sendername = xMailMessage.SenderName subject = xMailMessage.Subject ccrecipients = xMailMessage.getCcRecipients() bccrecipients = xMailMessage.getBccRecipients() if dbg: print >> sys.stderr, "PyMailSMPTService subject", subject - print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8'), sendermail - print >> sys.stderr, "PyMailSMTPService from", formataddr((sendername.encode('utf-8'), sendermail)) + print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8') + print >> sys.stderr, "PyMailSMTPService from", sendermail print >> sys.stderr, "PyMailSMPTService send to", recipients attachments = xMailMessage.getAttachments() + textmsg = Message() + content = xMailMessage.Body flavors = content.getTransferDataFlavors() - flavor = flavors[0] if dbg: - print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType - textbody = content.getTransferData(flavor) + print >> sys.stderr, "PyMailSMPTService flavors len", len(flavors) - textmsg = Message() - mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType) - textmsg['Content-Type'] = mimeEncoding - textmsg['MIME-Version'] = '1.0' - textmsg.set_payload(textbody.encode('utf-8')) + #Use first flavor that's sane for an email body + for flavor in flavors: + if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1: + if dbg: + print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType + textbody = content.getTransferData(flavor) + try: + textbody = textbody.value + except: + pass + textbody = textbody.encode('utf-8') + + if len(textbody): + mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType) + if mimeEncoding.find('charset=UTF-8') == -1: + mimeEncoding = mimeEncoding + "; charset=UTF-8" + textmsg['Content-Type'] = mimeEncoding + textmsg['MIME-Version'] = '1.0' + textmsg.set_payload(textbody) + + break if (len(attachments)): msg = MIMEMultipart() @@ -150,15 +168,31 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): else: msg = textmsg - msg['Subject'] = subject - msg['From'] = formataddr((sendername.encode('utf-8'), sendermail)) + hdr = Header(sendername, 'utf-8') + hdr.append('<'+sendermail+'>','us-ascii') + msg['Subject'] = subject + msg['From'] = hdr msg['To'] = COMMASPACE.join(recipients) if len(ccrecipients): msg['Cc'] = COMMASPACE.join(ccrecipients) if xMailMessage.ReplyToAddress != '': msg['Reply-To'] = xMailMessage.ReplyToAddress - msg['X-Mailer'] = "OpenOffice.org 2.0 via Caolan's mailmerge component" + mailerstring = "OpenOffice.org 2.0 via Caolan's mailmerge component" + try: + ctx = uno.getComponentContext() + aConfigProvider = ctx.ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider") + prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue') + prop.Name = "nodepath" + prop.Value = "/org.openoffice.Setup/Product" + aSettings = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", + (prop,)) + mailerstring = aSettings.getByName("ooName") + " " + \ + aSettings.getByName("ooSetupVersion") + " via Caolan's mailmerge component" + except: + pass + + msg['X-Mailer'] = mailerstring msg['Date'] = formatdate(localtime=True) for attachment in attachments: @@ -344,9 +378,63 @@ class PyMailServiceProvider(unohelper.Base, XMailServiceProvider): else: print >> sys.stderr, "PyMailServiceProvider, unknown TYPE", aType +class PyMailMessage(unohelper.Base, XMailMessage): + def __init__( self, ctx, sTo='', sFrom='', Subject='', Body=None, aMailAttachment=None ): + if dbg: + print >> sys.stderr, "PyMailMessage init" + self.ctx = ctx + + self.recipients = sTo, + self.ccrecipients = () + self.bccrecipients = () + self.aMailAttachments = () + if aMailAttachment != None: + self.aMailAttachments = aMailAttachment, + + self.SenderName, self.SenderAddress = parseaddr(sFrom) + self.ReplyToAddress = sFrom + self.Subject = Subject + self.Body = Body + if dbg: + print >> sys.stderr, "post PyMailMessage init" + def addRecipient( self, recipient ): + if dbg: + print >> sys.stderr, "PyMailMessage.addRecipient", recipient + self.recipients = self.recipients, recipient + def addCcRecipient( self, ccrecipient ): + if dbg: + print >> sys.stderr, "PyMailMessage.addCcRecipient", ccrecipient + self.ccrecipients = self.ccrecipients, ccrecipient + def addBccRecipient( self, bccrecipient ): + if dbg: + print >> sys.stderr, "PyMailMessage.addBccRecipient", bccrecipient + self.bccrecipients = self.bccrecipients, bccrecipient + def getRecipients( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getRecipients", self.recipients + return self.recipients + def getCcRecipients( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getCcRecipients", self.ccrecipients + return self.ccrecipients + def getBccRecipients( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getBccRecipients", self.bccrecipients + return self.bccrecipients + def addAttachment( self, aMailAttachment ): + if dbg: + print >> sys.stderr, "PyMailMessage.addAttachment" + self.aMailAttachments = self.aMailAttachments, aMailAttachment + def getAttachments( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getAttachments" + return self.aMailAttachments + # pythonloader looks for a static g_ImplementationHelper variable g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper.addImplementation( \ PyMailServiceProvider, "org.openoffice.pyuno.MailServiceProvider", ("com.sun.star.mail.MailServiceProvider",),) - +g_ImplementationHelper.addImplementation( \ + PyMailMessage, "org.openoffice.pyuno.MailMessage", + ("com.sun.star.mail.MailMessage",),) diff --git a/scripting/source/stringresource/makefile.mk b/scripting/source/stringresource/makefile.mk index afb07fddfa2f..dfc2d1979190 100644 --- a/scripting/source/stringresource/makefile.mk +++ b/scripting/source/stringresource/makefile.mk @@ -44,7 +44,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/stringresource/stringresource.map b/scripting/source/stringresource/stringresource.map deleted file mode 100644 index 737cddbfe3df..000000000000 --- a/scripting/source/stringresource/stringresource.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 7e4626e31c00..838d89d49c89 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -349,8 +349,8 @@ static TranslatePropMap aTranslatePropMap_Impl[] = { MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, //liuchen, add to support VBA MouseMove event when the "Shift" key is pressed // keyPressed ooo event - { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } }, - { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } } + { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } }, + { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } } }; EventInfoHash& getEventTransInfo() @@ -929,9 +929,12 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime Sequence< Any > aOutArgs; try { - uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url ); - if ( xScript.is() ) - xScript->invoke( aArguments, aOutArgsIndex, aOutArgs ); + if ( mpShell ) + { + uno::Any aRet; + mpShell->CallXScript( url, + aArguments, aRet, aOutArgsIndex, aOutArgs, false ); + } } catch ( uno::Exception& e ) { diff --git a/scripting/source/vbaevents/makefile.mk b/scripting/source/vbaevents/makefile.mk index 227da45f9f08..1946c61d1e0b 100644 --- a/scripting/source/vbaevents/makefile.mk +++ b/scripting/source/vbaevents/makefile.mk @@ -60,7 +60,7 @@ SLOFILES= \ SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scripting/source/vbaevents/vbaevents.map b/scripting/source/vbaevents/vbaevents.map deleted file mode 100644 index 737cddbfe3df..000000000000 --- a/scripting/source/vbaevents/vbaevents.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; |