public MessageBox(XComponentContext _xContext) { this.m_xMCF = _xContext.getServiceManager(); this.m_xContext = _xContext; }
/** * * @param url * @return the expanded URL */ protected String expandURL(String url) { try { url = url.substring(20); String str = URLDecoder.decode(url, "utf-8"); Object obj = context.getValueByName("/singletons/com.sun.star.util.theMacroExpander"); XMacroExpander expander = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, obj); String res = expander.expandMacros(str); return res; } catch (Exception e) { e.printStackTrace(); } return ""; }
public MessageBox(XComponentContext _xContext) { this.m_xMCF = _xContext.getServiceManager(); this.m_xContext = _xContext; }
/** * * @param url * @return the expanded URL */ protected String expandURL(String url) { try { url = url.substring(20); String str = URLDecoder.decode(url, "utf-8"); Object obj = context.getValueByName("/singletons/com.sun.star.util.theMacroExpander"); XMacroExpander expander = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, obj); String res = expander.expandMacros(str); return res; } catch (Exception e) { e.printStackTrace(); } return ""; }
public SmoketestCommandEnvironment(XComponentContext xCompContext) { try { m_cmpCtx = xCompContext; m_xMCF = m_cmpCtx.getServiceManager(); } catch( Exception e ) { e.printStackTrace(); } }
XHierarchicalNameAccess xhna = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, context.getValueByName( "/singletons/com.sun.star.reflection." + "theTypeDescriptionManager"));
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
(UnoRuntime.queryInterface( XHierarchicalNameAccess.class, context.getValueByName( "/singletons/com.sun.star.reflection." + "theTypeDescriptionManager")).
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
m_xMacroExpander = (XMacroExpander)AnyConverter.toObject( new Type( XMacroExpander.class ), xContext.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" ) );
XComponentContext context = Bootstrap.bootstrap(); XMultiComponentFactory factory = context.getServiceManager(); Object dispatchHelperObject = factory.createInstanceWithContext( "com.sun.star.frame.DispatchHelper", ooContext); this.dispatchHelper = (XDispatchHelper)UnoRuntime.queryInterface( XDispatchHelper.class, dispatchHelperObject);
m_xMacroExpander = (XMacroExpander)AnyConverter.toObject( new Type( XMacroExpander.class ), xContext.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" ) );
XComponentContext xContext = Bootstrap.bootstrap(); XMultiComponentFactory xMCF = xContext.getServiceManager(); Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext); XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop); XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xDesktop); XComponent xComp = xCompLoader.loadComponentFromURL("file:///C:/test.odt", "_blank", 0, new Boolean(true)); XTextDocument xDoc = UnoRuntime.queryInterface(XTextDocument.class, xComp); XModel xModel =UnoRuntime.queryInterface( XModel.class, xDoc ); XDrawPageSupplier xDPS = UnoRuntime.queryInterface(XDrawPageSupplier.class, xModel); XDrawPage xDrawPage = xDPS.getDrawPage(); XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xDrawPage ); for (int s=0;s<xDrawPage.getCount();s++) { XShape xShape = UnoRuntime.queryInterface( XShape.class, xShapes.getByIndex(s) ); System.out.println(" -- sh.getShapeType: " + xShape.getShapeType()); System.out.println(" -- sh.getPosition: " + xShape.getPosition().X + "x" + xShape.getPosition().Y); System.out.println(" -- sh.getSize: " + xShape.getSize().Width + "x" + xShape.getSize().Height); }
return m_xDelegate.getValueByName( rName );
/** * 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() ); }
return m_xDelegate.getValueByName( rName );
protected XDispatchHelper createXDispatchHelper() throws Exception { Object o = xComponentContext.getServiceManager().createInstanceWithContext( "com.sun.star.frame.DispatchHelper", xComponentContext); return as(XDispatchHelper.class, o); }
@Override public void run() { com.sun.star.lang.XMultiComponentFactory aFactory = iConn.getComponentContext().getServiceManager(); xServiceFactory = UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, aFactory ); } };
protected XDispatchHelper createXDispatchHelper() throws Exception { Object o = xComponentContext.getServiceManager().createInstanceWithContext( "com.sun.star.frame.DispatchHelper", xComponentContext); return as(XDispatchHelper.class, o); }
protected XDesktop createDesktop() throws com.sun.star.uno.Exception { Object o = xComponentContext.getServiceManager().createInstanceWithContext( "com.sun.star.frame.Desktop", xComponentContext); return as(XDesktop.class, o); }