本文整理了Java中com.sun.star.lang.XMultiServiceFactory
类的一些代码示例,展示了XMultiServiceFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMultiServiceFactory
类的具体详情如下:
包路径:com.sun.star.lang.XMultiServiceFactory
类名称:XMultiServiceFactory
暂无
代码示例来源:origin: org.openoffice/jurt
public void setInstance(String serviceName) throws com.sun.star.uno.Exception {
_instance = _serviceManager.createInstance(serviceName);
_serviceName = serviceName;
}
代码示例来源:origin: org.cogroo.lang.pt_br/cogroo-addon-pt_br
public Object getRootNode(String configPath, boolean readonly) {
try {
if (readonly) {
com.sun.star.beans.PropertyValue path = new com.sun.star.beans.PropertyValue();
path.Name = "nodepath";
path.Value = configPath;
Object[] args = new Object[1];
args[0] = path;
return this.configProvider.createInstanceWithArguments(
CONFIGURATION_READ_ONLY_VIEW, args);
} else {
com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue();
aPathArgument.Name = "nodepath";
aPathArgument.Value = configPath;
com.sun.star.beans.PropertyValue aModeArgument = new com.sun.star.beans.PropertyValue();
aModeArgument.Name = "EnableAsync";
aModeArgument.Value = new Boolean(true);
Object[] args = new Object[2];
args[0] = aPathArgument;
args[1] = aModeArgument;
return this.configProvider.createInstanceWithArguments(
CONFIGURATION_UPDATABLE_VIEW, args);
}
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
代码示例来源:origin: org.libreoffice/jurt
public void setInstance(String serviceName) throws com.sun.star.uno.Exception {
_instance = _serviceManager.createInstance(serviceName);
_serviceName = serviceName;
}
代码示例来源:origin: cogroo/cogroo4
public Object getRootNode(String configPath, boolean readonly) {
try {
if (readonly) {
com.sun.star.beans.PropertyValue path = new com.sun.star.beans.PropertyValue();
path.Name = "nodepath";
path.Value = configPath;
Object[] args = new Object[1];
args[0] = path;
return this.configProvider.createInstanceWithArguments(
CONFIGURATION_READ_ONLY_VIEW, args);
} else {
com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue();
aPathArgument.Name = "nodepath";
aPathArgument.Value = configPath;
com.sun.star.beans.PropertyValue aModeArgument = new com.sun.star.beans.PropertyValue();
aModeArgument.Name = "EnableAsync";
aModeArgument.Value = new Boolean(true);
Object[] args = new Object[2];
args[0] = aPathArgument;
args[1] = aModeArgument;
return this.configProvider.createInstanceWithArguments(
CONFIGURATION_UPDATABLE_VIEW, args);
}
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
代码示例来源:origin: stackoverflow.com
XNameContainer.class, xMSF.createInstance(
"com.sun.star.drawing.BitmapTable"));
xImage = (XTextContent) UnoRuntime.queryInterface(
XTextContent.class, xMSF.createInstance(
"com.sun.star.text.TextGraphicObject"));
XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(
代码示例来源:origin: org.cogroo.lang.pt_br/cogroo-addon-pt_br
private synchronized static void init() {
if (m_xDemoOptions == null) {
XMultiServiceFactory xConfig;
try {
xConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
m_xContext.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider",
m_xContext));
Object[] args = new Object[1];
args[0] = new PropertyValue("nodepath", 0, "/org.cogroo.addon.CogrooConfiguration/Options",
PropertyState.DIRECT_VALUE);
m_xDemoOptions = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
xConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess",
args));
} catch (Exception ex) {
Logger.getLogger(Resources.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
代码示例来源:origin: org.cogroo.lang.pt_br/cogroo-addon-pt_br
protected void init(XMultiServiceFactory factory) {
try {
this.configProvider = (XMultiServiceFactory) UnoRuntime
.queryInterface(XMultiServiceFactory.class, factory
.createInstance(CONFIGURATION_SERVICE));
} catch (Throwable e) {
e.printStackTrace();
}
}
代码示例来源:origin: cogroo/cogroo4
private synchronized static void init() {
if (m_xDemoOptions == null) {
XMultiServiceFactory xConfig;
try {
xConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
m_xContext.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider",
m_xContext));
Object[] args = new Object[1];
args[0] = new PropertyValue("nodepath", 0, "/org.cogroo.addon.CogrooConfiguration/Options",
PropertyState.DIRECT_VALUE);
m_xDemoOptions = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
xConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess",
args));
} catch (Exception ex) {
Logger.getLogger(Resources.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
代码示例来源:origin: cogroo/cogroo4
protected void init(XMultiServiceFactory factory) {
try {
this.configProvider = (XMultiServiceFactory) UnoRuntime
.queryInterface(XMultiServiceFactory.class, factory
.createInstance(CONFIGURATION_SERVICE));
} catch (Throwable e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.cogroo.lang.pt_br/cogroo-addon-pt_br
/**
* @param _sKeyName
* @return
*/
public XNameAccess getRegistryKeyContent(String _sKeyName){
try {
Object oConfigProvider;
PropertyValue[] aNodePath = new PropertyValue[1];
oConfigProvider = m_xMCF.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", this.m_xContext);
aNodePath[0] = new PropertyValue();
aNodePath[0].Name = "nodepath";
aNodePath[0].Value = _sKeyName;
XMultiServiceFactory xMSFConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
Object oNode = xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath);
XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode);
return xNameAccess;
} catch (Exception exception) {
exception.printStackTrace(System.out);
return null;
}
}
代码示例来源:origin: stackoverflow.com
Object bitmapTable = factory.createInstance("com.sun.star.drawing.BitmapTable");
XNameContainer bitmapContainer = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, bitmapTable);
代码示例来源:origin: cogroo/cogroo4
/**
* @param _sKeyName
* @return
*/
public XNameAccess getRegistryKeyContent(String _sKeyName){
try {
Object oConfigProvider;
PropertyValue[] aNodePath = new PropertyValue[1];
oConfigProvider = m_xMCF.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", this.m_xContext);
aNodePath[0] = new PropertyValue();
aNodePath[0].Name = "nodepath";
aNodePath[0].Value = _sKeyName;
XMultiServiceFactory xMSFConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
Object oNode = xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath);
XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode);
return xNameAccess;
} catch (Exception exception) {
exception.printStackTrace(System.out);
return null;
}
}
代码示例来源:origin: stackoverflow.com
(XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, xComponent);
Object drawShape = xDrawFactory.createInstance(
"com.sun.star.drawing.RectangleShape");
XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
代码示例来源:origin: stackoverflow.com
XInterface xElement = (XInterface) xConfigProvider.createInstanceWithArguments(sReadOnlyView, aArguments);
XNameAccess xChildAccess = UnoRuntime.queryInterface(XNameAccess.class, xElement);
代码示例来源:origin: stackoverflow.com
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
}
代码示例来源:origin: com.artofsolving/jodconverter
XInterface xElement = (XInterface) xConfigProvider.createInstanceWithArguments(sReadOnlyView, aArguments);
XNameAccess xChildAccess =
(XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xElement);
代码示例来源:origin: org.libreoffice/officebean
/** Returns the XDesktop interface of the OOo instance used by this OOoBean.
@throws NoConnectionException
if no connection is established and no default connection can be established.
*/
public synchronized com.sun.star.frame.XDesktop getOOoDesktop()
throws NoConnectionException
{
if ( xDesktop == null )
{
try
{
Object aObject = getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop");
xDesktop = UnoRuntime.queryInterface(
com.sun.star.frame.XDesktop.class, aObject );
}
catch ( com.sun.star.uno.Exception aExc )
{} // TBD: what if no connection exists?
}
return xDesktop;
}
代码示例来源:origin: org.cogroo.lang.pt_br/cogroo-addon-pt_br
args[1] = aModeArgument;
Object xViewRoot = this.configProvider.createInstanceWithArguments(
CONFIGURATION_UPDATABLE_VIEW, args);
代码示例来源:origin: cogroo/cogroo4
public void addImage(String url, String name, int x, int y, int width,
int height, boolean scale) throws Exception {
Object imageModel = multiServiceFactory.createInstance("com.sun.star.awt.UnoControlImageControlModel");
XPropertySet imageProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, imageModel);
imageProperties.setPropertyValue("PositionX", new Integer(x));
imageProperties.setPropertyValue("PositionY", new Integer(y));
imageProperties.setPropertyValue("Width", new Integer(width));
imageProperties.setPropertyValue("Height", new Integer(height));
imageProperties.setPropertyValue("Name", name);
imageProperties.setPropertyValue("ScaleImage", new Boolean(scale));
imageProperties.setPropertyValue("ImageURL", new String(url));
this.nameContainer.insertByName(name, imageModel);
}
代码示例来源:origin: org.cogroo.lang.pt_br/cogroo-addon-pt_br
public void addImage(String url, String name, int x, int y, int width,
int height, boolean scale) throws Exception {
Object imageModel = multiServiceFactory.createInstance("com.sun.star.awt.UnoControlImageControlModel");
XPropertySet imageProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, imageModel);
imageProperties.setPropertyValue("PositionX", new Integer(x));
imageProperties.setPropertyValue("PositionY", new Integer(y));
imageProperties.setPropertyValue("Width", new Integer(width));
imageProperties.setPropertyValue("Height", new Integer(height));
imageProperties.setPropertyValue("Name", name);
imageProperties.setPropertyValue("ScaleImage", new Boolean(scale));
imageProperties.setPropertyValue("ImageURL", new String(url));
this.nameContainer.insertByName(name, imageModel);
}
内容来源于网络,如有侵权,请联系作者删除!