Examples of XTextFieldsSupplier


Examples of com.sun.star.text.XTextFieldsSupplier

        XInterface oObj = null;
        XText oText = null;
        XTextContent oContent = null;
        XInterface aField = null;
        XTextFieldsSupplier xTextFieldsSupp = null;

        try {
            // we want to create an instance of ScCellFieldObj.
            // to do this we must get an MultiServiceFactory.

            XMultiServiceFactory _oMSF = (XMultiServiceFactory)
                UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc);

            aField = (XInterface)
                _oMSF.createInstance("com.sun.star.text.TextField.URL");
            oContent = (XTextContent)
                UnoRuntime.queryInterface(XTextContent.class, aField);

            XSpreadsheets oSheets = xSheetDoc.getSheets() ;
            XIndexAccess oIndexSheets = (XIndexAccess)
                UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
            XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
                    new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));

            XCell oCell = oSheet.getCellByPosition(2,3);
            oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);

            oText.insertTextContent(
                oText.createTextCursor(), oContent, true);

            xTextFieldsSupp = (XTextFieldsSupplier)
                UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell);

             oObj = xTextFieldsSupp.getTextFields().createEnumeration();
        } catch (com.sun.star.lang.WrappedTargetException e) {
            log.println("Exception occured while creating test Object.");
            e.printStackTrace(log);
            throw new StatusException("Couldn't create test object", e);
        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
            log.println("Exception occured while creating test Object.");
            e.printStackTrace(log);
            throw new StatusException("Couldn't create test object", e);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            log.println("Exception occured while creating test Object.");
            e.printStackTrace(log);
            throw new StatusException("Couldn't create test object", e);
        } catch (com.sun.star.uno.Exception e) {
            log.println("Exception occured while creating test Object.");
            e.printStackTrace(log);
            throw new StatusException("Couldn't create test object", e);
        }

        TestEnvironment tEnv = new TestEnvironment(oObj) ;

        tEnv.addObjRelation("ENUM", xTextFieldsSupp.getTextFields());

        return tEnv;
    }
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

        } catch(com.sun.star.beans.UnknownPropertyException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create a test environment", e);
        }

        XTextFieldsSupplier xTFSupp = (XTextFieldsSupplier)
            UnoRuntime.queryInterface(XTextFieldsSupplier.class, left);

        oObj = xTFSupp.getTextFields();

        TestEnvironment tEnv = new TestEnvironment(oObj);

        return tEnv;
    } // finish method getTestEnvironment
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

            oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);

            oText.insertTextContent(
                oText.createTextCursor(), oContent, true);

            XTextFieldsSupplier xTextFieldsSupp = (XTextFieldsSupplier)
                UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell);

            oObj = xTextFieldsSupp.getTextFields();
        } catch (com.sun.star.lang.WrappedTargetException e) {
            log.println("Exception occured while creating test Object.");
            e.printStackTrace(log);
            throw new StatusException("Couldn't create test object", e);
        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

        log.println( "creating a test environment" );


        // create testobject here
        try {
            XTextFieldsSupplier oTFS = (XTextFieldsSupplier)
                UnoRuntime.queryInterface( XTextFieldsSupplier.class, xTextDoc );

            oObj = oTFS.getTextFields();

        }
        catch (Exception ex) {
            log.println("Couldn't create instance");
            ex.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

        log.println( "creating a test environment" );


        // create testobject here
        try {
            XTextFieldsSupplier oTFS = (XTextFieldsSupplier)
                UnoRuntime.queryInterface( XTextFieldsSupplier.class, xTextDoc );

            oObj = oTFS.getTextFieldMasters();

        }
        catch (Exception ex) {
            log.println("Couldn't create instance");
            ex.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

            e.printStackTrace(log);
            throw new StatusException( "Couldn't create TextField", e );
        }

        // create testobject here
        XTextFieldsSupplier oTFS = (XTextFieldsSupplier)
            UnoRuntime.queryInterface( XTextFieldsSupplier.class, xTextDoc );
        xFEA = oTFS.getTextFields();
        oObj = oTFS.getTextFields().createEnumeration();

        log.println( "creating a new environment for FieldEnumeration object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );

        tEnv.addObjRelation("ENUM", xFEA);
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

    private class RefreshListener implements Listener{

        public void refresh() {
            System.out.println("Refreshing Document");
            /* Refresh all text fields */
            XTextFieldsSupplier xTFS = (XTextFieldsSupplier)
                    UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
            XEnumerationAccess xEA = xTFS.getTextFields();
            /* Get XRefreshable interface */
            XRefreshable xRef= (XRefreshable)
                    UnoRuntime.queryInterface(XRefreshable.class,xEA);
            /* Refresh fields */
            xRef.refresh();
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

     * Find text fields, create OOOResult or OOOError, and add to list of
     * OOOElements. Don't worry now if there are field masters with multiple
     * dependent fields.
     */
    private void findTextFields () throws java.lang.Exception {
        XTextFieldsSupplier xTFS = (XTextFieldsSupplier)
                 UnoRuntime.queryInterface(XTextFieldsSupplier.class,xTextDocument);
         List docFieldMasterNames =
                 Arrays.asList((xTFS.getTextFieldMasters()).getElementNames());
         /* Create either OOOREsult or OOOError and add to list of OOOElements */
         XEnumeration xEnum = xTFS.getTextFields().createEnumeration();
         while (xEnum.hasMoreElements()){
             XDependentTextField xTF = (XDependentTextField)xEnum.nextElement();
             String name = (String) xTF.getTextFieldMaster().getPropertyValue("Name");


View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

         }
        
    }

    private ArrayList<XDependentTextField> getTextFields () throws java.lang.Exception {
        XTextFieldsSupplier xTFS = (XTextFieldsSupplier)
                 UnoRuntime.queryInterface(XTextFieldsSupplier.class,xTextDocument);
        ArrayList<XDependentTextField> xDTF=new ArrayList();
         /* Create either OOOREsult or OOOError and add to list of OOOElements */
        XEnumeration xEnum = xTFS.getTextFields().createEnumeration();
        XTextField xTF;
        while (xEnum.hasMoreElements()){
//            xDTF.add( (XDependentTextField) xEnum.nextElement())) ;
//            Logger.getLogger("com.CompPad").log(Level.FINE,"nextelement: "+((XTextField)((Any)xEnum.nextElement()).getObject()).getPresentation(true));
           
View Full Code Here

Examples of com.sun.star.text.XTextFieldsSupplier

    private void fixTextFields() throws java.lang.Exception {
        Logger.getLogger("com.CompPad").log(Level.FINE,"Fixing Text Fields");
        String name;
        XPropertySet fieldMaster;
        LinkedList expFieldMasterNames=new LinkedList();
         XTextFieldsSupplier xTFS = (XTextFieldsSupplier)
                 UnoRuntime.queryInterface(XTextFieldsSupplier.class,xTextDocument);
         List docFieldMasterNames =
                 Arrays.asList((xTFS.getTextFieldMasters()).getElementNames());
         String expName;
         for (Object item:docFieldMasterNames){
             name = (String)item;
             /* The strings in element list don't contain the prefix, so
              prefix must be removed from docFieldMasterName before checking it */
             expName=name.replace("com.sun.star.text.fieldmaster.User.", "");
             if (name.startsWith("com.sun.star.text.fieldmaster.User.OOO") & !this.hasElementName(expName)){
                  Logger.getLogger("com.CompPad").log(Level.FINE,"    orphan:"+ expName);
                  /* the field master is orphaned. Remove the field master and
                   * dependent fields */
                  fieldMaster = (XPropertySet)(((Any)
                          ((xTFS.getTextFieldMasters()).getByName(name))).getObject());
                  /* Dispose of fieldmaster */
                  ((XComponent)UnoRuntime.queryInterface(
                          XComponent.class, fieldMaster)).dispose();
                  /* When the fieldmaster is disposed of, the
                   * dependent text fields are disposed of as well, since they
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.