To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=57047 Issue #:|57047 Summary:|XDocumentInsertable.insertDocumentFromURL() doesn't |accept an InteractionHandler Component:|api Version:|OOO 2.0 Beta2 Platform:|All URL:| OS/Version:|All Status:|UNCONFIRMED Status whiteboard:| Keywords:| Resolution:| Issue type:|DEFECT Priority:|P3 Subcomponent:|code Assigned to:|sw Reported by:|clutz
------- Additional comments from [EMAIL PROTECTED] Mon Oct 31 06:11:00 -0800 2005 ------- The method XDocumentInsertable.insertDocumentFromURL() expects an argument of type MediaDescriptor ([in] sequence< ::com::sun::star::beans::PropertyValue > insertProps). Trying to set the Value of insertProps.InteractionHandler to an own implementation of XInteractionHandler causes insertDocumentFromURL() to throw an InvalidArgumentException. The following code example demontrates this behaviour: import com.sun.star.beans.PropertyValue; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.document.XDocumentInsertable; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XComponentLoader; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.task.XInteractionHandler; import com.sun.star.task.XInteractionRequest; import com.sun.star.text.XText; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; public class InsertDocumentFromURLTest { public static void main(String[] args) throws Exception { PropertyValue[] insertProps; // bootstrap and create Desktop XComponentContext xContext = Bootstrap.bootstrap(); XMultiComponentFactory xMCF = xContext.getServiceManager(); Object desktop = xMCF.createInstanceWithContext( "com.sun.star.frame.Desktop", xContext); // create empty document XComponentLoader xLoader = (XComponentLoader) UnoRuntime .queryInterface(XComponentLoader.class, desktop); XComponent doc = xLoader.loadComponentFromURL( "private:factory/swriter", "_blank", FrameSearchFlag.CREATE, new PropertyValue[0]); // create insertion-textcursor XTextDocument xTextDoc = (XTextDocument) UnoRuntime.queryInterface( XTextDocument.class, doc); XText xText = xTextDoc.getText(); XTextCursor cursor = xText.createTextCursor(); XDocumentInsertable xInsert = (XDocumentInsertable) UnoRuntime .queryInterface(XDocumentInsertable.class, cursor); System.out.println("test 1"); // providing a non-empty MediaDescriptor throws an // IllegalArgumentException. insertProps = new PropertyValue[] { new PropertyValue() }; insertProps[0].Name = "InteractionHandler"; insertProps[0].Value = new XInteractionHandler() { public void handle(XInteractionRequest arg0) { // do something } }; xInsert.insertDocumentFromURL("file:///home/foo/aFile.odt", insertProps); System.out.println("finished!"); System.exit(0); } } --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]