Examples of XDependentTextField


Examples of com.sun.star.text.XDependentTextField

      XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime
          .queryInterface(XMultiServiceFactory.class, textDocument
              .getXTextDocument());
      Object textField = xMultiServiceFactory
          .createInstance(ITextFieldService.USER_TEXTFIELD_ID);
      XDependentTextField xDependentTextField = (XDependentTextField) UnoRuntime
          .queryInterface(XDependentTextField.class, textField);
      xDependentTextField.attachTextFieldMaster(xPropertySet);
      return new TextField(textDocument, xDependentTextField);
    } catch (Throwable throwable) {
      throw new NOAException(throwable);
    }
  }
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

   */
  public ITextField addUserTextField(String name, String content) throws TextException {
    try {
      XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, textDocument.getXTextDocument());
      Object textField = xMultiServiceFactory.createInstance(ITextFieldService.USER_TEXTFIELD_ID);
      XDependentTextField xDependentTextField = (XDependentTextField)UnoRuntime.queryInterface(XDependentTextField.class, textField);
     
      Object oFieldMaster = xMultiServiceFactory.createInstance(ITextFieldService.USER_TEXTFIELD_MASTER_ID);
      XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, oFieldMaster);
 
      xPropertySet.setPropertyValue("Name", name);
      xPropertySet.setPropertyValue("Content", content);
 
      xDependentTextField.attachTextFieldMaster(xPropertySet);
     
      return new TextField(textDocument, xDependentTextField);
    }
    catch(Exception exception) {
      throw new TextException(exception);
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

      XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime
          .queryInterface(XMultiServiceFactory.class, textDocument
              .getXTextDocument());
      Object textField = xMultiServiceFactory
          .createInstance(ITextFieldService.USER_TEXTFIELD_ID);
      XDependentTextField xDependentTextField = (XDependentTextField) UnoRuntime
          .queryInterface(XDependentTextField.class, textField);

      Object oFieldMaster = xMultiServiceFactory
          .createInstance(ITextFieldService.USER_TEXTFIELD_MASTER_ID);
      XPropertySet xPropertySet = (XPropertySet) UnoRuntime
          .queryInterface(XPropertySet.class, oFieldMaster);

      xPropertySet.setPropertyValue("Name", name);
      xPropertySet.setPropertyValue("Content", content);

      xDependentTextField.attachTextFieldMaster(xPropertySet);

      return new TextField(textDocument, xDependentTextField);
    } catch (Exception exception) {
      throw new TextException(exception);
    }
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

            // Insert it at the end of the document
            mxDocText.insertTextContent ( mxDocText.getEnd(), xDateField, false );

            // Use the text document's factory to create a user text field,
            // and access it's XDependentTextField interface
            XDependentTextField xUserField =
                (XDependentTextField) UnoRuntime.queryInterface (
                    XDependentTextField.class, mxDocFactory.createInstance (
                        "com.sun.star.text.TextField.User" ) );

            // Create a fieldmaster for our newly created User Text field, and
            // access it's XPropertySet interface
            XPropertySet xMasterPropSet = (XPropertySet)UnoRuntime.queryInterface(
                XPropertySet.class, mxDocFactory.createInstance (
                    "com.sun.star.text.FieldMaster.User" ) );

            // Set the name and value of the FieldMaster
            xMasterPropSet.setPropertyValue ( "Name", "UserEmperor" );
            xMasterPropSet.setPropertyValue ( "Value", new Integer ( 42 ) );
           
            // Attach the field master to the user field
            xUserField.attachTextFieldMaster ( xMasterPropSet );
           
            // Move the cursor to the end of the document
            mxDocCursor.gotoEnd( false );
            // insert a paragraph break using the XSimpleText interface
            mxDocText.insertControlCharacter (
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

    }

    public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle) {
        try {
            XInterface xField = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextField.User");
            XDependentTextField xDepField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, xField);
            XTextContent xFieldContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xField);
            if (xTextFieldsSupplier.getTextFieldMasters().hasByName("com.sun.star.text.FieldMaster.User." + FieldName)) {
                Object oMaster = xTextFieldsSupplier.getTextFieldMasters().getByName("com.sun.star.text.FieldMaster.User." + FieldName);
                XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oMaster);
                xComponent.dispose();
            }
            XPropertySet xPSet = createUserField(FieldName, FieldTitle);
            xDepField.attachTextFieldMaster(xPSet);
            xTextCursor.getText().insertTextContent(xTextCursor, xFieldContent, false);
        } catch (com.sun.star.uno.Exception exception) {
            exception.printStackTrace(System.out);
        }
    }
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

        if (xTextFieldsSupplier.getTextFields().hasElements()) {
            XPropertySet xPSet;
            XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
            while (xEnum.hasMoreElements()) {
                Object oTextField = xEnum.nextElement();
                XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
                xPSet = xDependent.getTextFieldMaster();
                if (xPSet.getPropertySetInfo().hasPropertyByName(_PropertyName)){
                    Object oValue = xPSet.getPropertyValue(_PropertyName);
                    // TODO replace the following comparison via com.sun.star.uno.Any.Type
                    if(AnyConverter.isString(oValue)){
                        if (_TypeName.equals("String")){
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

        XTextRange xTextRange = xCellCursor.getEnd();
        Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
        if (AnyConverter.isVoid(oTextField))
            return false;
        else{
            XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
            XPropertySet xMaster = xDependent.getTextFieldMaster();
            String UserFieldName = (String) xMaster.getPropertyValue("Name");
            boolean bIsNameCell = ((UserFieldName.startsWith(CompString)) || (UserFieldName.equals(CurFieldName)));
            return bIsNameCell;
        }
    }
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

            XTextRange xTextRange = xTextCursor.getEnd();
            Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
            if (com.sun.star.uno.AnyConverter.isVoid(oTextField))
                return "";
            else {
                XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
                XPropertySet xMaster = xDependent.getTextFieldMaster();
                String UserFieldContent = (String) xMaster.getPropertyValue("Content");
                return UserFieldContent;
            }
        } catch (com.sun.star.uno.Exception exception) {
            exception.printStackTrace(System.out);
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

            // Insert it at the end of the document
            mxDocText.insertTextContent ( mxDocText.getEnd(), xDateField, false );

            // Use the text document's factory to create a user text field,
            // and access it's XDependentTextField interface
            XDependentTextField xUserField =
                (XDependentTextField) UnoRuntime.queryInterface (
                    XDependentTextField.class, mxDocFactory.createInstance (
                        "com.sun.star.text.TextField.User" ) );

            // Create a fieldmaster for our newly created User Text field, and
            // access it's XPropertySet interface
            XPropertySet xMasterPropSet = (XPropertySet)UnoRuntime.queryInterface(
                XPropertySet.class, mxDocFactory.createInstance (
                    "com.sun.star.text.FieldMaster.User" ) );

            // Set the name and value of the FieldMaster
            xMasterPropSet.setPropertyValue ( "Name", "UserEmperor" );
            xMasterPropSet.setPropertyValue ( "Value", new Integer ( 42 ) );
           
            // Attach the field master to the user field
            xUserField.attachTextFieldMaster ( xMasterPropSet );
           
            // Move the cursor to the end of the document
            mxDocCursor.gotoEnd( false );
            // insert a paragraph break using the XSimpleText interface
            mxDocText.insertControlCharacter (
View Full Code Here

Examples of com.sun.star.text.XDependentTextField

                ( "com.sun.star.text.TextField.Database" );

            instance = (XInterface) oDocMSF.createInstance
                ( "com.sun.star.text.TextField.DateTime" );

            XDependentTextField xTF = (XDependentTextField)
                UnoRuntime.queryInterface(XDependentTextField.class,oObj);

            PFieldMaster.setPropertyValue("DataBaseName","Address Book File");
            PFieldMaster.setPropertyValue("DataTableName","address");
            PFieldMaster.setPropertyValue("DataColumnName","FIRSTNAME");
            XText the_Text = xTextDoc.getText();
            XTextCursor the_Cursor = the_Text.createTextCursor();
            XTextContent the_Field = (XTextContent)
                             UnoRuntime.queryInterface(XTextContent.class,oObj);

            xTF.attachTextFieldMaster(PFieldMaster);
            the_Text.insertTextContent(the_Cursor,the_Field,false);
        }
        catch (Exception ex) {
            log.println("Couldn't create instance");
            ex.printStackTrace(log);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.