Hi Mathias, Yes, I used this method, but I had not taken time to expose it on the mailing list.
Here's what I do : * I register a job on "OnLoad" and "OnNew" events. When executed, this job registers a DispatchProviderInterceptor on frames. * when the "queryDispatch" method receives ".uno:OnlineAutoFormat" as URL, I register a StatusListener. I use the Borg design pattern to share internal state of each listeners. * on StatusListener's initialization, I read initial state from the xcu file * when the "statusChanged" method of a listener is called, I update the shared state using the "State" event's property. Thank you very much for your response. Regards, Thibault Vataire. ----- Mail original ----- De: "Mathias Bauer" <nospamfor...@gmx.de> À: dev@api.openoffice.org Envoyé: Mardi 15 Mars 2011 19:17:30 Objet: [api-dev] Re: How to retrieve the state of the feature "Format > AutoCorrect > While Typing" in Writer ? 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 -- ----------------------------------------------------------------- To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help