if ( nOldState == com.sun.star.embed.EmbedStates.LOADED )
{
// switch to the RUNNING state first
String aText = ReadStringFromStream( m_xOwnStorage, "content.txt" );
EditorFrame aEditorFrame = new EditorFrame( m_aEntryName, this, 5, 20 );
aEditorFrame.setText( aText );
ReadSizeFromOwnStorage();
m_aEditorFrame = aEditorFrame;
m_nObjectState = com.sun.star.embed.EmbedStates.RUNNING;
if ( nNewState == com.sun.star.embed.EmbedStates.ACTIVE )
{
if ( m_xClient == null )
throw new com.sun.star.embed.WrongStateException();
m_aEditorFrame.show();
m_aEditorFrame.toFront();
if ( m_aObjSize != null )
aEditorFrame.setAppSize( m_aObjSize );
m_xClient.visibilityChanged( true );
m_nObjectState = com.sun.star.embed.EmbedStates.ACTIVE;
}
}
else if ( nOldState == com.sun.star.embed.EmbedStates.RUNNING )
{
if ( nNewState == com.sun.star.embed.EmbedStates.LOADED )
{
EditorFrame aFrame = m_aEditorFrame;
m_aEditorFrame = null;
aFrame.dispose();
m_nObjectState = nNewState;
}
else // nNewState == ACTIVE
{
if ( m_aEditorFrame == null )
throw new com.sun.star.uno.RuntimeException();
if ( m_xClient == null )
throw new com.sun.star.embed.WrongStateException();
m_aEditorFrame.show();
m_aEditorFrame.toFront();
if ( m_aObjSize != null )
m_aEditorFrame.setAppSize( m_aObjSize );
m_xClient.visibilityChanged( true );
m_nObjectState = nNewState;
}
}
else // nOldState == ACTIVE
{
UpdateSizeAndGetFromActive();
if ( nNewState == com.sun.star.embed.EmbedStates.RUNNING )
{
m_aEditorFrame.hide();
m_nObjectState = nNewState;
}
else // nNewState == LOADED
{
EditorFrame aFrame = m_aEditorFrame;
m_aEditorFrame = null;
aFrame.dispose();
m_nObjectState = nNewState;
}
}
}
catch( com.sun.star.uno.Exception e )