Package com.sun.star.text

Examples of com.sun.star.text.XTextContent


    public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor)
    {
        try
        {
            com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable");
            XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextTable);
            if (xTextCursor == null)
            {
                xTextCursor = xTextDocument.getText().createTextCursor();
                xTextCursor.gotoEnd(false);
            }
View Full Code Here


    public void removeTextTable(Object oTextTable)
    {
        try
        {
            XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTable);
            xTextDocument.getText().removeTextContent(xTextContentTable);
        }
        catch (Exception exception)
        {
            exception.printStackTrace(System.out);
View Full Code Here

    {
        try
        {
            XInterface xField = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextField.User");
            XDependentTextField xDepField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, xField);
            XTextContent xFieldContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xField);
            if (xTextFieldsSupplier.getTextFieldMasters().hasByName("com.sun.star.text.FieldMaster.User." + FieldName))
            {
                Object oMaster = xTextFieldsSupplier.getTextFieldMasters().getByName("com.sun.star.text.FieldMaster.User." + FieldName);
                XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oMaster);
                xComponent.dispose();
View Full Code Here

    public XNamed addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue) {
    XNamed xNamedTextSection = null;
    try {
        XInterface xTextSection = (XInterface) CurReportDocument.xMSFDoc.createInstance("com.sun.star.text.TextSection");
        XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
        xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection);
        xTextCursor.gotoEnd(false);
        xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true);
        Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion);
        if (CurDBColumn != null){
View Full Code Here

    public XNamed addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue) {
    XNamed xNamedTextSection = null;
    try {
        XInterface xTextSection = (XInterface) CurReportDocument.xMSFDoc.createInstance("com.sun.star.text.TextSection");
        XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
        xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection);
        xTextCursor.gotoEnd(false);
        xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true);
        Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion);
        if (CurDBColumn != null){
View Full Code Here

     * @param oTextContent
     * @return
     */
    public boolean removeTextContent(Object oTextContent){
        try {
            XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextContent);
            xText.removeTextContent(xTextContent);
            return true;
        } catch (NoSuchElementException e) {
            e.printStackTrace(System.out);
            return false;
View Full Code Here

        String[] sTableNames = xNameAccessTextTables.getElementNames();
        for (int i = 0; i < sTableNames.length; i++){
            String sTableName = sTableNames[i];
            if (JavaTools.FieldInList(sLayoutTableNames, sTableName) > -1){        
                if (!sTableName.equals(sLayoutTableNames[0])){
                    XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
                        boolean bleaveloop = false;
                        while (!bleaveloop){
                            try{
//                                xRelativeTextContentRemove.removeTextContentBefore(xTextContent);
                        xRelativeTextContentRemove.removeTextContentAfter(xTextContent);
View Full Code Here

       
        // find the bookmark named "Subscription"
        Object bookmark = xNamedBookmarks.getByName("Subscription");
        // 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

                    // Again, the Level property _must_ be set
                    xIndex.setPropertyValue ( "Level", new Short ( (short) 10 ) );

                    // Access the XTextContent interfaces of both the Index and the IndexMark
                    XTextContent xIndexContent = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xIndex );
                    XTextContent xEntryContent = (XTextContent) UnoRuntime.queryInterface(
                            XTextContent.class, xEntry );

                    // Insert both in the document
                    mxDocText.insertTextContent ( mxDocCursor, xEntryContent, false );
                    mxDocText.insertTextContent ( mxDocCursor, xIndexContent, false );
View Full Code Here

                    // Get a text cursor for the first cell
                    XTextCursor xTableCursor = xTableText.createTextCursor();

                    // Get the XTextContent interface of the reference mark so we can insert it
                    XTextContent xContent = ( XTextContent ) UnoRuntime.queryInterface (
                            XTextContent.class, xRefMark );

                    // Insert the reference mark into the first cell of the table
                    xTableText.insertTextContent ( xTableCursor, xContent, false );

                    // Create a 'GetReference' text field to refer to the reference mark we just inserted,
                    // and get it's XPropertySet interface
                    XPropertySet xFieldProps = (XPropertySet) UnoRuntime.queryInterface(
                            XPropertySet.class, mxDocFactory.createInstance (
                                    "com.sun.star.text.TextField.GetReference" ) );

                    // Get the XReferenceMarksSupplier interface of the document
                    XReferenceMarksSupplier xRefSupplier = ( XReferenceMarksSupplier )
                            UnoRuntime.queryInterface( XReferenceMarksSupplier.class, mxDoc );

                    // Get an XNameAccess which refers to all inserted reference marks
                    XNameAccess xMarks = ( XNameAccess ) UnoRuntime.queryInterface ( XNameAccess.class,
                                                            xRefSupplier.getReferenceMarks() );

                    // Put the names of each reference mark into an array of strings
                    String[] aNames = xMarks.getElementNames();

                    // Make sure that at least 1 reference mark actually exists
                    // (well, we just inserted one!)
                    if ( aNames.length > 0 )
                    {
                            // Output the name of the first reference mark ('TableHeader')
                            System.out.println ( "GetReference text field inserted for ReferenceMark : "
                                                    + aNames[0] );

                            // Set the SourceName of the GetReference text field to 'TableHeader'
                            xFieldProps.setPropertyValue ( "SourceName", aNames[0] );

                            // specify that the source is a reference mark (could also be a footnote,
                            // bookmark or sequence field )
                            xFieldProps.setPropertyValue ( "ReferenceFieldSource", new Short (
                                    ReferenceFieldSource.REFERENCE_MARK ) );

                            // We want the reference displayed as 'above' or 'below'
                            xFieldProps.setPropertyValue ( "ReferenceFieldPart",
                                    new Short (ReferenceFieldPart.UP_DOWN ) );

                            // Get the XTextContent interface of the GetReference text field
                            XTextContent xRefContent = (XTextContent) UnoRuntime.queryInterface(
                                    XTextContent.class, xFieldProps );

                            // Go to the end of the document
                            mxDocCursor.gotoEnd( false );
View Full Code Here

TOP

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

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.