Cedric Bosdonnat schrieb:
Hi Christoph, Oliver,

Christoph Neumann a écrit :

The property is "MacroExecutionMode":

            PropertyValue[] DocArgs = new PropertyValue[1];
            PropertyValue DocArg = new PropertyValue();
            DocArg.Name = "MacroExecutionMode";
            DocArg.Value = new Short(
com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
            DocArgs[0] = DocArg;


so you can:

loadComponentFromURL(DocURL, "MyDoc", "_blank", DocArgs);

I'm already using it: the macro first opens a Basic dialog and then
changes the value of some User TextFields. The Basic dialog is correctly
shown and I can trace the macro. But the ThisComponent.getTextFields()
returns no field at all instead of 4 or 5 contained in the document.


The basic property "ThisComponent" is'nt a realy stable feature.
It referrs to the "current document" ... and that can be the problem here. Do you realy know which of your documents is the "current one" at the time you call "ThisComponent.getTextFields()" ?

In general "ThisComponent" should be used only in the following case:
(my personal opinion !)

a) You have one document containing macros.
b) You register these macros to the event "OnLoad", so they are started
automaticly.
c) Then ThisComponent referrs to THESE document.
d) You dont open any other document or do any action, which can set ThisComponent to other currently open documents. E.g. a Frame.ControllerWindow.ToFront(true) (which set the focus to this window) can make trouble. Because the ThisComponent will be changed to the document owned by this frame .-)

Why do you spread the code of "one operation" on two documents ?
Might be you should make it more explicit. How ?
You should know which frames/models are interesting for you and use it explicitly. E.g. the desktop service provides easy access to every open frame. You can iterate over all these frames and search for your and all other interesting models there. Or you cache all opened documents (opened by your basic macro) and forward these references to all the code you trigger ...

Regards
Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to