Re: [api-dev] Re: Intercepting commands .uno.xxx...

2008-11-05 Thread Andreas Schlüns

Hi Paolo,


Hi,

Andreas Schlüns ha scritto:

Hi Carlos,


(I'm using Automation Bridge to communicate with OOo)

After reading again all the stuff and trying to digest the java 
sample, this is what I conluded:


I need to implement my own DispatchProvider as a COM object an pass 
it as a parameter to registerDispatchProviderInterceptor, in the 
same way I do to register listeners, am I right? (is this the reason 
why Ariel said this can't be achieved with Basic?)


Exactly. You register your interception in the same you register a 
listener. registerDispatchProviderInterceptor() is the right method 
doing that.


And yes ... OOo basic do not support complex structures as e.g. classes
and so it's not possible to implement an interceptor in basic.


Why not? You can register your own dispatch-interceptor in Starbasic and 
you can even define your custom dispatches in order to react to user 
actions


Please find the small example document in attachment.


You are right ... it's possible ... but I wouldnt do that !
Why ?

a)
Method createUnoListener() was not thought to be used that way.
If you call it a temp object will be cerated inside memory (using 
refelection) which maps your basic methods to an simulated UNO API.
Its very tricky doing so ... and at least you need more then one 
instance because it's not possible to simulate more then one interface 
for the same basic instance.


b)
On the other side I believe you can run into trouble with lifetime of 
your basic objects. They are bound to the document ... if it's removed 
from memory your basic bindings are gone ... but might be the dispatch 
objects are well known outside. (Not only menus and toolbars are 
interested on dispatches!) Such reflection-proxy-objects will run into 
dead bindings ... an idea whats happen then ? - crash !



If you know what are you doing there you can try it ... but at least I 
think it's one for OOo-API-experts .-)



ciao
Paolo Mantovani


Regards
Andreas

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



Re: [api-dev] Re: Intercepting commands .uno.xxx...

2008-11-05 Thread Paolo Mantovani
Hello Andreas,

Andreas Schlüns ha scritto:
 Hi Paolo,
[...]
 You are right ... it's possible ... but I wouldnt do that !

And I totally agree, but I like so much to find this kind of sneaky
tricks in StarBasic :-)


 Why ?
 
 a)
[...]
 b)
 On the other side I believe you can run into trouble with lifetime of
 your basic objects. They are bound to the document ... if it's removed
 from memory your basic bindings are gone ... 

My example was contained into a document, but it could be run even from
a shared library.
AFAIK a global variable into a shared library lives for all the ooo session.
Perhaps using global vars for referencing basic objects would make
things safer?

 ...
 If you know what are you doing there you can try it ... but at least I
 think it's one for OOo-API-experts .-)

Of course you're right! The next time I'll add:
PLEASE, DON'T TRY THIS AT HOME!!! :-)

Thanks for the clear and very useful explanation
Paolo Mantovani


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



Re: [api-dev] Re: Intercepting commands .uno.xxx...

2008-11-04 Thread Ariel Constenla-Haile
Hi Paolo, Carlos, *

Paolo Mantovani escribió:
 Hi,
 
 Andreas Schlüns ha scritto:
 Hi Carlos,

 (I'm using Automation Bridge to communicate with OOo)

 After reading again all the stuff and trying to digest the java
 sample, this is what I conluded:

 I need to implement my own DispatchProvider as a COM object an pass
 it as a parameter to registerDispatchProviderInterceptor, in the
 same way I do to register listeners, am I right? (is this the reason
 why Ariel said this can't be achieved with Basic?)

 Why not? You can register your own dispatch-interceptor in Starbasic and
 you can even define your custom dispatches in order to react to user
 actions

What I meant with

 mmm... I'm not sure if there is a way to achieve this with OOo Basic, as
 it can not implement UNO components. 

is that one can not achieve this in a full programmatic (?) way with
OOo Basic: I mean, a dispatch interceptor, like a context menu
interceptor, can work in OOo Basic using the listener technique; but for
the whole thing to really work on every document the user open/creates,
you need an extension implementing a Job.

The only way I see [correct me if I'm wrong, and please share if someone
knows a working way] for OOo Basic is the Tools - Customize - Events ...
but of course this is a no-way for an extension.

So I'd dare to say that OOo Basic can not achieve this for an extension
that - in a full programmatic way - wants to intercept commands.
[Though I hope I'm wrong... or at least someone is developing/thinking
about giving OOo Basic the chance to fully/really work as an extension
development language]

Regards
Ariel

-- 
Ariel Constenla-Haile
La Plata, Argentina


Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter.
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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