/** The purpose of this class is to provide a factory for creating the service *(<CODE>__getServiceFactory</CODE>)andwritestheinformationintothegiven *registrykey(<CODE>__writeRegistryServiceInfo</CODE>).
*/ publicclass Inspector{ publicstaticfinal String sIDLDOCUMENTSUBFOLDER = "docs/idl/ref/";
/** This class implements the method of the interface XInstanceInspector. *AlsotheclassimplementstheinterfacesXServiceInfo,andXTypeProvider.
*/ publicstaticclass _Inspector extends WeakBase implements XInstanceInspector, XServiceInfo{
privatestaticfinal String __serviceName = "org.openoffice.InstanceInspector"; private HashMap<String, String> aApplicationHashMap = new HashMap<String, String>(); private String sTitle = "Object Inspector"; private ArrayList<XComponent> aHiddenDocuments = new ArrayList<XComponent>(); private XComponentContext m_xComponentContext; private HashMap<String, InspectorPane> aInspectorPanes = new HashMap<String, InspectorPane>(); private XDialogProvider m_oSwingDialogProvider; private TDocSupplier oTDocSupplier; private Introspector m_oIntrospector = null; // TODO: improve these strings: privatestaticfinal String sWRONGINSTALLATIONPATH = "Your selected path does not refer to an SDK-Installation!"; /** Creates a new instance of Dialog */ public _Inspector(XComponentContext _xComponentContext) {
m_xComponentContext = _xComponentContext;
m_oIntrospector = Introspector.getIntrospector(m_xComponentContext);
aApplicationHashMap.put("private:factory/swriter", "Text Document");
aApplicationHashMap.put("private:factory/scalc", "Spreadsheet");
aApplicationHashMap.put("private:factory/simpress", "Presentation");
aApplicationHashMap.put("private:factory/sdraw", "Drawing");
aApplicationHashMap.put("private:factory/smath", "Formula");
m_oSwingDialogProvider = new SwingDialogProvider(this, sTitle);
}
public XComponentContext getXComponentContext(){ return m_xComponentContext;
}
public HashMap<String, InspectorPane> getInspectorPages(){ return aInspectorPanes;
}
publicvoid setSourceCodeLanguage(finalint _nLanguage){ try{
String sLanguage = "Java";
XNameAccess xNameAccess = getConfigurationAccess("org.openoffice.inspector.ObjectInspector", true);
XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess); switch (_nLanguage){ case XLanguageSourceCodeGenerator.nJAVA:
sLanguage = "Java"; break; case XLanguageSourceCodeGenerator.nCPLUSPLUS:
sLanguage = "CPlusPlus"; break; case XLanguageSourceCodeGenerator.nBASIC:
sLanguage = "Basic"; break; default:
System.out.println("Warning: Sourcecode language is not defined!");
}
xPropertySet.setPropertyValue("Language", sLanguage);
XChangesBatch xBatch = UnoRuntime.queryInterface(XChangesBatch.class, xNameAccess);
xBatch.commitChanges(); for (int i = 0; i < m_oSwingDialogProvider.getInspectorPageCount(); i++){
m_oSwingDialogProvider.getInspectorPage(i).convertCompleteSourceCode(_nLanguage);
}
}catch( Exception exception ) {
exception.printStackTrace(System.err);
}}
private TDocSupplier getTDocSupplier(){ if (oTDocSupplier == null){
oTDocSupplier = new TDocSupplier(m_xComponentContext);
} return oTDocSupplier;
}
public String[] getTDocUrls(){ return getTDocSupplier().getTDocUrls();
}
public String[] getTDocTitles(String[] _sTDocUrls){ return getTDocSupplier().getTDocTitles(_sTDocUrls);
}
public String[][] getApplicationUrls(){
Set<String> aSet = aApplicationHashMap.keySet();
String[][] sReturnList = new String[aSet.size()][]; int n= 0; for ( Iterator<String> i = aSet.iterator(); i.hasNext(); ){
String[] sSingleApplication = new String[2];
sSingleApplication[0] = i.next(); // assign the title in the second index
sSingleApplication[1] = aApplicationHashMap.get(sSingleApplication[0]);
sReturnList[n++] = sSingleApplication;
} return sReturnList;
}
publicvoid disposeHiddenDocuments(){ int nHiddenCount = aHiddenDocuments.size(); if (nHiddenCount > 0){ for (int i = nHiddenCount - 1; i >= 0; i--){
XComponent xComponent = aHiddenDocuments.get(i); if (xComponent != null){ try {
XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xComponent);
xCloseable.close(true);
aHiddenDocuments.remove(i);
} catch (CloseVetoException ex) {
ex.printStackTrace();
}
}
}
}
}
// Implement the interface XServiceInfo /** Get all supported service names. *@returnSupportedservicenames.
*/ public String[] getSupportedServiceNames() { return getServiceNames();
}
// Implement the interface XServiceInfo /** Test, if the given service will be supported. *@returnReturntrue,iftheservicewillbesupported.
*/ publicboolean supportsService( String sServiceName ) { return sServiceName.equals( __serviceName );
}
// Implement the interface XServiceInfo /** Get the implementation name of the component. *@returnImplementationnameofthecomponent.
*/ public String getImplementationName() { return _Inspector.class.getName();
}
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.