To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=113323
                 Issue #|113323
                 Summary|officebean.dll : keyboard and mouse listeners lost in 
                        |editor after insert
               Component|api
                 Version|OOO320m12
                Platform|PC
                     URL|
              OS/Version|Windows XP
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|code
             Assigned to|jsc
             Reported by|lapsus63





------- Additional comments from [email protected] Wed Jul 21 10:39:28 
+0000 2010 -------
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
firstRowAsTitle)
        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,
index.getByIndex(0));
                        
                        //see help
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Inserting_Tables
                        //other interresting ex. :
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Inserting_Tables
                        XMultiServiceFactory xDocFactory = 
(XMultiServiceFactory)
UnoRuntime.queryInterface( XMultiServiceFactory.class, model); 
                        XTextTable newTextTable = (XTextTable)
UnoRuntime.queryInterface(XTextTable.class,
xDocFactory.createInstance("com.sun.star.text.TextTable"));
                        
                        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: com.sun.star.text.TextTableRow)
                 // 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) {
                e.printStackTrace();
        }
}

/** 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,
xTable.getCellByName(sCellName));
        // 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);
        try
        {
                // 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...
                        // http://www.oooforum.org/forum/viewtopic.phtml?t=69942
                        // 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
        xCellText.setString(sText);
}

---------------------------------------------------------------------
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]

Reply via email to