Package com.sun.star.text

Examples of com.sun.star.text.XText


        } catch ( com.sun.star.container.ElementExistException e ) {
            e.printStackTrace(log);
            throw new StatusException( "Couldn't create environment ", e );
        }

        XText oText = xTextDoc.getText();
        XTextCursor oCursor = oText.createTextCursor();
        XPropertySet xProp = (XPropertySet)
            UnoRuntime.queryInterface(XPropertySet.class, oCursor);
        try {
            xProp.setPropertyValue("ParaStyleName", oMyStyle.getName());
        } catch ( com.sun.star.lang.WrappedTargetException e ) {
View Full Code Here


        } catch (com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't get HeaderContent", e);
        }

        XText left = RPHC.getLeftText();

        XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
            UnoRuntime.queryInterface(
                XMultiServiceFactory.class,
                xSpreadsheetDoc );

        XTextContent the_Field = null;
        try {
            oObj = (XInterface)
                oDocMSF.createInstance( "com.sun.star.text.TextField.Time" );

            the_Field = (XTextContent)
                UnoRuntime.queryInterface(XTextContent.class,oObj);

            aField = (XInterface)
                oDocMSF.createInstance("com.sun.star.text.TextField.Date");
        } catch(com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create instance", e);
        }

        oContent = (XTextContent)
            UnoRuntime.queryInterface(XTextContent.class, aField);

        XTextCursor the_Cursor = left.createTextCursor();

        try {
            left.insertTextContent(the_Cursor,the_Field, false);
            PropSet.setPropertyValue("RightPageHeaderContent", RPHC);
        } catch(com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create a test environment", e);
        } catch(com.sun.star.lang.WrappedTargetException e) {
View Full Code Here

        } catch ( com.sun.star.lang.IllegalArgumentException e ) {
            log.println("Exception occured while getting style property");
            e.printStackTrace(log);
        }

        XText oText = xTextDoc.getText();
        XTextCursor oCursor = oText.createTextCursor();

        log.println( "inserting some text to text document..." );
        try {
            for (int i =0; i < 5; i++){
                oText.insertString( oCursor,"Paragraph Number: " + i, false);
                oText.insertString( oCursor,
                    "The quick brown fox jumps over the lazy Dog: SwXParagraph",
                    false);
                oText.insertControlCharacter( oCursor,
                    ControlCharacter.PARAGRAPH_BREAK, false );
                oText.insertString( oCursor,
                    "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: SwXParagraph",
                    false);
                oText.insertControlCharacter( oCursor,
                    ControlCharacter.PARAGRAPH_BREAK, false );
                oText.insertControlCharacter( oCursor,
                    ControlCharacter.LINE_BREAK, false );
            }
        } catch ( com.sun.star.lang.IllegalArgumentException e ){
            log.println("Exception occured while inserting Text");
            e.printStackTrace(log);
View Full Code Here

            oTable = (XTextTable) SOF.createTextTable(xTextDoc,5,5);
        } catch( Exception e ) {
            e.printStackTrace(log);
        }

        XText oText = xTextDoc.getText();

        XTextCursor oCursor = oText.createTextCursor();

        try {
            log.println("inserting texttable");
            oText.insertTextContent(oCursor, oTable, false);
        } catch (Exception e) {
            log.println("Exception!");
        }

        try {
View Full Code Here

    protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {

        XInterface oObj = null;
        XInterface oTS = null;
        XTextSection xTS = null;
        XText oText = null;
        XTextColumns TC = null;
        Object instance = null;

        log.println( "creating a test environment" );

        oText = xTextDoc.getText();
            XTextCursor oCursor = oText.createTextCursor();

        XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
            UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc);

        try {
            XTextSectionsSupplier oTSSupp = (XTextSectionsSupplier)
            UnoRuntime.queryInterface
                    ( XTextSectionsSupplier.class, xTextDoc );
            XNameAccess oTSSuppName = oTSSupp.getTextSections();

            //cleanup if necessary
            if (oTSSuppName.hasByName("SwXTextSection")) {
                XTextSection old = (XTextSection) AnyConverter.toObject(
                    new Type(XTextSection.class),
                        oTSSuppName.getByName("SwXTextSection"));
                XComponent oldC = (XComponent)
                        UnoRuntime.queryInterface(XComponent.class,old);
                oldC.dispose();
                oText.setString("");
            }

            //insert two sections parent and child
            oTS = (XInterface) oDocMSF.createInstance
                    ("com.sun.star.text.TextSection");
            instance = oDocMSF.createInstance("com.sun.star.text.TextSection");
            XTextContent oTSC = (XTextContent)
                    UnoRuntime.queryInterface(XTextContent.class, oTS);
            oText.insertTextContent(oCursor, oTSC, false);
            XWordCursor oWordC = (XWordCursor)
                UnoRuntime.queryInterface(XWordCursor.class, oCursor);
            oCursor.setString("End of TextSection");
            oCursor.gotoStart(false);
            oCursor.setString("Start of TextSection ");
            oWordC.gotoEndOfWord(false);
            XInterface oTS2 = (XInterface) oDocMSF.createInstance
                ("com.sun.star.text.TextSection");
            oTSC = (XTextContent)UnoRuntime.queryInterface(XTextContent.class, oTS2);
            oText.insertTextContent(oCursor, oTSC, false);

            XIndexAccess oTSSuppIndex = (XIndexAccess)
            UnoRuntime.queryInterface(XIndexAccess.class, oTSSuppName);

            log.println( "getting a TextSection with the XTextSectionSupplier()" );
View Full Code Here

        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create footnote", e);
        }

        XText oText = xTextDoc.getText();
        XTextCursor oCursor = oText.createTextCursor();

        log.println("inserting the footnote into text document");
        try {
            oText.insertTextContent(oCursor, oFootnote, false);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't insert the footnote", e);
        }
View Full Code Here

        catch ( com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create the Index", e);
        }

        XText oText = xTextDoc.getText();
        XTextCursor oCursor = oText.createTextCursor();

        log.println("inserting the Index into text document");
        try {
            oText.insertTextContent(oCursor, xTC, false);
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't insert the Index", e);
        }
View Full Code Here

            SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory)tParam.getMSF()) ;
            XShape oShape = SOF.createShape
                (xDrawDoc,5000,3500,7500,5000,"Text");
            DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ;

            XText text = (XText) UnoRuntime.queryInterface(XText.class, oShape) ;

            XTextCursor cursor = text.createTextCursor() ;

            text.insertString(cursor, "Paragraph 1", false) ;
            text.insertControlCharacter(cursor,
                ControlCharacter.PARAGRAPH_BREAK, false) ;
            text.insertString(cursor, "Paragraph 2", false) ;
            text.insertControlCharacter(cursor,
                ControlCharacter.PARAGRAPH_BREAK, false) ;
            text.insertString(cursor, "Paragraph 3", false) ;
            text.insertControlCharacter(cursor,
                ControlCharacter.PARAGRAPH_BREAK, false) ;

            oObj = cursor ;

        } catch (Exception e) {
View Full Code Here

        XTextCursor the_Cursor = null;
       
          // create testobject here
        try {

            XText the_Text = (XText) UnoRuntime.queryInterface(XText.class,oShape);
            XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
                UnoRuntime.queryInterface( XMultiServiceFactory.class, xDrawDoc );
            the_Cursor = the_Text.createTextCursor();
            oObj = (XInterface)
                oDocMSF.createInstance( "com.sun.star.text.TextField.DateTime" );
            XTextContent the_Field = (XTextContent)
                             UnoRuntime.queryInterface(XTextContent.class,oObj);


            the_Text.insertTextContent(the_Cursor,the_Field,false);
        }
        catch (Exception ex) {
            log.println("Couldn't create Textfield");
            ex.printStackTrace(log);
            throw new StatusException("Couldn't create TextField ",ex);
View Full Code Here

        TestParameters Param, PrintWriter log) {

        XInterface oObj = null;
        XTextFrame oFrame1 = null;
        XPropertySet oPropSet = null;
        XText oText = null;
        XTextCursor oCursor = null;

        // get a soffice factory object
        SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF() );
        // creating Frames
        log.println( "creating Frames" );
        try {
            oFrame1 = SOF.createTextFrame(xTextDoc, 500, 500);
            oPropSet = (XPropertySet)UnoRuntime.queryInterface(
                XPropertySet.class, oFrame1 );
            oPropSet.setPropertyValue("AnchorType",
                TextContentAnchorType.AS_CHARACTER);
            oText = xTextDoc.getText();
            oCursor = oText.createTextCursor();

            log.println( "inserting Frame1" );
            XTextContent the_content = (XTextContent)
                UnoRuntime.queryInterface(XTextContent.class, oFrame1);
            oText.insertTextContent(oCursor, the_content, true);
        } catch (Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't insert TextFrame", e);
        }
View Full Code Here

TOP

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

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.