/** This class tries to simplify some tasks like loading a document or gettingvariousobjects.
*/ publicclass SimpleOffice
{ private XDesktop mxDesktop = null; private OfficeConnection aConnection; privateint mnPortNumber;
public XDesktop getDesktop ()
{ if (mxDesktop != null) return mxDesktop; try
{ // Get the factory of the connected office.
XMultiServiceFactory xMSF = aConnection.getServiceManager (); if (xMSF == null)
{
MessageArea.println ("can't connect to office"); returnnull;
} else
MessageArea.println ("Connected successfully.");
// Create a new desktop.
mxDesktop = UnoRuntime.queryInterface(
XDesktop.class,
xMSF.createInstance ("com.sun.star.frame.Desktop")
);
} catch (Exception e)
{
MessageArea.println ("caught exception while creating desktop: "
+ e);
}
return mxDesktop;
}
/** Return a reference to the extended toolkit which is a broadcaster of topwindow,key,andfocusevents.
*/ public XExtendedToolkit getExtendedToolkit ()
{
XExtendedToolkit xToolkit = null; try
{ // Get the factory of the connected office.
XMultiServiceFactory xMSF = aConnection.getServiceManager (); if (xMSF != null)
{
xToolkit = UnoRuntime.queryInterface(
XExtendedToolkit.class,
xMSF.createInstance ("stardiv.Toolkit.VCLXToolkit")
);
}
} catch (Exception e)
{
MessageArea.println ("caught exception while creating extended toolkit: " + e);
}
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.