public MessageBox(XComponentContext _xContext) { this.m_xMCF = _xContext.getServiceManager(); this.m_xContext = _xContext; }
public MessageBox(XComponentContext _xContext) { this.m_xMCF = _xContext.getServiceManager(); this.m_xContext = _xContext; }
public SmoketestCommandEnvironment(XComponentContext xCompContext) { try { m_cmpCtx = xCompContext; m_xMCF = m_cmpCtx.getServiceManager(); } catch( Exception e ) { e.printStackTrace(); } }
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
private final XMultiServiceFactory getSMgr( XComponentContext xContext ) { if (xContext != null) { return UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); } else { return _xMultiServiceFactory; } }
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);
/** * 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() ); }
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); }
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); }
public DefaultConfiguration(XComponentContext context) { // this.context = context; XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime .queryInterface(XMultiServiceFactory.class, context .getServiceManager()); this.init(factory); }
public DefaultConfiguration(XComponentContext context) { // this.context = context; XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime .queryInterface(XMultiServiceFactory.class, context .getServiceManager()); this.init(factory); }
/** * Bootstraps a servicemanager with the jurt base components registered. * * See also UNOIDL <code>com.sun.star.lang.ServiceManager</code>. * * @throws Exception if things go awry. * @return a freshly boostrapped service manager */ public static XMultiServiceFactory createSimpleServiceManager() throws Exception { return UnoRuntime.queryInterface( XMultiServiceFactory.class, createInitialComponentContext( (Map<String, Object>) null ).getServiceManager() ); }
public static void createAnnotation( XComponentContext xContext, XTextRange xTextRange ) { // per-document stuff XMultiComponentFactory xServiceManager= xContext.getServiceManager(); Object desktop= xServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xContext); XComponent xComponent= xDesktop.getCurrentComponent(); XTextDocument xTextDocument= UnoRunime.queryInterface(XTextDocument.class, xComponent); XText xText= xTextDocument.getText(); XMultiServiceFactory xWriterFactory= UnoRuntime.queryInterface(XMultiServiceFactory.class, xComponent); // per-annotation stuff Object annotation= xWriterFactory.createInstance("com.sun.star.text.textfield.nnotation"); XPropertySet annotProps= UnoRuntime.queryInterface(XPropertySet.class, annotation); annotProps.setValue("Content", "It's a me!") annotProps.setValue("Author", "Mario"); XTextField annotTextField= UnoRuntime.queryInterface(XTextfield.class, annotation); xText.insertTextContent( xTextRange, annotTextField, true ); // "true" spans the range }
XComponentContext xLocalContext = Bootstrap.bootstrap(); XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); Object desktop = xLocalServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xLocalContext); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop); PropertyValue[] mypv = new PropertyValue[3]; mypv[0] = new PropertyValue(); mypv[0].Name = new String("FilterName"); mypv[0].Value = new String("Text - txt - csv (StarCalc)"); mypv[1] = new PropertyValue(); mypv[1].Name = "Hidden"; mypv[1].Value = new Boolean(false); mypv[1] = new PropertyValue(); mypv[1].Name = "CharacterSet"; mypv[1].Value = "UTF-8"; mypv[2] = new PropertyValue(); mypv[2].Name = "FilterOptions"; mypv[2].Value = "59,34,0,1,1/1/2/1/3/5"; String internalFile = ExternalUriReferenceTranslator.create(xLocalContext).translateToInternal("file://" + csvFile.getAbsolutePath()); XComponent comp = xComponentLoader.loadComponentFromURL(internalFile, "_parent", 0, mypv);
/** * Returns an AWT toolkit. */ private XToolkit queryAWTToolkit() throws com.sun.star.uno.Exception { // Create a UNO toolkit. XComponentContext xContext = mConnection.getComponentContext(); XMultiComponentFactory compfactory = xContext.getServiceManager(); XMultiServiceFactory factory = UnoRuntime.queryInterface( XMultiServiceFactory.class, compfactory); Object object = factory.createInstance( "com.sun.star.awt.Toolkit"); return UnoRuntime.queryInterface(XToolkit.class, object); }
protected void insertImage(XComponent document, OfficeResourceProvider officeResourceProvider, XText destination, XTextRange textRange, Image image) throws Exception { XMultiServiceFactory xFactory = as(XMultiServiceFactory.class, document); XComponentContext xComponentContext = officeResourceProvider.getXComponentContext(); XMultiComponentFactory serviceManager = xComponentContext.getServiceManager(); Object oImage = xFactory.createInstance(TEXT_GRAPHIC_OBJECT); Object oGraphicProvider = serviceManager.createInstanceWithContext(GRAPHIC_PROVIDER_OBJECT, xComponentContext); XGraphicProvider xGraphicProvider = as(XGraphicProvider.class, oGraphicProvider); XPropertySet imageProperties = buildImageProperties(xGraphicProvider, oImage, image.imageContent); XTextContent xTextContent = as(XTextContent.class, oImage); destination.insertTextContent(textRange, xTextContent, true); setImageSize(image.width, image.height, oImage, imageProperties); }
protected void insertImage(XComponent document, OfficeResourceProvider officeResourceProvider, XText destination, XTextRange textRange, Image image) throws Exception { XMultiServiceFactory xFactory = as(XMultiServiceFactory.class, document); XComponentContext xComponentContext = officeResourceProvider.getXComponentContext(); XMultiComponentFactory serviceManager = xComponentContext.getServiceManager(); Object oImage = xFactory.createInstance(TEXT_GRAPHIC_OBJECT); Object oGraphicProvider = serviceManager.createInstanceWithContext(GRAPHIC_PROVIDER_OBJECT, xComponentContext); XGraphicProvider xGraphicProvider = as(XGraphicProvider.class, oGraphicProvider); XPropertySet imageProperties = buildImageProperties(xGraphicProvider, oImage, image.imageContent); XTextContent xTextContent = as(XTextContent.class, oImage); destination.insertTextContent(textRange, xTextContent, true); setImageSize(image.width, image.height, oImage, imageProperties); }