To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=76012 Issue #|76012 Summary|copy with transferable-Object over page-boundaries cra |sh openOffice Component|Word processor Version|OOo 2.2 Platform|PC URL| OS/Version|Windows XP Status|UNCONFIRMED Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|programming Assigned to|mru Reported by|mbudnick
------- Additional comments from [EMAIL PROTECTED] Mon Apr 2 09:44:39 +0000 2007 ------- Use OpenOffice as service provider and controle it with java. If you mark, copy and past text with usage of XTransferableSupplier openOffice will crash if the pasted text cross the page-boundary to the next page. See the following Test.java for an example: If you set NUMBER_OF_LINES to 60, openOffice crash by the first trial to past the text. If you set NUMBER_OF_LINES to 30, openOffice crash by the secount trial to past the text. If you set NUMBER_OF_LINES to 4, openOffice don't crash because the page-boundary will never cross when pasting. package de.all4net.openoffice; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.datatransfer.XTransferable; import com.sun.star.datatransfer.XTransferableSupplier; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XController; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.text.ControlCharacter; 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; import com.sun.star.view.XSelectionSupplier; public class Test { public static void main(String[] args) throws Throwable { // Connect to OpenOffice.org XComponentContext localContext = Bootstrap.createInitialComponentContext(null); XMultiComponentFactory localServiceManager = localContext.getServiceManager(); Object urlResolver = localServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext ); XUnoUrlResolver unoUrlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface(XUnoUrlResolver.class, urlResolver); Object initialObject = unoUrlResolver.resolve("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"); XPropertySet propertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, initialObject); Object context = propertySet.getPropertyValue("DefaultContext"); XComponentContext componentContext=(XComponentContext)UnoRuntime.queryInterface(XComponentContext.class, context); XMultiComponentFactory serviceManager = componentContext.getServiceManager(); // Retrieve Desktop Object desktop = serviceManager.createInstanceWithContext("com.sun.star.frame.Desktop", componentContext); // Open empty document XComponentLoader componentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop); XComponent document = componentLoader.loadComponentFromURL("private:factory/swriter", "_blank", 0, new PropertyValue[] {} ); XTextDocument sourceDoc = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, document); // create blank lines (paragraphs) final int NUMBER_OF_LINES = 60; XText text = sourceDoc.getText(); for (int i=0; i < NUMBER_OF_LINES; i++) { text.insertControlCharacter(text.getEnd(), ControlCharacter.PARAGRAPH_BREAK, false); } // Open second empty document document = componentLoader.loadComponentFromURL("private:factory/swriter", "_blank", 0, new PropertyValue[] {} ); XTextDocument targetDoc = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, document); // mark source XTextCursor sourceCursor = sourceDoc.getText().createTextCursorByRange(sourceDoc.getText().getStart()); sourceCursor.gotoRange(sourceDoc.getText().getEnd(), true); //select XController sourceController = sourceDoc.getCurrentController(); XSelectionSupplier sourceSelection = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, sourceController); sourceSelection.select(sourceCursor); //copy XTransferableSupplier sourceTransferable = (XTransferableSupplier)UnoRuntime.queryInterface(XTransferableSupplier.class, sourceController); XTransferable transferable = sourceTransferable.getTransferable(); // copy blank lines (paragraphs) into second document, 10 times for (int i=0; i<10; i++) { System.out.println("trial " + i); //paste XController targetController = targetDoc.getCurrentController(); XTransferableSupplier targetTransferable = (XTransferableSupplier)UnoRuntime.queryInterface(XTransferableSupplier.class, targetController); targetTransferable.insertTransferable(transferable); //wait to see whether openOffice will crash or not try{Thread.sleep(3000);} catch(java.lang.InterruptedException e) {;} } 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]