Issue 61522

Summary: changes on attributes added to DocumentInfo don't fire propertyChange/vetoableChange
Product: General Reporter: leguff <mathias>
Component: codeAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, rainerbielefeld_ooo_qa
Version: OOo 2.0.1Keywords: oooqa
Target Milestone: AOO Later   
Hardware: All   
OS: Windows XP   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
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 none

Description leguff 2006-02-02 12:17:34 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");

	}

}
Comment 1 Olaf Felka 2006-03-07 08:59:42 UTC
@ npower: Can you have as look and try to reproduce?
Comment 2 Rainer Bielefeld 2006-11-14 17:44:17 UTC
@leguff 
Can you please attach a testkit with a sample document here?
Comment 3 noel.power 2006-11-15 08:03:45 UTC
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
Comment 4 leguff 2006-11-15 09:09:33 UTC
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
Comment 5 Mathias_Bauer 2006-11-15 10:05:33 UTC
Andreas, please take over
Comment 6 andreas.schluens 2007-01-02 09:59:35 UTC
The corresponding class SfxDocumentInfoObject inside the SFX module does not
supports any type of listener. The methods for registration of such listener
arenot implemented ...
Comment 7 Rainer Bielefeld 2007-01-02 10:05:56 UTC
It seems that no further information is required
Comment 8 Rob Weir 2013-07-30 02:43:19 UTC
Reset assignee on issues not touched by assignee in more than 1000 days.