/* ------------------------------------------------------------------ */ /** closes our document, if we have an open one, via (simulated) user input
*/ protectedvoid closeDocumentByUI()
{ try
{ if ( m_document != null )
{ // first, set the document to "unmodified"
XModifiable docModify = m_document.query( XModifiable.class );
docModify.setModified( false );
// CloseDoc is asynchronous, so wait until it's done - or 1 second, at most synchronized ( this ) { wait( 1000 ); }
}
} catch ( java.lang.Exception e )
{
e.printStackTrace( System.err );
}
}
/* ------------------------------------------------------------------ */ /** closes our document, if we have an open one
*/ protectedvoid closeDocument()
{ try
{ // close our document if ( m_document != null )
{
XCloseable closeDoc = m_document.query( XCloseable.class );
closeDoc.close( true );
}
} catch ( com.sun.star.uno.Exception e )
{
e.printStackTrace( System.err );
}
}
/* ------------------------------------------------------------------ */ /** prepares a new document to work with
*/ protectedvoid prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception
{
m_document = DocumentHelper.blankDocument( m_orb, m_documentType );
m_document.getDocument( ).addEventListener( this );
m_formLayer = new FormLayer( m_document );
}
/* ------------------------------------------------------------------ */ /* internal methods */ /* ------------------------------------------------------------------ */ /** waits for the user to press a key (on the console where she started the java program) orthedocumenttobeclosedbytheuser. @return <TRUE/>iftheuserpressedakeyontheconsole,<FALSE/>ifsheclosedthedocument
*/ protectedboolean waitForUserInput() throws java.lang.Exception
{ synchronized (this)
{
integration.forms.WaitForInput aWait = new integration.forms.WaitForInput( this );
aWait.start();
wait();
// if the waiter thread is done, the user pressed enter boolean bKeyPressed = aWait.isDone(); if ( !bKeyPressed )
aWait.interrupt();
return bKeyPressed;
}
}
/* ------------------------------------------------------------------ */ /* XEventListener overridables */ /* ------------------------------------------------------------------ */ publicvoid disposing( com.sun.star.lang.EventObject eventObject )
{ if ( m_document.getDocument().equals( eventObject.Source ) )
{ // notify ourself that we can stop waiting for user input synchronized (this)
{
notify();
}
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.