Issue 109492

Summary: insertDocumentFromURL does not support inputstream
Product: App Dev Reporter: ms7777 <ms777>
Component: apiAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, luciano.zu
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description ms7777 2010-02-21 15:45:17 UTC
problem was mentioned e.g. in #57047. Issue owner was asked to include this 
into #57407, but did not do include it (probably due to one problem - one 
issue - rule).
Comment 1 jsc 2010-02-22 09:00:45 UTC
jsc -> tl: to you because it's a writer specific interface.
Comment 2 thomas.lange 2010-07-02 07:35:40 UTC
.
Comment 3 lzu 2011-01-25 12:59:52 UTC
I've the same problem.

Test platforms:
Windows XP Professional - OOO320m18  Build 9502
Ubuntu Linux 2.6.27-17-server - OO 2.4.1

Comment 4 lzu 2011-01-26 11:15:43 UTC
This is my work around. I don't know if works for each content.

	private void insertDocumentFromStreamWorkAround(XTextDocument xTextDocument,
XTextRange xSearchTextRange, XInputStream xInputStream) throws IOException,
IllegalArgumentException, CloseVetoException, UnsupportedFlavorException {
		OODocumentHelper insertingDocumentHelper = new OODocumentHelper(ooConnection,
xInputStream);
		
		XTextDocument insertingTextDocument =
(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,
insertingDocumentHelper.getDocument());
		XController insertingController = insertingTextDocument.getCurrentController();
		XTextViewCursorSupplier insertingSupplier =
(XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, insertingController);
		XTextViewCursor insertingCursor = insertingSupplier.getViewCursor(); 
		insertingCursor.gotoStart(false); // Select all
		insertingCursor.gotoEnd(true);
		XTransferableSupplier insertingTransferSupplier =
(XTransferableSupplier)UnoRuntime.queryInterface(XTransferableSupplier.class,
insertingController);
		XTransferable xTransferable =  insertingTransferSupplier.getTransferable(); 		
		
		XController targetController = xTextDocument.getCurrentController();
		XTextViewCursorSupplier targetSupplier =
(XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSupplier.class, targetController);
		XTextViewCursor targetCursor = targetSupplier.getViewCursor();
		targetCursor.gotoRange(xSearchTextRange.getStart(), false); // Select my
searched piece.
		targetCursor.gotoRange(xSearchTextRange.getEnd(), true);
		XTransferableSupplier targetTransferSupplier =
(XTransferableSupplier)UnoRuntime.queryInterface(XTransferableSupplier.class,
targetController);
		targetTransferSupplier.insertTransferable(xTransferable);
		
		insertingDocumentHelper.closeDocumentUploaded();
	}

OODocumentHelper is a class of mine to manage documents. It opens an odt with a
loadDocumentFromUrl. I hope this can help.