I want to add a Listener on a Document to send a "ENTER" if the user use all paragraph ( is a limitation on openoffice of size on one paragraph )

Ok... I add a ModifyListener... but when i call:

System.out.println("See the text "+mxDoc.getText());

The app freeze... exist a problem with my Code ?


I'm using Java SE 6 , and OfficeBean ;)
aBean is a OfficeBean


Somebody help-me ? I need this to use OpenOffice in my app !!!

  try {
           aBean.getDocument().addModifyListener(new XModifyListener() {
               int i = 1;
public void modified(EventObject eventObject) { System.out.println("See me !!! "+eventObject.Source.getClass() );
                   XTextDocument mxDoc = null;
mxDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, eventObject); XText eee = (XText) UnoRuntime.queryInterface(XText.class, eventObject);

                   System.out.println("See the text "+mxDoc.getText());
// get a reference to the body text of the document
                   XText mxDocText = mxDoc.getText();
mxDocText.insertString(null,"\n",true);
                   System.out.println("modified !"+i++);
               }
public void disposing(EventObject eventObject) {
                   System.out.println("dispose");
               }
}); } catch (NoConnectionException ex) {
           ex.printStackTrace();
       }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to