On 28.02.2011 14:07, Thibault Vataire wrote:
Hi,

I need to programmatically retrieve the state of the feature "Format>
AutoCorrect>  While Typing" in Writer.

I've tried two ways but none works properly :

1/ Reading the corresponding property in the Writer.xcu configuration
file. But this value don't seem to be updated when application is
running, only when the application is shutting down.

That's intended; you should see the xcu files as an implementation detail that shouldn't be accessed at runtime.


2/ I can read the state of the menu's entry :

myFrame.LayoutManager.getElement("private:resource/menubar/menubar").XMenuBar.getPopupMenu(itemId1).(...).isItemChecked(itemId2)

 But this value is really updated only if the menu "AutoCorrect" is
displayed one more time after the value has changed.

This isn't a good idea.


Is someone known another way to retrieve this value ?

You could register a StatusListener for ".uno:OnlineAutoFormat" (IIRC). But this means that you have to do that at every frame.

It should be possible to register a ConfigurationUpdateListener for the corresponding key in the xcu file, but it's possible that it doesn't work either because Writer caches this setting internally. That would be a bug, but I assume that this doesn't make it better. I'm afraid you have to find that out.

Regards,
Mathias

--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "nospamfor...@gmx.de".
I use it for the OOo lists and only rarely read other mails sent to it.
--
-----------------------------------------------------------------
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help

Reply via email to