Issue 113323 - officebean.dll : keyboard and mouse listeners lost in editor after insert
Summary: officebean.dll : keyboard and mouse listeners lost in editor after insert
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2010-07-21 11:39 UTC by lapsus63
Modified: 2013-02-24 21:08 UTC (History)
1 user (show)

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


Note You need to log in before you can comment on or make changes to this issue.
Description lapsus63 2010-07-21 11:39:28 UTC
I'm using officebean.dll in my Swing application. Sometimes, the Open Office
(Writer) document doesn't have any reaction when typing some text in the
document, or when scroll with the mouse. Nevertheless, I can use buttons, select
some text... OOo is not in read-only mode because I can insert new table (using
menu) etc. I can't see nor move the current cursor location with the mouse.

This bug appears after inserting a new table with some data in it from this
following java method (parameter 'data' was a String[15][3], and
'firstRowAsTitle' was false) :

/** Inserts into the OOo document a new table calculated from <code>data</code>.
 * @param firstRowAsTitle tells if specific format is needed for the first row
public static void insertTable(XModel model, String[][] data, boolean
	throws ExceptionCommunicationTraitementTexteOpenOfficeImpossible
	try {
		if (data.length>0 && data[0].length>0) {
			XSelectionSupplier selection = (XSelectionSupplier)
UnoRuntime.queryInterface(XSelectionSupplier.class, model.getCurrentController());
			XIndexAccess index = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, selection.getSelection());
			XTextRange tr = (XTextRange) UnoRuntime.queryInterface(XTextRange.class,
			//see help
			//other interresting ex. :
			XMultiServiceFactory xDocFactory = (XMultiServiceFactory)
UnoRuntime.queryInterface( XMultiServiceFactory.class, model); 
			XTextTable newTextTable = (XTextTable)
			newTextTable.initialize(data.length, data[0].length);
			XTextDocument textDoc = (XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class, model);
			XText text = textDoc.getText();
			// Inserts in the "text" document
			text.insertTextContent(tr, newTextTable, true);
	         // Get an XIndexAccess of the table rows
	         // XIndexAccess xRows = newTextTable.getRows();
	         // Access the property set of the first row (properties listed in
service description:
	         // XPropertySet xRow = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xRows.getByIndex ( 0 ) );
	         // Access the property set of the whole table
	         // XPropertySet xTableProps =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, newTextTable);
	         // Inserting data in the table
	         for (int row=0; row<data.length; row++) {
	        	 boolean titleCell = (row == 0) && firstRowAsTitle;
	        	 for (int col=0; col<data[row].length; col++) {
	        		 String cellCoord = METString.encodeBase26(col) + (row+1);
	        		 String value = data[row][col];
	        		 insertIntoCell( cellCoord, value, newTextTable, titleCell );
	        		 // Other solution : 
	                 // newTextTable.getCellByName(cellCoord).setValue( value );
	        		 // nota : .setFormula( "sum <A2:C2>" ) in replacement of setValue 	
	catch (Exception e) {

/** This method sets the text of the cell refered to by sCellName to the string
sText in it */
public static void insertIntoCell(String sCellName, String sText, XTextTable
xTable, boolean titleCell)
	// Access the XText interface of the cell referred to by sCellName
	XText xCellText = (XText) UnoRuntime.queryInterface(XText.class,
	// create a text cursor from the cells XText interface
	XTextCursor xCellCursor = xCellText.createTextCursor();
	// Get the property set of the cell's TextCursor
	XPropertySet xCellCursorProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xCellCursor);
		// Set the colour of the text to white
		// xCellCursorProps.setPropertyValue("CharColor", new Integer(16777215));
		if (false == titleCell) {
			// "Title of table" remains on the first row, need to replace it ideally by
"Table content" like other rows
			// Play the guess to find the correct words...
			// deletes default formating for title cells (1st row)
			xCellCursorProps.setPropertyValue("CharWeight", FontWeight.NORMAL);
			xCellCursorProps.setPropertyValue("ParaAdjust", ParagraphAdjust.LEFT);
	catch (Exception e)
		new ExceptionErreurInterne(e);
	// Set the text in the cell to sText
Comment 1 lapsus63 2010-07-26 09:44:21 UTC
Actually the bug appears even without using the code but only manipulating the
Quite easy to reproduce (but far from being systematic) with a document
containing a header part and some tables (in or not in the header). Try to
delete some rows using the tables menu icons.

Hey I think I got it : 
1 - Make and delete a default 2x2 table at the very begining of the body part of
the document. 
2 - Now clic on the first cell (for me the table menu does not appear)
3 - Clic on the text part and return in the first cell (the table menu appears
this time)
4 - Delete first and then the 2nd row
5 - Result : Scroll and text input are desactivated.

Maybe this bug could have something to do with #7747 (Opened: Mon Sep 16
18:05:00 +0000 2002 ? Impressive...)
Comment 2 jsc 2010-07-26 10:19:03 UTC
jsc->tkr: a bean issue

@lapsus63: the bean is somewhat unmaintained, you shouldn't expect a bug fix
fast. It has a very low prio -> target OOo later
Comment 3 lapsus63 2010-07-26 10:46:54 UTC
Thanks a lot for reply. Do you have any explaination about the leak of
maintenance of the bean ? It's such a pity...  Do you know if other solution
could be employed by developpers to integrate OOo within Swing applications ?
Thanks for help !