当前位置: 首页>>代码示例>>Java>>正文


Java XPropertySet.getPropertyValue方法代码示例

本文整理汇总了Java中com.sun.star.beans.XPropertySet.getPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:Java XPropertySet.getPropertyValue方法的具体用法?Java XPropertySet.getPropertyValue怎么用?Java XPropertySet.getPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.star.beans.XPropertySet的用法示例。


在下文中一共展示了XPropertySet.getPropertyValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getText

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns the text content of the annotation, or null if text content is not available.
 * 
 * @return the text content of the annotation, or null
 * 
 * @author Markus Krüger
 * @date 13.07.2006
 */
public String getText() {
  XServiceInfo info = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, getXTextContent());
  if(info.supportsService(ITextFieldService.ANNOTATION_TEXTFIELD_ID)) {
    XPropertySet properties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getXTextContent());
    try {
      return (String) properties.getPropertyValue("Content");
    }
    catch(UnknownPropertyException unknownPropertyException) {
      //TODO exception handling if needed, do nothing for now
    }
    catch(WrappedTargetException wrappedTargetException) {
      //TODO exception handling if needed, do nothing for now
    }
  }
  return null;
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:25,代码来源:Annotation.java

示例2: openConnection

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Opens connection to OpenOffice.org.
 * 
 * @return information whether the connection is available
 * 
 * @throws Exception if any error occurs
 */
public boolean openConnection() throws Exception {
  String unoUrl = "uno:socket,host=" + host + ",port=" + port +";urp;StarOffice.ServiceManager";
  XComponentContext xLocalContext = Bootstrap.createInitialComponentContext(null);
  Object connector = xLocalContext.getServiceManager().createInstanceWithContext("com.sun.star.connection.Connector", xLocalContext);
  XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, connector);
  
  String url[] = parseUnoUrl(unoUrl);
  if (null == url) {
    throw new com.sun.star.uno.Exception("Couldn't parse UNO URL "+ unoUrl);
  }
  
  XConnection connection = xConnector.connect(url[0]);
  Object bridgeFactory = xLocalContext.getServiceManager().createInstanceWithContext("com.sun.star.bridge.BridgeFactory", xLocalContext);
  XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, bridgeFactory);
  xBridge = xBridgeFactory.createBridge("", url[1], connection ,null);
  bridgeFactory = xBridge.getInstance(url[2]);
  xMultiComponentFactory = (XMultiComponentFactory)UnoRuntime.queryInterface(XMultiComponentFactory.class, bridgeFactory);
  XPropertySet xProperySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xMultiComponentFactory);
  Object remoteContext = xProperySet.getPropertyValue("DefaultContext");
  xRemoteContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, remoteContext);
  xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xMultiComponentFactory);
  isConnectionEstablished = true;
  return true;      
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:32,代码来源:RemoteOfficeConnection.java

示例3: getTextFields

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns all available text fields.
 * 
 * @return all available text fields
 * 
 * @author Andreas Bröker
 */
public ITextField[] getTextFields() {
  ArrayList arrayList = new ArrayList();    
  XTextCursor textCursor = xTextRange.getText().createTextCursorByRange(xTextRange.getStart());
  XTextRangeCompare xTextRangeCompare = (XTextRangeCompare)UnoRuntime.queryInterface(XTextRangeCompare.class, xTextRange.getText());
  try {      
    while(xTextRangeCompare.compareRegionEnds(textCursor.getStart(), xTextRange.getEnd()) != -1) {
      XPropertySet propertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, textCursor);
      Any any = (Any)propertySet.getPropertyValue("TextField");
      XTextField xTextField = (XTextField)any.getObject();  
      if(xTextField != null)
        arrayList.add(new TextField(textDocument, xTextField));
      if(!textCursor.goRight((short)1, false)) 
        break;
    }
  }
  catch(Exception exception) {
    //do nothing
  }
  
  ITextField[] textFields = new ITextField[arrayList.size()];
  return (ITextField[])arrayList.toArray(textFields);    
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:30,代码来源:TextContentEnumeration.java

示例4: getTextTable

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns text table of the cell.
 * 
 * @return text table of the cell
 * 
 * @throws TextException if the text table is not available
 * 
 * @author Andreas Bröker
 * @author Markus Krüger
 */
public ITextTable getTextTable() throws TextException {
  if(textTable == null) {
    try {
      XText xText = (XText)UnoRuntime.queryInterface(XText.class, xCell);
      XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xText.getStart());
      Any any = (Any)xPropertySet.getPropertyValue("TextTable");
      XTextTable xTextTable = (XTextTable)any.getObject();
      textTable =  new TextTable(textDocument, xTextTable);
    }
    catch(Exception exception) {
      TextException textException = new TextException(exception.getMessage());
      textException.initCause(exception);
      throw textException;
    }
  }
  return textTable;
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:28,代码来源:TextTableCell.java

示例5: getHeight

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns the row height.
 * 
 * @return the row height
 * 
 * @author Markus Krüger
 */
public int getHeight() {
  if(textTableCellRange == null)
    return 0;
  try {
    
    XTextTable xTextTable = (XTextTable)textTableCellRange.getCell(0,0).getTextTable().getXTextContent();
    XTableRows tableRows = xTextTable.getRows();
    Object row = tableRows.getByIndex(textTableCellRange.getRangeName().getRangeStartRowIndex());
    XPropertySet propertySetRow = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, row);
    Integer rowHeight = (Integer)propertySetRow.getPropertyValue("Height");
    return rowHeight.intValue();
  }
  catch (Exception exception) {
    return 0;
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:24,代码来源:TextTableRow.java

示例6: getAutoHeight

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns if the row height is set to automatically be adjusted or not.
 * 
 * @return if the row height is set to automatically be adjusted or not
 * 
 * @author Markus Krüger
 */
public boolean getAutoHeight() {
  if(textTableCellRange == null)
    return false;
  try {      
    XTextTable xTextTable = (XTextTable)textTableCellRange.getCell(0,0).getTextTable().getXTextContent();
    XTableRows tableRows = xTextTable.getRows();
    int rowIndex = textTableCellRange.getRangeName().getRangeStartRowIndex();
    Object row = tableRows.getByIndex(rowIndex);
    XPropertySet propertySetRow = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, row);
    Boolean rowAutoHeight = (Boolean)propertySetRow.getPropertyValue("IsAutoHeight");      
    return rowAutoHeight.booleanValue();
  }
  catch (Exception exception) {
    return false;
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:24,代码来源:TextTableRow.java

示例7: getNumberFormat

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns number format on the basis of the submitted key.
 * 
 * @param key key of the number format
 * 
 * @return number format on the basis of the submitted key
 * 
 * @throws UtilException if the number format is not available
 * 
 * @author Andreas Bröker
 * @author Markus Krüger
 */
public INumberFormat getNumberFormat(int key) throws UtilException {
  INumberFormat[] allFormats = getNumberFormats();
  for(int i = 0; i < allFormats.length; i++) {
    if(key == allFormats[i].getFormatKey())
      return allFormats[i];
  }
  try {
    XNumberFormats xNumberFormats = xNumberFormatsSupplier.getNumberFormats();
    XPropertySet docProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, textDocument.getXTextDocument());
    Locale docLocale = (Locale) docProps.getPropertyValue("CharLocale");
    XNumberFormatTypes numberFormatTypes = (XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
    int newKey = numberFormatTypes.getFormatForLocale(key,docLocale);
    for(int i = 0; i < allFormats.length; i++) {
      if(newKey == allFormats[i].getFormatKey())
        return allFormats[i];
    }
  }
  catch(Exception exception) {
    UtilException utilException = new UtilException(exception.getMessage());
    utilException.initCause(exception);
    throw utilException;
  }
  throw new UtilException("The number format is not available.");
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:37,代码来源:NumberFormatService.java

示例8: applyNumberFormat

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Applies the given number format to the given variable text field.
 * 
 * @param numberFormat the number format to be set
 * @param variableTextField the variable text field to set number forma for
 * @param isFormula if the variable text field is a formula
 * @param numberFormatService the number format service to be used
 * 
 * @throws NOAException if setting the number format fails
 * 
 * @author Markus Krüger
 * @date 27.07.2007
 */
public static void applyNumberFormat(INumberFormat numberFormat, ITextField variableTextField,
    boolean isFormula, INumberFormatService numberFormatService) throws NOAException {
  try {
    if(numberFormat == null || variableTextField == null || numberFormatService == null)
      return;
    XPropertySet xPropertySetField = 
      (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, variableTextField.getXTextContent());
    String content = (String)xPropertySetField.getPropertyValue("Content");      
    xPropertySetField.setPropertyValue("NumberFormat", new Integer(numberFormat.getFormatKey()));
    setContent(content,variableTextField,isFormula,numberFormatService);
  }
  catch(Throwable throwable) {
    throw new NOAException(throwable);
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:29,代码来源:VariableTextFieldHelper.java

示例9: getPropertyValueIfAvailable

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * OOo throws exceptions if we ask for properties that aren't there, so we'll tread carefully.
 * 
 * @param propSet
 * @param propertyName property name as used by the OOo API.
 * @return the propertyValue if it's there, else null.
 * @throws UnknownPropertyException
 * @throws WrappedTargetException
 */
private Object getPropertyValueIfAvailable(XPropertySet propSet, String propertyName)
        throws UnknownPropertyException, WrappedTargetException
{
    if (propSet.getPropertySetInfo().hasPropertyByName(propertyName))
    {
        return propSet.getPropertyValue(propertyName);
    }
    else
    {
        return null;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:JodConverterMetadataExtracterWorker.java

示例10: getFilterNames

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
public static List getFilterNames(XMultiComponentFactory xmulticomponentfactory) throws Exception {
    XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);
    Object oDefaultContext = xPropertySet.getPropertyValue("DefaultContext");
    XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, oDefaultContext);


    Object filterFactory = xmulticomponentfactory.createInstanceWithContext("com.sun.star.document.FilterFactory", xComponentContext);
    XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, filterFactory);
    String [] filterNames = xNameAccess.getElementNames();

    //String [] serviceNames = filterFactory.getAvailableServiceNames();
    for (int i=0; i < filterNames.length; i++) {
        String s = filterNames[i];
        Debug.logInfo(s, module);
        /*
        if (s.toLowerCase().indexOf("filter") >= 0) {
            Debug.logInfo("FILTER: " + s, module);
        }
        if (s.toLowerCase().indexOf("desktop") >= 0) {
            Debug.logInfo("DESKTOP: " + s, module);
        }
        */
    }

    List filterNameList = UtilMisc.toListArray(filterNames);
    return filterNameList;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:OpenOfficeWorker.java

示例11: getPosition

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
public static Point getPosition(XDialog dialog) {
	int posX = 0;
	int posY = 0;
	XControlModel xDialogModel = UnoRuntime.queryInterface(XControl.class, dialog).getModel();
	XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
	try {
		posX = (int) xPropSet.getPropertyValue("PositionX");
		posY = (int) xPropSet.getPropertyValue("PositionY");
	} catch (UnknownPropertyException | WrappedTargetException e) {
	}
	return new Point(posX, posY);
}
 
开发者ID:smehrbrodt,项目名称:libreoffice-starter-extension,代码行数:13,代码来源:DialogHelper.java

示例12: buildScripts

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Builds scripts from the submitted browse node.
 * 
 * @param list list to be used for the new builded scripts (can be null - 
 * a new list will be builded)
 * @param browseNode browse node to be used
 * 
 * @return builded scripts of the submitted browse node
 * 
 * @author Andreas Bröker
 * @date 13.06.2006
 */
private List buildScripts(List list, XBrowseNode browseNode) {
	XBrowseNode[] scriptNodes = browseNode.getChildNodes();
	if(list == null)
		list = new ArrayList();
	for(int i=0, n=scriptNodes.length; i<n; i++) {
		XBrowseNode scriptNode = scriptNodes[i];	
		if(scriptNode.getType() == BrowseNodeTypes.SCRIPT) {
			XPropertySet propertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, scriptNode);
			if(propertySet != null) {
				try {
					Object object = propertySet.getPropertyValue("URI");
					String uri = object.toString();
					XScript xScript = scriptProvider.getScript(uri);
					list.add(new Script(uri,xScript));
				}
				catch(Throwable throwable) {
					//do not consume
				}
			}
		}
		else {
			//maybe a basic module
			buildScripts(list, scriptNode);
		}
	}
	return list;
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:40,代码来源:ScriptProvider.java

示例13: markTable

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Marks the table.
 * 
 * @author Markus Krüger
 * @date 06.08.2007
 */
public void markTable() {
  try {
    String firstCell = "A1";
    String range = firstCell + ":";
    ITextTableRow[] rows = getRows();
    if (rows.length > 0) {
      ITextTableCell[] cells = rows[rows.length - 1].getCells();
      String lastCellName = cells[cells.length - 1].getName().getName();
      range = range + TextTableCellNameHelper.getColumnCharacter(lastCellName)
          + TextTableCellNameHelper.getRowCounterValue(lastCellName);
      ITextTableCellRange cellRange = getCellRange(range);
      ITextDocument textDocument = getTextDocument();
      if (textDocument.isOpen()) {
        XCell cell = getXTextTable().getCellByName(firstCell);
        XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
            cell);
        if (xPropertySet != null) {
          Object value = xPropertySet.getPropertyValue("TextSection");
          boolean select = true;
          XTextSection xTextSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class,
              value);
          if (xTextSection != null) {
            XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
                xTextSection);
            if (xTextSectionPropertySet != null) {
              Boolean visible = (Boolean) xTextSectionPropertySet.getPropertyValue("IsVisible");
              select = visible.booleanValue();
            }
          }
          if (select)
            textDocument.setSelection(new XInterfaceObjectSelection(cellRange.getXCellRange()));
        }
      }
    }
  }
  catch (Throwable throwable) {
    //no marking possible
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:46,代码来源:TextTable.java

示例14: getLayoutManager

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns layout manager of the frame. Returns null if a layout manager
 * is not available.
 * 
 * @return layout manager of the frame or null if a layout manager
 * is not available
 * 
 * @throws NOAException if the layout manager can not be requested
 * 
 * @author Andreas Bröker
 * @date 2006/02/05
 */
public ILayoutManager getLayoutManager() throws NOAException {
	try {
		XPropertySet propertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xFrame);
		Object object = propertySet.getPropertyValue("LayoutManager");
		XLayoutManager layoutManager = (XLayoutManager)UnoRuntime.queryInterface(XLayoutManager.class, object);
		if(layoutManager != null)
			return new LayoutManager(layoutManager);
	}
	catch(Throwable throwable) {
		throw new NOAException(throwable);
	}
	return null;
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:26,代码来源:Frame.java

示例15: getNumberFormats

import com.sun.star.beans.XPropertySet; //导入方法依赖的package包/类
/**
 * Returns all available number formats of the given type.
 * 
 * @param type the type to get all number formats for as constants of {@link com.sun.star.util.NumberFormat}
 * 
 * @return all available number formats of the given type
 * 
 * @throws UtilException if the number formats are not available
 * 
 * @author Markus Krüger
 * @date 25.07.2007
 */
public INumberFormat[] getNumberFormats(short type) throws UtilException {
  try {
    XNumberFormats xNumberFormats = xNumberFormatsSupplier.getNumberFormats();
    XPropertySet docProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, textDocument.getXTextDocument());
    Locale docLocale = (Locale) docProps.getPropertyValue("CharLocale");
    //XNumberFormatTypes numberFormatTypes = (XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
    int[] keys = xNumberFormats.queryKeys(type,docLocale,true);
    List<INumberFormat> formats = new ArrayList<INumberFormat>();
    boolean additionalCurrenciesSet = false;
    for(int i = 0; i < keys.length; i++) {
      int key = keys[i];
      XPropertySet xProp = xNumberFormats.getByKey(key);
      if(((Short)xProp.getPropertyValue("Type")).equals(new Short(com.sun.star.util.NumberFormat.CURRENCY)) &&
          !additionalCurrenciesSet) {
        for(int j = 0; j < ADDITIONAL_CURRENCY_KEYS.length; j++) {
          XPropertySet xPropAdd = xNumberFormats.getByKey(ADDITIONAL_CURRENCY_KEYS[j]);
          formats.add(new NumberFormat(ADDITIONAL_CURRENCY_KEYS[j],xPropAdd,this));
        }
        additionalCurrenciesSet = true;
      }
      formats.add(new NumberFormat(key,xProp,this));
    }
    return formats.toArray(new INumberFormat[formats.size()]);
  }
  catch(Exception exception) {
    UtilException utilException = new UtilException(exception.getMessage());
    utilException.initCause(exception);
    throw utilException;
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:43,代码来源:NumberFormatService.java


注:本文中的com.sun.star.beans.XPropertySet.getPropertyValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。