Examples of XAutoTextEntry


Examples of com.sun.star.text.XAutoTextEntry

     * </ul>
     */
    protected synchronized TestEnvironment createTestEnvironment
            (TestParameters Param, PrintWriter log) {
       
        XAutoTextEntry oEntry = null;
        XAutoTextContainer oContainer;
        XInterface oObj = null;
        int n = 0;
        int nCount = 0;
       
        log.println( "creating a test environment" );
        try {
            XMultiServiceFactory myMSF = (XMultiServiceFactory)Param.getMSF();
            Object oInst = myMSF.createInstance
                    ("com.sun.star.text.AutoTextContainer");
            oContainer = (XAutoTextContainer)
            UnoRuntime.queryInterface(XAutoTextContainer.class,oInst);
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create AutoTextContainer", e);
        }
       
        XNameAccess oContNames = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oContainer);
       
        String contNames[] = oContNames.getElementNames();
        for (int i =0; i < contNames.length; i++){
            log.println("ContainerNames[ "+ i + "]: " + contNames[i]);
        }
       
        try{
            oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName("mytexts"));
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't get AutoTextGroup", e);
        }
       
        oGroup = (XAutoTextGroup) UnoRuntime.queryInterface
                (XAutoTextGroup.class, oObj);
        String[] oENames = oGroup.getElementNames();
        for (int i=0; i<oENames.length; i++) {
            log.println("AutoTextEntryNames[" + i + "]: " + oENames[i]);
        }
       
        XText oText = xTextDoc.getText();
        oText.insertString(oText.getStart(), "New AutoText", true);
        XTextRange oTextRange = (XTextRange) oText;
        try {
            if ( oGroup.hasByName("NewEntryName") ) {
                oGroup.removeByName("NewEntryName");
                log.println("Element 'NewEntryName' exists, removing...");
            }
            log.println("Adding new element 'NewEntryName' to group...");
            oGroup.insertNewByName("NewEntryName", "NewEntryTitle", oTextRange);
            oEntry = (XAutoTextEntry) AnyConverter.toObject(
                    new Type(XAutoTextEntry.class),oGroup.getByName("NewEntryName"));
        } catch ( com.sun.star.container.ElementExistException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.container.NoSuchElementException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.WrappedTargetException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.IllegalArgumentException e ) {
            e.printStackTrace(log);
        }
       
        oObj = oEntry;
       
        log.println("Trying to use XText as TextRange in the method applyTo");
        oEntry.applyTo(oTextRange);
       
        oTextRange = oText.createTextCursor();
        log.println("Trying to use XTextCursor as TextRange in the method applyTo");
        oEntry.applyTo(oTextRange);
       
        log.println( "creating a new environment for AutoTextEntry object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
       
        // adding relation for XText
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                {
                    // Pick a random block in this group and get it's
                    // XAutoTextEntry interface
                    int nRandom = Math.abs ( maRandom.nextInt()
                                             % aBlockNames.length );
                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                        UnoRuntime.queryInterface (
                            XAutoTextEntry.class, xGroup.getByName (
                                aBlockNames[ nRandom ] ) );
                    // insert the modified autotext block at the end of the document
                    xEntry.applyTo ( mxDocCursor );
                   
                    // Get the titles of all text blocks in this AutoText group
                    String [] aBlockTitles = xGroup.getTitles();
                   
                    // Get the XNamed interface of the autotext group
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                            {
                                    // Pick a random block in this group and get it's
                                    // XAutoTextEntry interface
                                    int nRandom = Math.abs ( maRandom.nextInt()
                                                            % aBlockNames.length );
                                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                                             UnoRuntime.queryInterface (
                                                    XAutoTextEntry.class, xGroup.getByName (
                                                             aBlockNames[ nRandom ] ) );
                                    // insert the modified autotext block at the end of the document
                                    xEntry.applyTo ( mxDocCursor );

                                    // Get the titles of all text blocks in this AutoText group
                                    String [] aBlockTitles = xGroup.getTitles();

                                    // Get the XNamed interface of the autotext group
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

     * </ul>
     */
    protected synchronized TestEnvironment createTestEnvironment
            (TestParameters Param, PrintWriter log) {
       
        XAutoTextEntry oEntry = null;
        XAutoTextContainer oContainer;
        XInterface oObj = null;
        int n = 0;
        int nCount = 0;
       
        log.println( "creating a test environment" );
        try {
            XMultiServiceFactory myMSF = (XMultiServiceFactory)Param.getMSF();
            Object oInst = myMSF.createInstance
                    ("com.sun.star.text.AutoTextContainer");
            oContainer = (XAutoTextContainer)
            UnoRuntime.queryInterface(XAutoTextContainer.class,oInst);
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create AutoTextContainer", e);
        }
       
        XNameAccess oContNames = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oContainer);
       
        String contNames[] = oContNames.getElementNames();
        for (int i =0; i < contNames.length; i++){
            log.println("ContainerNames[ "+ i + "]: " + contNames[i]);
        }
       
        try{
            oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName("mytexts"));
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't get AutoTextGroup", e);
        }
       
        oGroup = (XAutoTextGroup) UnoRuntime.queryInterface
                (XAutoTextGroup.class, oObj);
        String[] oENames = oGroup.getElementNames();
        for (int i=0; i<oENames.length; i++) {
            log.println("AutoTextEntryNames[" + i + "]: " + oENames[i]);
        }
       
        XText oText = xTextDoc.getText();
        oText.insertString(oText.getStart(), "New AutoText", true);
        XTextRange oTextRange = (XTextRange) oText;
        try {
            if ( oGroup.hasByName("NewEntryName") ) {
                oGroup.removeByName("NewEntryName");
                log.println("Element 'NewEntryName' exists, removing...");
            }
            log.println("Adding new element 'NewEntryName' to group...");
            oGroup.insertNewByName("NewEntryName", "NewEntryTitle", oTextRange);
            oEntry = (XAutoTextEntry) AnyConverter.toObject(
                    new Type(XAutoTextEntry.class),oGroup.getByName("NewEntryName"));
        } catch ( com.sun.star.container.ElementExistException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.container.NoSuchElementException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.WrappedTargetException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.IllegalArgumentException e ) {
            e.printStackTrace(log);
        }
       
        oObj = oEntry;
       
        log.println("Trying to use XText as TextRange in the method applyTo");
        oEntry.applyTo(oTextRange);
       
        oTextRange = oText.createTextCursor();
        log.println("Trying to use XTextCursor as TextRange in the method applyTo");
        oEntry.applyTo(oTextRange);
       
        log.println( "creating a new environment for AutoTextEntry object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
       
        // adding relation for XText
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

     * </ul>
     */
    protected synchronized TestEnvironment createTestEnvironment
            (TestParameters Param, PrintWriter log) {
       
        XAutoTextEntry oEntry = null;
        XAutoTextContainer oContainer;
        XInterface oObj = null;
        int n = 0;
        int nCount = 0;
       
        log.println( "creating a test environment" );
        try {
            XMultiServiceFactory myMSF = (XMultiServiceFactory)Param.getMSF();
            Object oInst = myMSF.createInstance
                    ("com.sun.star.text.AutoTextContainer");
            oContainer = (XAutoTextContainer)
            UnoRuntime.queryInterface(XAutoTextContainer.class,oInst);
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create AutoTextContainer", e);
        }
       
        XNameAccess oContNames = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oContainer);
       
        String contNames[] = oContNames.getElementNames();
        for (int i =0; i < contNames.length; i++){
            log.println("ContainerNames[ "+ i + "]: " + contNames[i]);
        }
       
        try{
            oObj = (XInterface) AnyConverter.toObject(new Type(XInterface.class),oContNames.getByName("mytexts"));
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't get AutoTextGroup", e);
        }
       
        oGroup = (XAutoTextGroup) UnoRuntime.queryInterface
                (XAutoTextGroup.class, oObj);
        String[] oENames = oGroup.getElementNames();
        for (int i=0; i<oENames.length; i++) {
            log.println("AutoTextEntryNames[" + i + "]: " + oENames[i]);
        }
       
        XText oText = xTextDoc.getText();
        oText.insertString(oText.getStart(), "New AutoText", true);
        XTextRange oTextRange = (XTextRange) oText;
        try {
            if ( oGroup.hasByName("NewEntryName") ) {
                oGroup.removeByName("NewEntryName");
                log.println("Element 'NewEntryName' exists, removing...");
            }
            log.println("Adding new element 'NewEntryName' to group...");
            oGroup.insertNewByName("NewEntryName", "NewEntryTitle", oTextRange);
            oEntry = (XAutoTextEntry) AnyConverter.toObject(
                    new Type(XAutoTextEntry.class),oGroup.getByName("NewEntryName"));
        } catch ( com.sun.star.container.ElementExistException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.container.NoSuchElementException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.WrappedTargetException e ) {
            e.printStackTrace(log);
        } catch ( com.sun.star.lang.IllegalArgumentException e ) {
            e.printStackTrace(log);
        }
       
        oObj = oEntry;
       
        log.println("Trying to use XText as TextRange in the method applyTo");
        oEntry.applyTo(oTextRange);
       
        oTextRange = oText.createTextCursor();
        log.println("Trying to use XTextCursor as TextRange in the method applyTo");
        oEntry.applyTo(oTextRange);
       
        log.println( "creating a new environment for AutoTextEntry object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
       
        // adding relation for XText
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                {
                    // Pick a random block in this group and get it's
                    // XAutoTextEntry interface
                    int nRandom = Math.abs ( maRandom.nextInt()
                                             % aBlockNames.length );
                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                        UnoRuntime.queryInterface (
                            XAutoTextEntry.class, xGroup.getByName (
                                aBlockNames[ nRandom ] ) );
                    // insert the modified autotext block at the end of the document
                    xEntry.applyTo ( mxDocCursor );
                   
                    // Get the titles of all text blocks in this AutoText group
                    String [] aBlockTitles = xGroup.getTitles();
                   
                    // Get the XNamed interface of the autotext group
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                {
                    // Pick a random block in this group and get it's
                    // XAutoTextEntry interface
                    int nRandom = Math.abs ( maRandom.nextInt()
                                             % aBlockNames.length );
                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                        UnoRuntime.queryInterface (
                            XAutoTextEntry.class, xGroup.getByName (
                                aBlockNames[ nRandom ] ) );
                    // insert the modified autotext block at the end of the document
                    xEntry.applyTo ( mxDocCursor );
                   
                    // Get the titles of all text blocks in this AutoText group
                    String [] aBlockTitles = xGroup.getTitles();
                   
                    // Get the XNamed interface of the autotext group
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                            {
                                    // Pick a random block in this group and get it's
                                    // XAutoTextEntry interface
                                    int nRandom = Math.abs ( maRandom.nextInt()
                                                            % aBlockNames.length );
                                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                                             UnoRuntime.queryInterface (
                                                    XAutoTextEntry.class, xGroup.getByName (
                                                             aBlockNames[ nRandom ] ) );
                                    // insert the modified autotext block at the end of the document
                                    xEntry.applyTo ( mxDocCursor );

                                    // Get the titles of all text blocks in this AutoText group
                                    String [] aBlockTitles = xGroup.getTitles();

                                    // Get the XNamed interface of the autotext group
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                {
                    // Pick a random block in this group and get it's
                    // XAutoTextEntry interface
                    int nRandom = Math.abs ( maRandom.nextInt()
                                             % aBlockNames.length );
                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                        UnoRuntime.queryInterface (
                            XAutoTextEntry.class, xGroup.getByName (
                                aBlockNames[ nRandom ] ) );
                    // insert the modified autotext block at the end of the document
                    xEntry.applyTo ( mxDocCursor );
                   
                    // Get the titles of all text blocks in this AutoText group
                    String [] aBlockTitles = xGroup.getTitles();
                   
                    // Get the XNamed interface of the autotext group
View Full Code Here

Examples of com.sun.star.text.XAutoTextEntry

                {
                    // Pick a random block in this group and get it's
                    // XAutoTextEntry interface
                    int nRandom = Math.abs ( maRandom.nextInt()
                                             % aBlockNames.length );
                    XAutoTextEntry xEntry = ( XAutoTextEntry )
                        UnoRuntime.queryInterface (
                            XAutoTextEntry.class, xGroup.getByName (
                                aBlockNames[ nRandom ] ) );
                    // insert the modified autotext block at the end of the document
                    xEntry.applyTo ( mxDocCursor );
                   
                    // Get the titles of all text blocks in this AutoText group
                    String [] aBlockTitles = xGroup.getTitles();
                   
                    // Get the XNamed interface of the autotext group
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.