Issue 109492 - insertDocumentFromURL does not support inputstream
Summary: insertDocumentFromURL does not support inputstream
Status: UNCONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-21 15:45 UTC by ms7777
Modified: 2013-02-24 21:10 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
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.