Oh, what a productive thread this is. So let me show that I'm with you.

StarBasic "ThisComponent" refers to the currently active document (not
counting the IDE) if called from a public container. If the Basic code
is saved in a document's container, then ThisComponent refers to the
document where the code is saved in.

Open a Writer and a Calc document. Save the following macro in each one:

Sub Main
print thisComponent.CurrentController.getImplementationName()
End Sub

No matter which document is the active one, Tools>Macros>Run... always
reports "SwXTextView" for Writer-code and "ScTabViewObj" for Calc-code.
When called from the IDE it does not matter which one of the two
controllers have been active before. The same macro saved in public
container "MyMacros" reports the type of the currently active controller
(or the previously active controller if called from IDE).

So "ThisComponent", saved in a form/report, can refer to the Writer
document while "ThisComponent", saved in the container of the Base
document, can refer to that document without any conflicts.

Just my 2 €-Cents,

Andreas

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

Reply via email to