public void initialize(Object[] arg0) throws Exception { if (arg0.length > 0) { this.frame = (XFrame) UnoRuntime.queryInterface(XFrame.class, arg0[0]); } }
Controller( com.sun.star.frame.XController xController ) { super( xController ); this.xController = xController; xDispatchProvider = UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class, xController ); }
public void initialize( Object[] object ) throws com.sun.star.uno.Exception { if ( object.length > 0 ) { m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface( com.sun.star.frame.XFrame.class, object[0]); } }
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
public String getTextContent(String componentName) throws NoSuchElementException, WrappedTargetException { XControlContainer controlContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, this.oUnoDialog); XTextComponent textComp = (XTextComponent) UnoRuntime.queryInterface( XTextComponent.class, controlContainer.getControl(componentName)); return textComp.getText(); }
private static void save() { //Committing the changes will cause or changes to be written to the registry. try { XChangesBatch xUpdateCommit = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, m_xDemoOptions); xUpdateCommit.commitChanges(); } catch (WrappedTargetException ex) { Logger.getLogger(Resources.class.getName()).log(Level.SEVERE, null, ex); } }
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
public void dispose(Object obj) { ((XComponent) UnoRuntime.queryInterface(XComponent.class, obj)) .dispose(); } }
protected void refreshDocument(XComponent document) { XRefreshable refreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, document); if (refreshable != null) { refreshable.refresh(); } }
public static void dispose(XDialog dialog) { XComponent xComponent = (XComponent) UnoRuntime.queryInterface( XComponent.class, dialog); xComponent.dispose(); }
public short executeDialog() throws com.sun.star.script.BasicErrorException { if (m_xWindowPeer == null) { createWindowPeer(); } xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); m_xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_xDialogControl); return xDialog.execute(); }
private static XTypeDescription resolveTypedefs(XTypeDescription type) { while (type.getTypeClass() == TypeClass.TYPEDEF) { type = UnoRuntime.queryInterface( XIndirectTypeDescription.class, type).getReferencedType(); } return type; }
@Override public void run() { com.sun.star.lang.XMultiComponentFactory aFactory = iConn.getComponentContext().getServiceManager(); xServiceFactory = UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, aFactory ); } };
/** * Bootstraps a servicemanager with the jurt base components registered. * <p> * @return a freshly boostrapped service manager * @see com.sun.star.lang.ServiceManager */ static public XMultiServiceFactory createSimpleServiceManager() throws Exception { return UnoRuntime.queryInterface( XMultiServiceFactory.class, createInitialComponentContext( null ).getServiceManager() ); }
private static XTypeDescription resolveTypedefs(XTypeDescription type) { while (type.getTypeClass() == TypeClass.TYPEDEF) { type = UnoRuntime.queryInterface( XIndirectTypeDescription.class, type).getReferencedType(); } return type; }
public void initialize(String[] PropertyNames, Object[] PropertyValues) throws com.sun.star.script.BasicErrorException{ try{ XMultiPropertySet xMultiPropertySet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, m_xDlgModelNameContainer); xMultiPropertySet.setPropertyValues(PropertyNames, PropertyValues); } catch (com.sun.star.uno.Exception ex) { ex.printStackTrace(System.out); }}
protected void setModelProperties(Object model, String[] pNames, Object[] pValues) { XPropertySet xCFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, model); for(int i = 0; i < pNames.length; i++) { try { xCFModelPSet.setPropertyValue(pNames[i], pValues[i]); } catch (com.sun.star.uno.Exception ex) { ex.printStackTrace(System.out); } } }
public DefaultConfiguration(XComponentContext context) { // this.context = context; XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime .queryInterface(XMultiServiceFactory.class, context .getServiceManager()); this.init(factory); }
public Object insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) throws com.sun.star.script.BasicErrorException{ try { Object oControlModel = m_xMSFDialogModel.createInstance(ServiceName); XMultiPropertySet xControlMultiPropertySet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oControlModel); xControlMultiPropertySet.setPropertyValues(sProperties, sValues); m_xDlgModelNameContainer.insertByName(sName, oControlModel); return oControlModel; } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); return null; } }
@Test public void office_load() throws OfficeException { Office office = runtime.get(); File file = fileOf("/pdf-contra.doc"); Model model = office.load(file); XTextDocument document = model.getInterface(XTextDocument.class); XText text = document.getText(); XTextRange range = UnoRuntime.queryInterface(XTextRange.class, text); assertThat(range.getString(), containsString("This is just a test.")); }