Examples of XIndexReplace


Examples of com.sun.star.container.XIndexReplace

                log.println("Expected was an instance of "+
                    "com.sun.star.container.XIndexReplace");
            }
            log.println("Trying to cast property 'NumberingRules' "+
                "to XIndexReplace");
            XIndexReplace theRules = (XIndexReplace)
                oObj.getPropertyValue( "NumberingRules" );
            bResult = true;
        } catch( Exception e ) {
            log.println("Error occured while trying to get property"+
                " 'NumberingRules'");
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

                     new PropertyTester() {
            PropertyValue[][] newVal = null;
            PropertyValue[][] oldVal = null;

            protected Object getNewValue(String propName, Object oldValue) {
                XIndexReplace indProp = (XIndexReplace) UnoRuntime.queryInterface(
                                                XIndexReplace.class, oldValue);

                try {
                    oldVal = (PropertyValue[][]) indProp.getByIndex(0);

                    log.println("Get:");
                    printLevelFormatProperty(oldValue);

                    newVal = new PropertyValue[1][2];

                    for (int i = 0; i < newVal[0].length; i++) {
                        newVal[0][i] = new PropertyValue();
                    }

                    newVal[0][1].Name = "TokenType";
                    newVal[0][1].Value = "TokenEntryText";
                    newVal[0][0].Name = "Text";
                    newVal[0][0].Value = "BaseIndex";

                    indProp.replaceByIndex(0, newVal);
                } catch (com.sun.star.lang.WrappedTargetException e) {
                    log.println("Exception occured while testing LevelFormat");
                    e.printStackTrace(log);
                } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
                    log.println("Exception occured while testing LevelFormat");
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

    /**
     * Outputs full description of 'LevelFormat' property
     * value into <code>log</code>.
     */
    private void printLevelFormatProperty(Object value) {
        XIndexReplace indProp = (XIndexReplace) UnoRuntime.queryInterface(
                                        XIndexReplace.class, value);
        PropertyValue[][] val = null;

        try {
            log.println(" \u0421ollection has " + indProp.getCount() +
                        " elements : ");

            for (int i = 0; i < indProp.getCount(); i++) {
                val = (PropertyValue[][]) indProp.getByIndex(i);

                log.println("  " + i + ": has " + val.length + " levels :");

                for (int j = 0; j < val.length; j++) {
                    log.println("    " + j + " level :");
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

     * has at least one element.
     */
    public void _getChapterNumberingRules() {
        boolean res = false;

        XIndexReplace the_chapter = oObj.getChapterNumberingRules();
        res = the_chapter.hasElements();

        tRes.tested("getChapterNumberingRules()",res);
    }
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

     * @see ifc.text._NumberingLevel
     */
    public void _NumberingRules() {
        requiredMethod("NumberingStyleName");
       
        XIndexReplace NumberingRules = null;
        PropertyValue[] propertyValues = null;
        try {
            NumberingRules = (XIndexReplace) AnyConverter.toObject(
                           new Type(XIndexReplace.class), oObj.getPropertyValue("NumberingRules"));
        } catch (com.sun.star.lang.IllegalArgumentException ex) {
            Status.failed( "could not get NumberingRuels: "+ ex.toString() );
            return;
        } catch (UnknownPropertyException ex) {
            Status.failed( "could not get NumberingRuels: "+ ex.toString() );
            return;
        } catch (WrappedTargetException ex) {
            Status.failed( "could not get NumberingRuels: "+ ex.toString() );
            return;
        }
        try {
            propertyValues = (PropertyValue[]) NumberingRules.getByIndex(0);

        } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
            Status.failed( "could not get NumberlingLevel-Array from NumberingRuels: "+ ex.toString() );
            return;
        } catch (WrappedTargetException ex) {
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

            XIndexAccess xNum = (XIndexAccess) UnoRuntime.queryInterface(
                XIndexAccess.class,
                mxDocFactory.createInstance( "com.sun.star.text.NumberingRules" ) );

            // Also get the NumberingRule's XIndexReplace interface
            XIndexReplace xReplace = (XIndexReplace) UnoRuntime.queryInterface(
                XIndexReplace.class, xNum );

            // Create an array of XPropertySets, one for each of the three
            // paragraphs we're about to create
            XPropertySet xParas[] = new XPropertySet [ 3 ];
            for ( int i = 0 ; i < 3 ; ++ i )
            {
                // Create a new paragraph
                XTextContent xNewPara = (XTextContent) UnoRuntime.queryInterface(
                    XTextContent.class, mxDocFactory.createInstance(
                        "com.sun.star.text.Paragraph" ) );
               
                // Get the XPropertySet interface of the new paragraph and put
                // it in our array
                xParas[i] = (XPropertySet) UnoRuntime.queryInterface(
                    XPropertySet.class, xNewPara );

                // Insert the new paragraph into the document after the fish
                // section. As it is an insert relative to the fish section, the
                // first paragraph inserted will be below the next two
                xRelative.insertTextContentAfter ( xNewPara, mxFishSection );

                // Separate from the above, but also needs to be done three times

                // Get the PropertyValue sequence for this numbering level
                PropertyValue [] aProps = (PropertyValue [] ) xNum.getByIndex ( i );

                // Iterate over the PropertyValue's for this numbering level,
                // looking for the 'NumberingType' property
                for ( int j = 0 ; j < aProps.length ; ++j )
                {
                    if ( aProps[j].Name.equals ( "NumberingType" ) )
                    {
                        // Once we find it, set it's value to a new type,
                        // dependent on which numbering level we're currently on
                        switch ( i )
                        {
                        case 0 : aProps[j].Value =
                                     new Short(NumberingType.ROMAN_UPPER);
                            break;
                        case 1 : aProps[j].Value =
                                     new Short(NumberingType.CHARS_UPPER_LETTER);
                            break;
                        case 2 : aProps[j].Value =
                                     new Short(NumberingType.ARABIC);
                            break;
                        }
                        // Put the updated PropertyValue sequence back into the
                        // NumberingRules service
                        xReplace.replaceByIndex ( i, aProps );
                        break;
                    }
                }
            }
            // Get the XParagraphCursor interface of our text cursro
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

     * @see ifc.text._NumberingLevel
     */
    public void _NumberingRules() {
        requiredMethod("NumberingStyleName");
       
        XIndexReplace NumberingRules = null;
        PropertyValue[] propertyValues = null;
        try {
            NumberingRules = (XIndexReplace) AnyConverter.toObject(
                           new Type(XIndexReplace.class), oObj.getPropertyValue("NumberingRules"));
        } catch (com.sun.star.lang.IllegalArgumentException ex) {
            Status.failed( "could not get NumberingRuels: "+ ex.toString() );
            return;
        } catch (UnknownPropertyException ex) {
            Status.failed( "could not get NumberingRuels: "+ ex.toString() );
            return;
        } catch (WrappedTargetException ex) {
            Status.failed( "could not get NumberingRuels: "+ ex.toString() );
            return;
        }
        try {
            propertyValues = (PropertyValue[]) NumberingRules.getByIndex(0);

        } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
            Status.failed( "could not get NumberlingLevel-Array from NumberingRuels: "+ ex.toString() );
            return;
        } catch (WrappedTargetException ex) {
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

                    // XIndexAccess interface
                    XIndexAccess xNum = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class,
                                    mxDocFactory.createInstance( "com.sun.star.text.NumberingRules" ) );

                    // Also get the NumberingRule's XIndexReplace interface
                    XIndexReplace xReplace = (XIndexReplace) UnoRuntime.queryInterface(
                            XIndexReplace.class, xNum );

                    // Create an array of XPropertySets, one for each of the three paragraphs we're about
                    // to create
                    XPropertySet xParas[] = new XPropertySet [ 3 ];
                    for ( int i = 0 ; i < 3 ; ++ i )
                    {
                            // Create a new paragraph
                            XTextContent xNewPara = (XTextContent) UnoRuntime.queryInterface(
                                    XTextContent.class, mxDocFactory.createInstance(
                                            "com.sun.star.text.Paragraph" ) );

                            // Get the XPropertySet interface of the new paragraph and put it in our array
                            xParas[i] = (XPropertySet) UnoRuntime.queryInterface(
                                    XPropertySet.class, xNewPara );

                            // Insert the new paragraph into the document after the fish section. As it is
                            // an insert
                            // relative to the fish section, the first paragraph inserted will be below
                            // the next two
                            xRelative.insertTextContentAfter ( xNewPara, mxFishSection );

                            // Separate from the above, but also needs to be done three times

                            // Get the PropertyValue sequence for this numbering level
                            PropertyValue [] aProps = (PropertyValue [] ) xNum.getByIndex ( i );

                            // Iterate over the PropertyValue's for this numbering level, looking for the
                            // 'NumberingType' property
                            for ( int j = 0 ; j < aProps.length ; ++j )
                            {
                                    if ( aProps[j].Name.equals ( "NumberingType" ) )
                                    {
                                            // Once we find it, set it's value to a new type,
                                            // dependent on which
                                            // numbering level we're currently on
                                            switch ( i )
                                            {
                                                    case 0 : aProps[j].Value =
                                                            new Short(NumberingType.ROMAN_UPPER);
                                                    break;
                                                    case 1 : aProps[j].Value =
                                                            new Short(NumberingType.CHARS_UPPER_LETTER);
                                                    break;
                                                    case 2 : aProps[j].Value =
                                                            new Short(NumberingType.ARABIC);
                                                    break;
                                            }
                                            // Put the updated PropertyValue sequence back into the
                                            // NumberingRules service
                                            xReplace.replaceByIndex ( i, aProps );
                                            break;
                                    }
                            }
                    }
                    // Get the XParagraphCursor interface of our text cursro
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

     * has at least one element.
     */
    public void _getChapterNumberingRules() {
        boolean res = false;

        XIndexReplace the_chapter = oObj.getChapterNumberingRules();
        res = the_chapter.hasElements();

        tRes.tested("getChapterNumberingRules()",res);
    }
View Full Code Here

Examples of com.sun.star.container.XIndexReplace

                     new PropertyTester() {
            PropertyValue[][] newVal = null;
            PropertyValue[][] oldVal = null;

            protected Object getNewValue(String propName, Object oldValue) {
                XIndexReplace indProp = (XIndexReplace) UnoRuntime.queryInterface(
                                                XIndexReplace.class, oldValue);

                try {
                    oldVal = (PropertyValue[][]) indProp.getByIndex(0);

                    log.println("Get:");
                    printLevelFormatProperty(oldValue);

                    newVal = new PropertyValue[1][2];

                    for (int i = 0; i < newVal[0].length; i++) {
                        newVal[0][i] = new PropertyValue();
                    }

                    newVal[0][1].Name = "TokenType";
                    newVal[0][1].Value = "TokenEntryText";
                    newVal[0][0].Name = "Text";
                    newVal[0][0].Value = "BaseIndex";

                    indProp.replaceByIndex(0, newVal);
                } catch (com.sun.star.lang.WrappedTargetException e) {
                    log.println("Exception occured while testing LevelFormat");
                    e.printStackTrace(log);
                } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
                    log.println("Exception occured while testing LevelFormat");
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.