Hello Andrzej!
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".
OK, I setup the exceptions to be sure that I get any information on the events,
but I guess it wasn't the best idea ;-)
The logfile works indeed, and I'll stick to that.
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.
Yes, I thought about that, but since I didn't have the parent window for the control
I attached the listener to any window I had ;-)
"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
this is a little confusing for me, but I think I'll get used to it
Reference< XMultiServiceFactory > m_xSMGR = xSMGR; // provided during
creation of your service
Why can't I use the xSMGR ?
Reference< XPropertySet > xProps(m_xSMGR, UNO_QUERY);
At this point I finally understood ( at least so I think... ;-) ) what's going on here.
Each time I want some interface from a component I have to query it to get it, right?
like here - I want an XPropertySet interface, so I query the MultiServiceFactory object
which returns a XPropertySet reference. Why can't I use casts? Like :
(XPropertySet(m_xSMGR))->somePropertySetSpecificMethod() ?
I guess it's a design concept, but is my understanding correct ?
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.
done.
I added the eventlistener to that component.
Now I'll try to make the tabcontrol visible somewhere in the window,
and then add a TabListener for it.
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 .-)
I agree. Finally I feel like I made a little progress with the work :-)
Andrzej