Package com.sun.star.text

Examples of com.sun.star.text.XParagraphCursor


                                            break;
                                    }
                            }
                    }
                    // Get the XParagraphCursor interface of our text cursro
                    XParagraphCursor xParaCursor = (XParagraphCursor)
                            UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor );
                    // Go to the end of the document, then select the preceding paragraphs
                    mxDocCursor.gotoEnd ( false );
                    xParaCursor.gotoPreviousParagraph ( false );
                    xParaCursor.gotoPreviousParagraph ( true );
                    xParaCursor.gotoPreviousParagraph ( true );

                    // Get the XPropertySet of the cursor's currently selected text
                    XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(
                            XPropertySet.class, mxDocCursor );
View Full Code Here


                    XTextContent xChildSection = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xChildNamed );
                    mxDocText.insertTextContent ( mxDocCursor, xChildSection, false );

                    // Access the XParagraphCursor interface of our text cursor
                    XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface(
                            XParagraphCursor.class, mxDocCursor );

                    // Go back one paragraph (into Child_Section)
                    xParaCursor.gotoPreviousParagraph ( false );

                    // Insert a string into the Child_Section
                    mxDocText.insertString ( mxDocCursor, "This is a test", false );

                    // Go to the end of the document
                    mxDocCursor.gotoEnd( false );

                    // Go back two paragraphs
                    xParaCursor.gotoPreviousParagraph ( false );
                    xParaCursor.gotoPreviousParagraph ( false );
                    // Go to the end of the document, selecting the two paragraphs
                    mxDocCursor.gotoEnd ( true );

                    // Create another text section and access it's XNamed interface
                    XNamed xParentNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                                    mxDocFactory.createInstance( "com.sun.star.text.TextSection" ) );

                    // Set this text section's name to Parent_Section
                    xParentNamed.setName ( "Parent_Section" );

                    // Access the Parent_Section's XTextContent interface ...
                    XTextContent xParentSection = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xParentNamed );
                    // ...and insert it into the document
                    mxDocText.insertTextContent ( mxDocCursor, xParentSection, false );

                    // Go to the end of the document
                    mxDocCursor.gotoEnd ( false );
                    // Insert a new paragraph
                    mxDocText.insertControlCharacter (
                            mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false );
                    // And select the new pargraph
                    xParaCursor.gotoPreviousParagraph ( true );

                    // Create a new Text Section and access it's XNamed interface
                    XNamed xLinkNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class,
                            mxDocFactory.createInstance( "com.sun.star.text.TextSection" ) );
                    // Set the new text section's name to Linked_Section
View Full Code Here

        doTest(root, false);

        XText xDocText = m_xDoc.getText();
        XTextCursor xDocTextCursor = xDocText.createTextCursor();
        XParagraphCursor xParagraphCursor = (XParagraphCursor)
            UnoRuntime.queryInterface(XParagraphCursor.class, xDocTextCursor);
        xParagraphCursor.gotoNextParagraph(false); // second paragraph
        // X12XX34X56X78X9
        // 1  23  4  5  6
        //  1       452  6
        //            3
        StringPair [] nestedTextContent = new StringPair[] {
View Full Code Here

        bSuccess = xSentenceCursor.gotoEndOfSentence(false);
        assure("gotoEndOfSentence(): succeeded", !bSuccess);
        bSuccess = xSentenceCursor.gotoStartOfSentence(false);
        assure("gotoStartOfSentence(): succeeded", !bSuccess);

        XParagraphCursor xParagraphCursor = (XParagraphCursor)
            UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);

        // XParagraphCursor (does not make sense)
        bSuccess = xParagraphCursor.gotoNextParagraph(false);
        assure("gotoNextParagraph(): succeeded", !bSuccess);
        bSuccess = xParagraphCursor.gotoPreviousParagraph(false);
        assure("gotoPreviousParagraph(): succeeded", !bSuccess);
        bSuccess = xParagraphCursor.gotoStartOfParagraph(false);
        assure("gotoStartOfParagraph(): succeeded", !bSuccess);
        bSuccess = xParagraphCursor.gotoEndOfParagraph(false);
        assure("gotoEndOfParagraph(): succeeded", !bSuccess);
    }
View Full Code Here

TOP

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

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.