Hi John,
Alle 23:30, gioved� 17 marzo 2005, John Sisson ha scritto:
> Hello,
> Documentation for oo development implies that soffice macros invoked
> from a (connected) client by the client-side method:
> myXDispatch.dispatch(myMacroUrl, myPropertyValueArray)
> can receive method parameters, but it does not state how this is done.
Where did you found this?
> Given a method 'MyLib.MyModule.Foo' it seems there are 2 options:
[....]
I tried this way and it worked:
----------------------------
Sub CallDispatch1
Dim mNoArgs()
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
sMacroURL = "macro:///Standard.Module1.ShowMessage(%22ciao%22)"
oDispatcher.executeDispatch(StarDesktop, sMacroURL, "", 0, mNoArgs())
End Sub
Sub ShowMessage(msg As String)
Msgbox msg
End Sub
----------------------------
>
> ALSO:
> If I put my macros in a non-Standard library is there anything that can
> be done from an installed component to ensure that the library is
> loaded;
AFAIK, when you call a macro using the dispatch, the corresponding library is
loaded automatically
> eg a service com.my.MacroSetupService with a method
> loadMacroLibraries() such that when instantiated and invoked in soffice
> from the client would poke oo-Basic to load the library:
> /** com.my.MacroSetupService.loadMacroLibraries
> **/
> public void loadMacroLibraries() {
> ...
> someOpenOffice.Component.loadLibrary("MyLibrary");
> ...
> }
Although it shouldn't be necessary, you can load a library in this way:
----------------------------
Sub TestLibraries
oLibContainer = _
CreateUnoService("com.sun.star.script.ApplicationScriptLibraryContainer")
If Not oLibContainer.isLibraryLoaded( "Gimmicks" ) Then
oLibContainer.loadLibrary ( "Gimmicks" )
End If
End Sub
----------------------------
Or, if you prefer, this version does not use oobasic shortcuts:
----------------------------
Sub TestLibraries
oLibContainer = _
CreateUnoService("com.sun.star.script.ApplicationScriptLibraryContainer")
If Not oLibContainer.isLibraryLoaded( "Gimmicks" ) Then
oLibContainer.loadLibrary ( "Gimmicks" )
End If
End Sub
----------------------------
> or can the PKGCHK install of the macro library in some way force soffice
> to load the library on startup?
AFAIK this is not possible
> Or is it the case that the XDispatch of the macro by library name loads
> that library (I don't think so, though it probably should).
Ciao
Paolo M.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]