Пример #1
0
  @Override
  public void handle(Object aFormComponent) throws com.sun.star.uno.Exception {
    // check if it's a button
    XPropertySet xProps = UNO.queryPropertySet(aFormComponent);
    XPropertySetInfo xPI = null;
    if (null != xProps) xPI = xProps.getPropertySetInfo();
    if ((null != xPI) && xPI.hasPropertyByName("ClassId")) {
      Short nClassId = (Short) xProps.getPropertyValue("ClassId");
      if (FormComponentType.COMMANDBUTTON == nClassId.shortValue()) {
        // yes, it is
        m_aOperator.revokeButton(xProps);
      }
    }

    // let the super class step down the tree (if possible)
    super.handle(aFormComponent);
  }
Пример #2
0
  /**
   * creates the button used for demonstrating (amongst others) event handling
   *
   * @param nXPos x-position of the to be inserted shape
   * @param nYPos y-position of the to be inserted shape
   * @param nXSize width of the to be inserted shape
   * @param sName the name of the model in the form component hierarchy
   * @param sLabel the label of the button control
   * @param sActionURL the URL of the action which should be triggered by the button
   * @return the model of the newly created button
   */
  protected XPropertySet createButton(
      int nXPos, int nYPos, int nXSize, String sName, String sLabel, short _formFeature)
      throws java.lang.Exception {
    XPropertySet xButton =
        m_formLayer.createControlAndShape("CommandButton", nXPos, nYPos, nXSize, 6);
    // the name for referring to it later:
    xButton.setPropertyValue("Name", sName);
    // the label
    xButton.setPropertyValue("Label", sLabel);
    // use the name as help text
    xButton.setPropertyValue("HelpText", sName);
    // don't want buttons to be accessible by the "tab" key - this would be uncomfortable when
    // traveling
    // with records with "tab"
    xButton.setPropertyValue("Tabstop", Boolean.FALSE);
    // similar, they should not steal the focus when clicked
    xButton.setPropertyValue("FocusOnClick", Boolean.FALSE);

    m_aOperator.addButton(xButton, _formFeature);

    return xButton;
  }
Пример #3
0
 /* ------------------------------------------------------------------ */
 @Override
 protected void onFormsAlive() {
   m_aOperator.onFormsAlive();
 }