Ariel Constenla-Haile schrieb:
Hi people,
FIRST of all, I would like to thank the one who wrote the code of the
GUI examples on the new SDK
(OpenOffice.org_2.3_SDK/examples/DevelopersGuide/GUI): it answers some
questions I had for a long time! Thanks hr (I don't know your real name!)!
Hi Ariel,
the author of the examples and the toolkit API chapter in the
Developer's Guide is Berend Cornelius. Jürgen integrated the examples
into the OpenOffice.org SDK.
THEN, some questions about the code examples:
****************************************************************************
* FIRST QUESTION: On the API reference, I always founded the XMenu and
XPopupMenu interfaces (and related ones), but as there is no service
specification at all, I just didn't know how to instantiate this
interfaces. Well, now I've learn that the services names used in the
examples are
"stardiv.Toolkit.VCLXMenuBar" and
"stardiv.Toolkit.VCLXPopupMenu"
At first sight, they look like the implementation names you use
internally, but not like service names published as UNO services, I
mean, com.sun.star.awt.MenuBar, and com.sun.star.awt.PopupMenu
But to my surprise, I used XComponentContext::getServiceManager() to get
the XMultiComponentFactory, then used its method
getAvailableServiceNames() and got a sequence that DOES contain these
service names:
"com.sun.star.awt.MenuBar"
"com.sun.star.awt.PopupMenu"
"stardiv.vcl.MenuBar"
"stardiv.vcl.PopupMenu"
And we can use any of the names:
1. "com.sun.star.awt.PopupMenu"
2. "stardiv.vcl.PopupMenu"
3. "stardiv.Toolkit.VCLXPopupMenu"
as they instantiate the same type.
And again to my surprise, "com.sun.star.awt.MenuBar" and
"com.sun.star.awt.PopupMenu" are not included on OOo2.3 SDK API
reference, nor in the source/offapi/com/sun/star/awt IDL files.
I am the maintainer of the OpenOffice.org toolkit and I know that the
IDL files need a brush up to be up to date. Luckily Berend created many
issues about the IDL files which I want to fix in the near future.
So, are they going to be included in the API? Is it safe to use them?
What service name shall we use, out of the tree options? Since which OOo
version can they be used?
You should use "com.sun.star.awt.MenuBar" and
"com.sun.star.awt.PopupMenu". The other service names are outdated and
only supported for compatibility reasons. Could please write an issue
and set me ([EMAIL PROTECTED]) as the owner.
*********************************************************************
* SECOND QUESTION: the excellent example uses a fixed text control to
execute the PopupMenu. I played with an implementation of the dbaccess
SQL Direct dialog: I wanted to add a pop up menu to the edit control to
insert SQL templates in it (just like OOo Math commands window's context
menu).
You can find a picture of the result here:
http://www.arielconstenlahaile.com.ar/ooo/temp/DBExtras_XSQLDirect_04.png
But I found some problems: when I right click on the edit control
window, my implementation of the XMouseListener isn't call first, but
the edit control own implementation, and it consumes the event,
executing its context menu (the "Paste/Select all/Special chars". one),
and my XMouseListener implementation gets called just if I right clik
on that context menu.
The problem here: FIRST the context menu of the edit control is
executed, THEN my pop up menu IF I right click on this context menu.
What I really need here is an XContextMenuInterceptor, but how do I get
the XContextMenuInterception for the edit control when it has no
com.sun.star.frame.Controller ? (as long as I know, UnoControls
implement the Model-View Paradigm, NOT the Frame-Controller-Model Paradigm)
The example on the SDK works OK, because the fixed text implementation
has no context menu, but how do I intercept the context menu of
UnoControls? Is it possible at all? (I mean, using API, not hacking
OOo's C++ code).
No, that's no possible. Currently the toolkit uno controls are just
small wrappers around the VCL based controls. If you need something like
this you have to write a "request for enhancement". We want to extend
the current toolkit API, but need feedback from extension developers.
Only you can give us information what you really miss. Therefore please
write request for enhancements and let us know your problems with the API.
You can find the result of a gap analysis I did last year regarding the
toolkit API here:
http://wiki.services.openoffice.org/wiki/Framework/Article/Gap_Analysis_Tookit_API
Regards,
Carsten
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]