com.sun.star.beans.UnknownPropertyException Java Examples

The following examples show how to use com.sun.star.beans.UnknownPropertyException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Annotation.java    From noa-libre with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: Annotation.java    From noa-libre with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: JodConverterMetadataExtracterWorker.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example #4
Source File: DialogHelper.java    From libreoffice-starter-extension with MIT License 5 votes vote down vote up
public static void EnableButton(XDialog dialog, String componentId, boolean enable) {
	XControlContainer xDlgContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class,
			dialog);
	// retrieve the control that we want to disable or enable
	XControl xControl = UnoRuntime.queryInterface(XControl.class, xDlgContainer.getControl(componentId));
	XPropertySet xModelPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel());
	try {
		xModelPropertySet.setPropertyValue("Enabled", Boolean.valueOf(enable));
	} catch (IllegalArgumentException | UnknownPropertyException | PropertyVetoException
			| WrappedTargetException e) {
		return;
	}
}
 
Example #5
Source File: DialogHelper.java    From libreoffice-starter-extension with MIT License 5 votes vote down vote up
public static void setPosition(XDialog dialog, int posX, int posY) {
	XControlModel xDialogModel = UnoRuntime.queryInterface(XControl.class, dialog).getModel();
	XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
	try {
		xPropSet.setPropertyValue("PositionX", posX);
		xPropSet.setPropertyValue("PositionY", posY);
	} catch (com.sun.star.lang.IllegalArgumentException | UnknownPropertyException | PropertyVetoException
			| WrappedTargetException e) {
		return;
	}
}
 
Example #6
Source File: DialogHelper.java    From libreoffice-starter-extension with MIT License 5 votes vote down vote up
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);
}