Examples of TextSegment


Examples of com.sun.star.accessibility.TextSegment

            try
            {
                // sWord + nStart mark the current word
                // make a node as soon as a new one is found; close the last
                // one at the end
                TextSegment sWord = xText.getTextAtIndex(0, nTextType);
                TextSegment sBefore = xText.getTextBeforeIndex(0, nTextType);
                TextSegment sBehind = xText.getTextBehindIndex(0, nTextType);
                int nStart = 0;
                for(int i = 1; i < nLength; i++)
                {
                    TextSegment sTmp = xText.getTextAtIndex(i, nTextType);
                    TextSegment sTBef = xText.getTextBeforeIndex(i, nTextType);
                    TextSegment sTBeh = xText.getTextBehindIndex(i, nTextType);
                    if( ! ( sTmp.equals( sWord ) && sTBef.equals( sBefore ) &&
                            sTBeh.equals( sBehind ) ) )
                    {
                        aNode.addChild (new StringNode (textAtIndexNodeString(
                            nStart, i,
                            sWord.SegmentText, sBefore.SegmentText, sBehind.SegmentText), aNode));
                        sWord = sTmp;
View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

     *  <li> <code>getCharacterCount()</code> </li>
     * </ul>
     */
    public void _getTextAtIndex() {
        requiredMethod("getCharacterCount()");
    TextSegment txt = null;
        boolean res = true;

        try {
            log.print("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):");

View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

     *  <li> <code>getCharacterCount()</code> </li>
     * </ul>
     */
    public void _getTextBeforeIndex() {
        requiredMethod("getCharacterCount()");
    TextSegment txt = null;
        boolean res = true;

        try {
            log.print("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):");

View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

     *  <li> <code>getCharacterCount()</code> </li>
     * </ul>
     */
    public void _getTextBehindIndex() {
        requiredMethod("getCharacterCount()");
    TextSegment txt = null;
        boolean res = true;

        try {
            log.print("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):");

View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

    public boolean _getTextAtIndex() {
        boolean res = true;

        try {
            System.out.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):");
            TextSegment txt =
                oObj.getTextAtIndex(-1, AccessibleTextType.PARAGRAPH);
            System.out.println("Exception was expected");
            res &= false;
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            System.out.println("Expected exception");
            res &= true;
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            System.out.println("Expected exception");
            res &= true;
        }

        try {
            System.out.println("getTextAtIndex(chCount+1," +
                " AccessibleTextType.PARAGRAPH):");
            TextSegment txt = oObj.getTextAtIndex(chCount + 1,
                 AccessibleTextType.PARAGRAPH);
            System.out.println("Exception was expected");
            res &= false;
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            System.out.println("Expected exception");
            res &= true;
        catch(com.sun.star.lang.IllegalArgumentException e) {
            System.out.println("Expected exception");
            res &= true;
        }


        try {
            if ( chCount > 0 ) {
                System.out.println("getTextAtIndex(chCount," +
                    " AccessibleTextType.PARAGRAPH):");
                TextSegment txt = oObj.getTextAtIndex(chCount,
                    AccessibleTextType.PARAGRAPH);
                System.out.println("'" + txt.SegmentText + "'");
                res &= txt.SegmentText.length() == 0;

                System.out.println("getTextAtIndex(1," +
View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

    public boolean _getTextBeforeIndex() {
        boolean res = true;

        try {
            System.out.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):");
            TextSegment txt = oObj.getTextBeforeIndex(-1,
                AccessibleTextType.PARAGRAPH);
            System.out.println("Exception was expected");
            res &= false;
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            System.out.println("Expected exception");
            res &= true;
        catch(com.sun.star.lang.IllegalArgumentException e) {
            System.out.println("Expected exception");
            res &= true;
        }


        try {
            System.out.println("getTextBeforeIndex(chCount+1, " +
                "AccessibleTextType.PARAGRAPH):");
            TextSegment txt = oObj.getTextBeforeIndex(chCount + 1,
                AccessibleTextType.PARAGRAPH);
            System.out.println("Exception was expected");
            res &= false;
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            System.out.println("Expected exception");
            res &= true;
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            System.out.println("Expected exception");
            res &= true;
        }

        TextSegment txt = null;
        try {
            if (chCount > 0) {
                System.out.println("getTextBeforeIndex(chCount," +
                    " AccessibleTextType.PARAGRAPH):");
                txt = oObj.getTextBeforeIndex(chCount,
View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

    public boolean _getTextBehindIndex() {
        boolean res = true;

        try {
            System.out.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):");
            TextSegment txt = oObj.getTextBehindIndex(-1,
                AccessibleTextType.PARAGRAPH);
            System.out.println("Exception was expected");
            res &= false;
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            System.out.println("Expected exception");
            res &= true;
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            System.out.println("Expected exception");
            res &= true;
        }


        try {
            System.out.println("getTextBehindIndex(chCount+1, " +
                "AccessibleTextType.PARAGRAPH):");
            TextSegment txt = oObj.getTextBehindIndex(chCount + 1,
                AccessibleTextType.PARAGRAPH);
            System.out.println("Exception was expected");
            res &= false;
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            System.out.println("Expected exception");
            res &= true;
        catch(com.sun.star.lang.IllegalArgumentException e) {
            System.out.println("Expected exception");
            res &= true;
        }


        try {
            if ( chCount > 0 ) {
                System.out.println("getTextBehindIndex(chCount," +
                    " AccessibleTextType.PARAGRAPH):");
                TextSegment txt = oObj.getTextBehindIndex(chCount,
                    AccessibleTextType.PARAGRAPH);
                System.out.println("'" + txt.SegmentText + "'");
                res &= txt.SegmentText.length() == 0;

                System.out.println("getTextBehindIndex(chCount-1," +
                    " AccessibleTextType.PARAGRAPH):");
                txt = oObj.getTextBehindIndex(chCount - 1,
                    AccessibleTextType.PARAGRAPH);
                System.out.println("'" + txt.SegmentText + "'");
                res &= txt.SegmentText.length() == 0;
            }
            if ( chCount > 1 ) {
                System.out.println("getTextBehindIndex(1," +
                    " AccessibleTextType.CHARACTER):");
                TextSegment txt = oObj.getTextBehindIndex(1,
                    AccessibleTextType.CHARACTER);
                System.out.println("'" + txt.SegmentText + "'");
                res &= txt.SegmentText.equals(text.substring(2, 3));
            }
            if (chCount > 2) {
                System.out.println("getTextBehindIndex(chCount-2," +
                    " AccessibleTextType.CHARACTER):");
                TextSegment txt = oObj.getTextBehindIndex(chCount - 2,
                     AccessibleTextType.CHARACTER);
                System.out.println("'" + txt.SegmentText + "'");
                res &= txt.SegmentText.equals(text.substring(chCount - 1, chCount));
            }
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

                UnoRuntime.queryInterface( XAccessibleMultiLineText.class, mxText );

            if( null != xMultiText ) {
                try {
                  maCaretLineNoLabel.setText ( Integer.toString( xMultiText.getNumberOfLineWithCaret() ) );
                  TextSegment ts = xMultiText.getTextAtLineWithCaret();
                  maCaretLineTextLabel.setText ( "[" + ts.SegmentStart
                     + "," + ts.SegmentEnd
                     + "] \"" + ts.SegmentText + "\"");
                  maLineNoFromCaretPosLabel.setText ( Integer.toString( xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) ) );
                  ts = xMultiText.getTextAtLineNumber(xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) );
View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

        return aNode;
    }

    private MutableTreeNode CreateSegmentNode (String sTitle, short nTextType, int nWhere)
    {
        TextSegment aSegment;
        int nTextLength = mxText.getCharacterCount();
        DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle);
        for (int nIndex=0; nIndex<=nTextLength; /* empty */)
        {
            aSegment = GetTextSegment (nIndex, nTextType, nWhere);
View Full Code Here

Examples of com.sun.star.accessibility.TextSegment

    }


    private TextSegment GetTextSegment (int nIndex, short nTextType, int nWhere)
    {
        TextSegment aSegment;

        try
        {
            switch (nWhere)
            {
                case BEFORE:
                    aSegment = mxText.getTextBeforeIndex (nIndex, nTextType);
                    break;
                   
                case AT:
                    aSegment = mxText.getTextAtIndex (nIndex, nTextType);
                    break;
                   
                case BEHIND:
                    aSegment = mxText.getTextBehindIndex (nIndex, nTextType);
                    break;

                default:
                    aSegment = new TextSegment();
                    aSegment.SegmentText = new String ("unknown position "   + nWhere);
                    aSegment.SegmentStart = nIndex;
                    aSegment.SegmentStart = nIndex+1;
                    break;
            }
        }
        catch (IndexOutOfBoundsException aException)
        {
            aSegment = new TextSegment ();
            aSegment.SegmentText = new String ("Invalid index at ") + nIndex + " : "
                + aException.toString();
            aSegment.SegmentStart = nIndex;
            aSegment.SegmentEnd = nIndex+1;
        }
        catch (IllegalArgumentException aException)
        {
            aSegment = new TextSegment ();
            aSegment.SegmentText = new String ("Illegal argument at ") + nIndex + " : "
                + aException.toString();
            aSegment.SegmentStart = nIndex;
            aSegment.SegmentEnd = nIndex+1;
        }
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.