Hello Andrzej!

Hello !

I'm the lucky one that has been selected for coding the Tabbed
Windows feature.

As my mentor - Andreas Schluns - mentioned earlier the work on the project has already started, but I'm still having some problems with the framework I think. Today I tried to implement a simple WindowListener for the future TaskCreator service, but after adding my event listener to the window I don't think any events are triggered because the methods from my event listener are not called. I'm thinking that maybe I need to use the XEventBroadcaster, but I'm not sure how to do that. A couple of tries I made resulted in office crashes.

a)
Your registration to the window was right ... and further your listener methods was called. But you throwed RuntimeExceptions with some debug messages inside your callbacks. That's not a good idea - because nobody inside office catches such runtime exceptions and so the office died immediatly.

It's better to debug your callbacks or to print out some messages on stdout/stderr.
Not: On windows such stdout messages are not visible by default.
You have to redirect it to a log file by using ".\soffice.exe >& yourlogfile.log".

b)
On the other side you should not listen on the new created tab windows ... you should listen on the parent window only. This parent window is provided by the TabControl.
Idea behind: You listen for resizes on one parent window and resize all
tabbed child windows.

The other thing I was trying to do is creating an instance of the Tab control inside my component. I failed with that too. I got compilation errors saying something like 'unable to extract TabWindowFactory'.

"TabWindowFactory" isnt a valid interface.
You must differ between:

a)
An UNO service name, which is a string value only and can be used to specify a service on creation time.

b)
An UNO implementation name, which is similar to an UNO service name, but describe the implementation class instead of a generic service.

c)
An UNO interface, which can be used inside your implementation as:
- include
- baseclass
- for quering

For the TabWindowFactory/TabWindow services it's the following:

--------------------------------------------------------------------------

// include the needed interfaces
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/awt/XSimpleTabController.hpp>

// create the TabWindowFactory service, using it's service name
Reference< XInterface > xTabWindowFactory1 = xSMGR->createInstance("com.sun.star.frame.TabWindowFactory");

// doing the same using it's implementation name !
Reference< XInterface > xTabWindowFactory2 = xSMGR->createInstance("com.sun.star.comp.framework.TabWindowFactory");

// query TabWindowFactory for other needed interfaces ...
Reference< XSingleComponentFactory > xTabWindowFactory(xTabWindowFactory1, UNO_QUERY);

// and use it to get a new TabControl from it.
// (Comments to xDefaultContext follow below!)
Reference< XInterface > xTabControl1 = xTabWindowFactory->createInstanceWithContext(xDefaultContext);

// query the TabControl to an interface ...
Reference< XSimpleTabController > xTabControl(xTabControl1, UNO_QUERY);

// and utse it to create new tabs.
xTabControl->...

--------------------------------------------------------------------------

BTW: The service TabWindowFactory uses already the new UNO concepts for creating services inside an existing or new component context.
If you use the old behaviour it's not concurrent to this ... because the
XMultiServiceFactory interface of the UNO service manager does the same internaly (and uses a default context).

How can you get this needed default context ?
It's a property of the provided UNO service manager.
E.g.

Reference< XMultiServiceFactory > m_xSMGR = xSMGR; // provided during creation of your service

Reference< XPropertySet > xProps(m_xSMGR, UNO_QUERY);
Any aProp = xProps->getPropertyValue("DefaultContext");
Reference< XComponentContext > xDefaultContext;
aProp >>= xDefaultContext;

The source code is temporarily placed here :
http://iapart.net/dav/soc/window_event/

Andreas, could you please check on it ;-) ?

You should do the following:

- You have to copy the IDL files we provieded to you (XSimpleTabController.idl and XTabListener.idl) into your SDK ("<sdkroot>/idl/com/sun/star/awt/").

- Add the new used interfaces to your window.uno.xml file.
(e.g. XComponentContext, XPropertySet, XSingleComponentFactory, XSimpleTabController, XTabListener)

- Add all neded includes for these interfaces to your window.cxx file.

- Retrieve the default component context from the UNO service manager as shown above.

- Create the services TabWindowFactory and TabControl as shown above.

- Get the parent window from the TabControl by using the interface XPropertySet and retrieving the property "ParentWindow".

- Use this parent window at creation time of your child windows.

I already started the registration process at sourceforge, so hopefully in a couple of days I'll be able to keep the source code there.

Fine.

Of course you can use our cvs to check in your code too.
But then you need a SSH key, access rights for commiting and so on.
We can discuss that more in detail next time ... but first we should try to create a first draft of your tabbed interface .-)

Regards,
Andrzej Wytyczak-Partyka

Regards
Andreas

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

Reply via email to