Examples of XTextRange


Examples of com.sun.star.text.XTextRange

        XText xText = m_xDoc.getText();
        java.util.Random rnd = new java.util.Random(seed);
        XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
        for(int i=0; i<30; i++) {
            xCrsr.goRight((short)rnd.nextInt(300), false);
            XTextRange xCrsrAsRange = (XTextRange)UnoRuntime.queryInterface(
                XTextRange.class,
                xCrsr);
            xText.insertControlCharacter(xCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
        }
    }
View Full Code Here

Examples of com.sun.star.text.XTextRange

    public String getUserFieldContent(XTextCursor xTextCursor)
    {
        try
        {
            XTextRange xTextRange = xTextCursor.getEnd();
            Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
            if (com.sun.star.uno.AnyConverter.isVoid(oTextField))
            {
                return "";
            }
View Full Code Here

Examples of com.sun.star.text.XTextRange

    {
        try {
            log.println("Checking RDFa gunk...");

            String content = "behold, for i am the content.";
            XTextRange xTR = new TestRange(content);
            XMetadatable xM = (XMetadatable) xTR;

            Statement[] result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: not empty (initial)",
                0 == result.length);

            try {
                xRep.setStatementRDFa(foo, new XURI[] {}, xM, "", null);
                assure("RDFa: set: no predicate", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }

            try {
                xRep.setStatementRDFa(foo, new XURI[] {bar}, null, "", null);
                assure("RDFa: set: null", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }

            XLiteral trlit = Literal.create(xContext, content);
            Statement x_FooBarTRLit = new Statement(foo, bar, trlit, null);
            xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "", null);

            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: without content",
                1 == result.length && eq((Statement)result[0], x_FooBarTRLit));

            //FIXME: do this?
            xTR.setString(lit.getStringValue());
/*
            Statement xFooBarLit = new Statement(foo, bar, lit, null);
            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: change",
                eq((Statement)result.First, xFooBarLit) && null == result.Second);
*/

            Statement x_FooBarLittype = new Statement(foo, bar, littype, null);
            Statement x_FooLabelLit = new Statement(foo, rdfslabel, lit, null);
            xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "42", uint);

            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: with content",
                2 == result.length && eq((Statement)result[0], x_FooLabelLit)
                && eq((Statement)result[1], x_FooBarLittype));

            //FIXME: do this?
            xTR.setString(content);
/*
            Statement xFooLabelTRLit = new Statement(foo, rdfslabel, trlit, null);
            result = xRep.getStatementRDFa((XMetadatable)xTR);
            assure("RDFa: get: change (label)",
                eq((Statement)result.First, xFooBarLittype) &&
View Full Code Here

Examples of com.sun.star.text.XTextRange

  static void testWriter(XComponent rCmp) throws IOException {
    XTextDocument rTextDoc = UnoRuntime.queryInterface(XTextDocument.class, rCmp);

    XText rText = UnoRuntime.queryInterface(XText.class, rTextDoc.getText());
    XTextCursor rCursor = UnoRuntime.queryInterface(XTextCursor.class, rText.createTextCursor());
    XTextRange rRange = UnoRuntime.queryInterface(XTextRange.class, rCursor);

    byte pcText[] = new byte[1024];
    pcText[0] = 0;
    System.err.println("pleast type any text\n");
    while(true)  {
View Full Code Here

Examples of com.sun.star.text.XTextRange

        // we need its XTextRange which is available from getAnchor(),
        // so query for XTextContent
        XTextContent xBookmarkContent = (XTextContent)UnoRuntime.queryInterface(
            XTextContent.class, bookmark);
        // get the anchor of the bookmark (its XTextRange)
        XTextRange xBookmarkRange = xBookmarkContent.getAnchor();
        // set string at the bookmark position
        xBookmarkRange.setString("subscription for the Manatee Journal");
  
    }
View Full Code Here

Examples of com.sun.star.text.XTextRange

    protected void TextRangeExample ()
    {
            try
            {
                    // Get a text range refering to the beginning of the text document
                    XTextRange xStart = mxDocText.getStart();
                    // use setString to insert text at the beginning
                    xStart.setString ( "This is text inserted at the beginning.\n\n" );
                    // Get a text range refering to the end of the text document
                    XTextRange xEnd = mxDocText.getEnd();
                    // use setString to insert text at the end
                    xEnd.setString ( "This is text inserted at the end.\n\n" );
            }
            catch ( Exception e )
            {
                    e.printStackTrace ( System.out );
            }
View Full Code Here

Examples of com.sun.star.text.XTextRange

                    // Get the XSimpleText interface to the Footnote
                    XSimpleText xSimple = (XSimpleText ) UnoRuntime.queryInterface (
                            XSimpleText.class, xNumbers );

                    // Create a text cursor for the foot note text
                    XTextRange xRange = (XTextRange ) UnoRuntime.queryInterface (
                            XTextRange.class, xSimple.createTextCursor() );

                    // And insert the actual text of the footnote.
                    xSimple.insertString (
                            xRange, "  The numbers were generated by using java.util.Random", false );
View Full Code Here

Examples of com.sun.star.text.XTextRange

                XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(
                    XServiceInfo.class, xTextElement );
               
                // check ifs the current paragraph really a paragraph or an anchor of a frame or picture
                if( xServiceInfo.supportsService("com.sun.star.text.Paragraph") ) {
                    XTextRange xTextRange = xTextElement.getAnchor();
                    System.out.println( "This is a Paragraph" );
                   
                    // create another enumeration to get all text portions of the paragraph
                    xParaEnumerationAccess = (XEnumerationAccess) UnoRuntime.queryInterface(
                        XEnumerationAccess.class, xTextElement );
                    xTextPortionEnum = xParaEnumerationAccess.createEnumeration();
                   
                    while ( xTextPortionEnum.hasMoreElements() ) {
                        XTextRange xTextPortion = (XTextRange) UnoRuntime.queryInterface(
                            XTextRange.class, xTextPortionEnum.nextElement());
                        System.out.println( "Text from the portion : " + xTextPortion.getString() );
                       
                        XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(
                            XPropertySet.class, xTextPortion );
                        System.out.println( "Name of the font : " + xPropertySet.getPropertyValue( "CharFontName" ) );
                       
View Full Code Here

Examples of com.sun.star.text.XTextRange

                   
                    // Getting the text cursor
                    XTextCursor xtextcursor = xsimpletext.createTextCursor();
                   
                    // Querying for the interface XTextRange
                    XTextRange xtextrange = ( XTextRange )
                    UnoRuntime.queryInterface( XTextRange.class, xtextcursor );
                   
                    // Getting the bug ID from the cell
                    String stringBugID = xtextrange.getString();                   
                    if ( !stringBugID.startsWith( "http://so-web1.germany.sun.com/bis/servlet/" +
                                                  "intray.ControlPanel?system=1&update=true&id=" ) ) {
                        String stringBugIDLink = "http://so-web1.germany.sun.com/bis/servlet/" +
                            "intray.ControlPanel?system=1&update=true&id=" + stringBugID +
                            "&showframeset=true";
                       
                        // Querying for the interface XMultiServiceFactory
                        XMultiServiceFactory xmultiservicefactoryTextField =
                            (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,
                                                                            aInstance );
                       
                        // Creating an instance of the text field URL
                        Object objectTextField =
                            xmultiservicefactoryTextField.createInstance(
                                "com.sun.star.text.TextField.URL" );
                       
                        // Querying for the interface XTextField
                        XTextField xtextfield = ( XTextField )
                            UnoRuntime.queryInterface( XTextField.class,
                                                       objectTextField );
                       
                        // Querying for the interface XPropertySet
                        XPropertySet xpropertysetTextField = ( XPropertySet )
                            UnoRuntime.queryInterface( XPropertySet.class,
                                                       xtextfield );
                       
                        // Setting the URL
                        xpropertysetTextField.setPropertyValue( "URL", stringBugIDLink );
                       
                        // Setting the representation of the URL
                        xpropertysetTextField.setPropertyValue( "Representation", stringBugID );
                       
                        // Querying for the interface XText
                        XText xtext = ( XText )UnoRuntime.queryInterface( XText.class, xcell );
                       
                        // Delete cell content
                        xtextrange.setString( "" );
                       
                        // Inserting the text field URL to the cell
                        xtext.insertTextContent( xtextrange, xtextfield, false );
                    }
                }
View Full Code Here

Examples of com.sun.star.text.XTextRange

         * @param intRow Number of row.
         * @param intColumn Number of column.
         * @return String from the specified cell.
         */
        public String getStringFromCell( XCellRange xcellrange, int intRow, int intColumn ) {
            XTextRange xtextrangeStartDate = null;
           
            try {
                // Getting the cell holding the information about the start date
                XCell xcellStartDate = xcellrange.getCellByPosition( intColumn, intRow );
                // Querying for the interface XTextRange on the XCell
                xtextrangeStartDate = (XTextRange)
                    UnoRuntime.queryInterface( XTextRange.class, xcellStartDate );
            }
            catch( Exception exception ) {
                this.showExceptionMessage( exception );
            }
           
            // Getting the start date
            return( xtextrangeStartDate.getString().trim() );
        }
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.