Apache OpenOffice (AOO) Bugzilla – Issue 61522
changes on attributes added to DocumentInfo don't fire propertyChange/vetoableChange
Last modified: 2013-07-30 02:43:19 UTC
Use the following java code to create an additional attribute stored at the document (not you'll need jdk1.5 for it!). After running the class (of course you have to ensure that the needed jars are in the CLASSPATH) you'll see that the attribute was added to the document but even setting the attribute of the property to BOUND and CONSTRAINED don't lead into an event in case of a PropertyChange: import com.sun.star.beans.*; import com.sun.star.comp.helper.*; import com.sun.star.document.*; import com.sun.star.frame.*; import com.sun.star.lang.*; import com.sun.star.lang.EventObject; import com.sun.star.uno.*; import com.sun.star.uno.Exception; public class Test { @SuppressWarnings("unchecked") public final static <T>T cast(Class<T> type, Object object) { return (T) UnoRuntime.queryInterface(type, object); } public static void main(String[] args) throws BootstrapException, Exception, InterruptedException { XComponentContext context = Bootstrap.bootstrap(); XMultiComponentFactory factory = context.getServiceManager(); XDesktop desktop = cast(XDesktop.class, factory.createInstanceWithContext("com.sun.star.frame.Desktop", context)); XPropertySet desktopProperties = cast(XPropertySet.class, desktop); XComponentLoader desktopLoader = cast (XComponentLoader.class, desktop); XComponent textDocumentComponent = desktopLoader.loadComponentFromURL("private:factory/swriter", "_blank", FrameSearchFlag.ALL, new PropertyValue[] {}); XDocumentInfoSupplier documentInfoSupplier = cast (XDocumentInfoSupplier.class, textDocumentComponent); XDocumentInfo documentInfo = documentInfoSupplier.getDocumentInfo(); XPropertyContainer documentInfoContainer = cast (XPropertyContainer.class, documentInfo); XPropertySet documentProperties = cast (XPropertySet.class, documentInfo); System.out.println("setting document variable"); documentInfoContainer.addProperty("test", (short) (PropertyAttribute.REMOVEABLE | PropertyAttribute.BOUND), "content"); documentProperties.addPropertyChangeListener("", new XPropertyChangeListener() { public void disposing(EventObject arg0) { System.out.println("Disposing"); } public void propertyChange(PropertyChangeEvent arg0) { System.out.println("PropertyChanged: " + arg0.PropertyName); } }); documentProperties.addVetoableChangeListener("", new XVetoableChangeListener() { public void disposing(EventObject arg0) { System.out.println("Disposing"); } public void vetoableChange(PropertyChangeEvent arg0) throws PropertyVetoException { System.out.println("PropertyVeto: " + arg0.PropertyName); } }); Thread.sleep(1000); // just to be sure that listener registration is finished System.out.println("setting document variable again"); documentProperties.setPropertyValue("test", "lall"); } }
@ npower: Can you have as look and try to reproduce?
@leguff Can you please attach a testkit with a sample document here?
firstly sorry that there has been no activity on this bug, I am not the correct owner but I should have moved this on to someone else but it just went off the radar :-( sounds like a framework issue
Created attachment 40578 [details] Go into the program/classes-folder of your OOo-installation and execute you java5-vm like follows (here: Win32 - replace ; by : for Unix): java -cp c:\demo4issue61522.jar;ridl.jar;jurt.jar;juh.jar;sandbox.jar;unoil.jar Demo4Issue61522
Andreas, please take over
The corresponding class SfxDocumentInfoObject inside the SFX module does not supports any type of listener. The methods for registration of such listener arenot implemented ...
It seems that no further information is required
Reset assignee on issues not touched by assignee in more than 1000 days.