Package com.sun.star.text

Examples of com.sun.star.text.XTextRange


        XMetadatable xMetadatable = (XMetadatable)
            UnoRuntime.queryInterface(XMetadatable.class, xMeta);
        xMetadatable.setMetadataReference(met1.getXmlId());
        XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta);
        XTextRange xStart = null;
        XTextRange xEnd = null;

        {
            xStart = xText.getStart();
            xEnd = xText.getEnd();
View Full Code Here


                    "P" + nPara + "word" + nBookmark);
                XTextCursor xWordCrsr = xText.createTextCursor();
                xWordCrsr.setString(" ");
            }
            XTextCursor xParaCrsr = xText.createTextCursor();
            XTextRange xParaCrsrAsRange = (XTextRange)UnoRuntime.queryInterface(
                XTextRange.class,
                xParaCrsr);
            xText.insertControlCharacter(xParaCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
        }
    }
View Full Code Here

        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

            throw new StatusException("Couldn't get HeaderContent", e);
        }

        XText center = RPHC.getCenterText();

        XTextRange text_to_move = null;

        log.println( "inserting some lines" );
        try {
            XTextCursor oCursor = center.createTextCursor();
            center.insertControlCharacter(
View Full Code Here

        // fill the cells which we just bound the listbox to
        XCellRange exchangeSheet = document.getSheet( listSourceSheet );
        String[] listContent = new String[] { "first", "second", "third", "forth", "fivth" };
        for ( short row = topRow; row <= bottomRow; ++row )
        {
            XTextRange cellText = (XTextRange)UnoRuntime.queryInterface(
                XTextRange.class, exchangeSheet.getCellByPosition( column, row ) );
            cellText.setString( listContent[row] );
        }

        // some coloring
        XPropertySet exchangeCell = UNO.queryPropertySet(
            document.getSheet( sheet ).getCellByPosition( exchangeColumn, exchangeRow )
View Full Code Here

                   
                    // 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 sBugID = xtextrange.getString();                   
                    if ( !sBugID.startsWith(
                             "http://www.openoffice.org/issues/show_bug.cgi?id=") ) {
                        String sBugIDLink =
                            "http://www.openoffice.org/issues/show_bug.cgi?id=" + sBugID;
                       
                        // Querying for the interface XMultiServiceFactory
                        XMultiServiceFactory xMSFTextField =
                            (XMultiServiceFactory)UnoRuntime.queryInterface(
                                XMultiServiceFactory.class, aInstance );
                       
                        // Creating an instance of the text field URL
                        Object objectTextField =
                            xMSFTextField.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",
                                                                sBugIDLink );
                       
                        // Setting the representation of the URL
                        xpropertysetTextField.setPropertyValue( "Representation",
                                                                sBugID );
                       
                        // 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

         * @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

            try {
                // Getting the cell holding the information on the day to start
                XCell xcellStartDate = xcellrange.getCellByPosition(intColumn,
                                                                    intRow);
                // Querying for the interface XTextRange on the XCell
                XTextRange xtextrange = (XTextRange)
                    UnoRuntime.queryInterface(XTextRange.class, xcellStartDate);
                // Setting the new start date
                xtextrange.setString( sDate );
            }
            catch( Exception exception ) {
                this.showExceptionMessage( exception );
            }
        }
View Full Code Here

    {
        // getting the text document object
        XTextDocument xTextDocument = createDocument(ctxt);

        XText xText = xTextDocument.getText();
        XTextRange xTextRange = xText.getEnd();
        xTextRange.setString("Hello");
    }
View Full Code Here

    if ( bNewParagraph == true )
    {
      xText.insertControlCharacter( xTextCursor, ControlCharacter.PARAGRAPH_BREAK, false );
      xTextCursor.gotoEnd( false );
    }
    XTextRange xTextRange = (XTextRange)
      UnoRuntime.queryInterface( XTextRange.class, xTextCursor );
    xTextRange.setString( sText );
    xTextCursor.gotoEnd( true );
    XPropertySet xPropSet = (XPropertySet)
      UnoRuntime.queryInterface( XPropertySet.class, xTextRange );
    return xPropSet;
  }
View Full Code Here

TOP

Related Classes of com.sun.star.text.XTextRange

Copyright © 2018 www.massapicom. 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.