Package com.sun.star.text

Examples of com.sun.star.text.XTextTableCursor


                // Put a description of the table contents into the first cell
                insertIntoCell( "A1", "AutoText Groups", xTable);
               
                // Create a table cursor pointing at the second cell in the first
                // column
                XTextTableCursor xTableCursor = xTable.createCursorByCellName("A2");

                // Loop over the group names
                for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                {
                    // Get the name of the current cell
                    String sCellName = xTableCursor.getRangeName ();
                   
                    // Get the XText interface of the current cell
                    XText xCellText = (XText) UnoRuntime.queryInterface (
                        XText.class, xTable.getCellByName ( sCellName ) );
                   
                    // Set the cell contents of the current cell to be
                    //the name of the of an autotext group
                    xCellText.setString ( aGroupNames[i] );
                   
                    // Access the autotext group with this name
                    XAutoTextGroup xGroup = (XAutoTextGroup)
                        UnoRuntime.queryInterface (XAutoTextGroup.class,
                                       xContainer.getByName(aGroupNames[i]));

                    // Get the titles of each autotext block in this group
                    String [] aBlockNames = xGroup.getTitles();
                   
                    // Make sure that the autotext group contains at least one block
                    if ( aBlockNames.length > 0 )
                    {
                        // Split the current cell vertically into two seperate cells
                        xTableCursor.splitRange ( (short) 1, false );
                       
                        // Put the cursor in the newly created right hand cell
                        // and select it
                        xTableCursor.goRight ( (short) 1, false );
                       
                        // Split this cell horizontally to make a seperate cell
                        // for each Autotext block
                        if ( ( aBlockNames.length -1 ) > 0 )
                            xTableCursor.splitRange (
                                (short) (aBlockNames.length - 1), true );
                       
                        // loop over the block names
                        for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                        {
                            // Get the XText interface of the current cell
                            xCellText = (XText) UnoRuntime.queryInterface (
                                XText.class, xTable.getCellByName (
                                    xTableCursor.getRangeName() ) );
                           
                            // Set the text contents of the current cell to the
                            // title of an Autotext block
                            xCellText.setString ( aBlockNames[j] );
                           
                            // Move the cursor down one cell
                            xTableCursor.goDown( (short)1, false);
                        }
                    }
                    // Go back to the cell we originally split
                    xTableCursor.gotoCellByName ( sCellName, false );
                   
                                    // Go down one cell
                    xTableCursor.goDown( (short)1, false);
                }
               
                XAutoTextGroup xGroup;
                String [] aBlockNames;
               
View Full Code Here


                            // Put a description of the table contents into the first cell
                            insertIntoCell( "A1", "AutoText Groups", xTable);

                            // Create a table cursor pointing at the second cell in the first column
                            XTextTableCursor xTableCursor = xTable.createCursorByCellName ( "A2" );

                            // Loop over the group names
                            for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                            {
                                    // Get the name of the current cell
                                    String sCellName = xTableCursor.getRangeName ();

                                    // Get the XText interface of the current cell
                                    XText xCellText = (XText) UnoRuntime.queryInterface (
                                            XText.class, xTable.getCellByName ( sCellName ) );

                                    // Set the cell contents of the current cell to be
                                    //the name of the of an autotext group
                                    xCellText.setString ( aGroupNames[i] );

                                    // Access the autotext gruop with this name
                                    XAutoTextGroup xGroup = ( XAutoTextGroup ) UnoRuntime.queryInterface (
                                            XAutoTextGroup.class,xContainer.getByName(aGroupNames[i]));

                                    // Get the titles of each autotext block in this group
                                    String [] aBlockNames = xGroup.getTitles();

                                    // Make sure that the autotext group contains at least one block
                                    if ( aBlockNames.length > 0 )
                                    {
                                            // Split the current cell vertically into two seperate cells
                                            xTableCursor.splitRange ( (short) 1, false );

                                            // Put the cursor in the newly created right hand cell
                                            // and select it
                                            xTableCursor.goRight ( (short) 1, false );

                                            // Split this cell horizontally to make a seperate cell
                                            // for each Autotext block
                                            if ( ( aBlockNames.length -1 ) > 0 )
                                                    xTableCursor.splitRange (
                                                            (short) (aBlockNames.length - 1), true );

                                            // loop over the block names
                                            for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                                            {
                                                    // Get the XText interface of the current cell
                                                    xCellText = (XText) UnoRuntime.queryInterface (
                                                            XText.class, xTable.getCellByName (
                                                                    xTableCursor.getRangeName() ) );

                                                    // Set the text contents of the current cell to the             // title of an Autotext block
                                                    xCellText.setString ( aBlockNames[j] );

                                                    // Move the cursor down one cell
                                                    xTableCursor.goDown( (short)1, false);
                                            }
                                    }
                                    // Go back to the cell we originally split
                                    xTableCursor.gotoCellByName ( sCellName, false );

                                    // Go down one cell
                                    xTableCursor.goDown( (short)1, false);
                            }

                            XAutoTextGroup xGroup;
                            String [] aBlockNames;
View Full Code Here

                // Put a description of the table contents into the first cell
                insertIntoCell( "A1", "AutoText Groups", xTable);
               
                // Create a table cursor pointing at the second cell in the first
                // column
                XTextTableCursor xTableCursor = xTable.createCursorByCellName("A2");

                // Loop over the group names
                for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                {
                    // Get the name of the current cell
                    String sCellName = xTableCursor.getRangeName ();
                   
                    // Get the XText interface of the current cell
                    XText xCellText = (XText) UnoRuntime.queryInterface (
                        XText.class, xTable.getCellByName ( sCellName ) );
                   
                    // Set the cell contents of the current cell to be
                    //the name of the of an autotext group
                    xCellText.setString ( aGroupNames[i] );
                   
                    // Access the autotext group with this name
                    XAutoTextGroup xGroup = (XAutoTextGroup)
                        UnoRuntime.queryInterface (XAutoTextGroup.class,
                                       xContainer.getByName(aGroupNames[i]));

                    // Get the titles of each autotext block in this group
                    String [] aBlockNames = xGroup.getTitles();
                   
                    // Make sure that the autotext group contains at least one block
                    if ( aBlockNames.length > 0 )
                    {
                        // Split the current cell vertically into two seperate cells
                        xTableCursor.splitRange ( (short) 1, false );
                       
                        // Put the cursor in the newly created right hand cell
                        // and select it
                        xTableCursor.goRight ( (short) 1, false );
                       
                        // Split this cell horizontally to make a seperate cell
                        // for each Autotext block
                        if ( ( aBlockNames.length -1 ) > 0 )
                            xTableCursor.splitRange (
                                (short) (aBlockNames.length - 1), true );
                       
                        // loop over the block names
                        for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                        {
                            // Get the XText interface of the current cell
                            xCellText = (XText) UnoRuntime.queryInterface (
                                XText.class, xTable.getCellByName (
                                    xTableCursor.getRangeName() ) );
                           
                            // Set the text contents of the current cell to the
                            // title of an Autotext block
                            xCellText.setString ( aBlockNames[j] );
                           
                            // Move the cursor down one cell
                            xTableCursor.goDown( (short)1, false);
                        }
                    }
                    // Go back to the cell we originally split
                    xTableCursor.gotoCellByName ( sCellName, false );
                   
                                    // Go down one cell
                    xTableCursor.goDown( (short)1, false);
                }
               
                XAutoTextGroup xGroup;
                String [] aBlockNames;
               
View Full Code Here

                // Put a description of the table contents into the first cell
                insertIntoCell( "A1", "AutoText Groups", xTable);
               
                // Create a table cursor pointing at the second cell in the first
                // column
                XTextTableCursor xTableCursor = xTable.createCursorByCellName("A2");

                // Loop over the group names
                for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                {
                    // Get the name of the current cell
                    String sCellName = xTableCursor.getRangeName ();
                   
                    // Get the XText interface of the current cell
                    XText xCellText = (XText) UnoRuntime.queryInterface (
                        XText.class, xTable.getCellByName ( sCellName ) );
                   
                    // Set the cell contents of the current cell to be
                    //the name of the of an autotext group
                    xCellText.setString ( aGroupNames[i] );
                   
                    // Access the autotext group with this name
                    XAutoTextGroup xGroup = (XAutoTextGroup)
                        UnoRuntime.queryInterface (XAutoTextGroup.class,
                                       xContainer.getByName(aGroupNames[i]));

                    // Get the titles of each autotext block in this group
                    String [] aBlockNames = xGroup.getTitles();
                   
                    // Make sure that the autotext group contains at least one block
                    if ( aBlockNames.length > 0 )
                    {
                        // Split the current cell vertically into two seperate cells
                        xTableCursor.splitRange ( (short) 1, false );
                       
                        // Put the cursor in the newly created right hand cell
                        // and select it
                        xTableCursor.goRight ( (short) 1, false );
                       
                        // Split this cell horizontally to make a seperate cell
                        // for each Autotext block
                        if ( ( aBlockNames.length -1 ) > 0 )
                            xTableCursor.splitRange (
                                (short) (aBlockNames.length - 1), true );
                       
                        // loop over the block names
                        for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                        {
                            // Get the XText interface of the current cell
                            xCellText = (XText) UnoRuntime.queryInterface (
                                XText.class, xTable.getCellByName (
                                    xTableCursor.getRangeName() ) );
                           
                            // Set the text contents of the current cell to the
                            // title of an Autotext block
                            xCellText.setString ( aBlockNames[j] );
                           
                            // Move the cursor down one cell
                            xTableCursor.goDown( (short)1, false);
                        }
                    }
                    // Go back to the cell we originally split
                    xTableCursor.gotoCellByName ( sCellName, false );
                   
                                    // Go down one cell
                    xTableCursor.goDown( (short)1, false);
                }
               
                XAutoTextGroup xGroup;
                String [] aBlockNames;
               
View Full Code Here

                            // Put a description of the table contents into the first cell
                            insertIntoCell( "A1", "AutoText Groups", xTable);

                            // Create a table cursor pointing at the second cell in the first column
                            XTextTableCursor xTableCursor = xTable.createCursorByCellName ( "A2" );

                            // Loop over the group names
                            for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                            {
                                    // Get the name of the current cell
                                    String sCellName = xTableCursor.getRangeName ();

                                    // Get the XText interface of the current cell
                                    XText xCellText = (XText) UnoRuntime.queryInterface (
                                            XText.class, xTable.getCellByName ( sCellName ) );

                                    // Set the cell contents of the current cell to be
                                    //the name of the of an autotext group
                                    xCellText.setString ( aGroupNames[i] );

                                    // Access the autotext gruop with this name
                                    XAutoTextGroup xGroup = ( XAutoTextGroup ) UnoRuntime.queryInterface (
                                            XAutoTextGroup.class,xContainer.getByName(aGroupNames[i]));

                                    // Get the titles of each autotext block in this group
                                    String [] aBlockNames = xGroup.getTitles();

                                    // Make sure that the autotext group contains at least one block
                                    if ( aBlockNames.length > 0 )
                                    {
                                            // Split the current cell vertically into two seperate cells
                                            xTableCursor.splitRange ( (short) 1, false );

                                            // Put the cursor in the newly created right hand cell
                                            // and select it
                                            xTableCursor.goRight ( (short) 1, false );

                                            // Split this cell horizontally to make a seperate cell
                                            // for each Autotext block
                                            if ( ( aBlockNames.length -1 ) > 0 )
                                                    xTableCursor.splitRange (
                                                            (short) (aBlockNames.length - 1), true );

                                            // loop over the block names
                                            for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                                            {
                                                    // Get the XText interface of the current cell
                                                    xCellText = (XText) UnoRuntime.queryInterface (
                                                            XText.class, xTable.getCellByName (
                                                                    xTableCursor.getRangeName() ) );

                                                    // Set the text contents of the current cell to the             // title of an Autotext block
                                                    xCellText.setString ( aBlockNames[j] );

                                                    // Move the cursor down one cell
                                                    xTableCursor.goDown( (short)1, false);
                                            }
                                    }
                                    // Go back to the cell we originally split
                                    xTableCursor.gotoCellByName ( sCellName, false );

                                    // Go down one cell
                                    xTableCursor.goDown( (short)1, false);
                            }

                            XAutoTextGroup xGroup;
                            String [] aBlockNames;
View Full Code Here

    public void selectRow(XController xController, int row) throws com.sun.star.uno.Exception {
        String[] cellNames = xTextTable.getCellNames();
        int colCount = xTextTable.getColumns().getCount();
        String firstCellName = cellNames[row * colCount];
        String lastCellName = cellNames[row * colCount + colCount - 1];
        XTextTableCursor xTextTableCursor = xTextTable.createCursorByCellName(firstCellName);
        xTextTableCursor.gotoCellByName(lastCellName, true);
        // It works only if XCellRange was created via cursor. why????
        if (firstCellName.equalsIgnoreCase(lastCellName)) {
            XCell cell = as(XCellRange.class, xTextTable).getCellByPosition(0, row);
            as(XSelectionSupplier.class, xController).select(new Any(new Type(XCell.class), cell));
        } else {
            XCellRange xCellRange = as(XCellRange.class, xTextTable).getCellRangeByName(xTextTableCursor.getRangeName());
            // and why do we need Any here?
            as(XSelectionSupplier.class, xController).select(new Any(new Type(XCellRange.class), xCellRange));
        }
    }
View Full Code Here

                // Put a description of the table contents into the first cell
                insertIntoCell( "A1", "AutoText Groups", xTable);
               
                // Create a table cursor pointing at the second cell in the first
                // column
                XTextTableCursor xTableCursor = xTable.createCursorByCellName("A2");

                // Loop over the group names
                for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                {
                    // Get the name of the current cell
                    String sCellName = xTableCursor.getRangeName ();
                   
                    // Get the XText interface of the current cell
                    XText xCellText = (XText) UnoRuntime.queryInterface (
                        XText.class, xTable.getCellByName ( sCellName ) );
                   
                    // Set the cell contents of the current cell to be
                    //the name of the of an autotext group
                    xCellText.setString ( aGroupNames[i] );
                   
                    // Access the autotext group with this name
                    XAutoTextGroup xGroup = (XAutoTextGroup)
                        UnoRuntime.queryInterface (XAutoTextGroup.class,
                                       xContainer.getByName(aGroupNames[i]));

                    // Get the titles of each autotext block in this group
                    String [] aBlockNames = xGroup.getTitles();
                   
                    // Make sure that the autotext group contains at least one block
                    if ( aBlockNames.length > 0 )
                    {
                        // Split the current cell vertically into two seperate cells
                        xTableCursor.splitRange ( (short) 1, false );
                       
                        // Put the cursor in the newly created right hand cell
                        // and select it
                        xTableCursor.goRight ( (short) 1, false );
                       
                        // Split this cell horizontally to make a seperate cell
                        // for each Autotext block
                        if ( ( aBlockNames.length -1 ) > 0 )
                            xTableCursor.splitRange (
                                (short) (aBlockNames.length - 1), true );
                       
                        // loop over the block names
                        for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                        {
                            // Get the XText interface of the current cell
                            xCellText = (XText) UnoRuntime.queryInterface (
                                XText.class, xTable.getCellByName (
                                    xTableCursor.getRangeName() ) );
                           
                            // Set the text contents of the current cell to the
                            // title of an Autotext block
                            xCellText.setString ( aBlockNames[j] );
                           
                            // Move the cursor down one cell
                            xTableCursor.goDown( (short)1, false);
                        }
                    }
                    // Go back to the cell we originally split
                    xTableCursor.gotoCellByName ( sCellName, false );
                   
                                    // Go down one cell
                    xTableCursor.goDown( (short)1, false);
                }
               
                XAutoTextGroup xGroup;
                String [] aBlockNames;
               
View Full Code Here

                // Put a description of the table contents into the first cell
                insertIntoCell( "A1", "AutoText Groups", xTable);
               
                // Create a table cursor pointing at the second cell in the first
                // column
                XTextTableCursor xTableCursor = xTable.createCursorByCellName("A2");

                // Loop over the group names
                for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                {
                    // Get the name of the current cell
                    String sCellName = xTableCursor.getRangeName ();
                   
                    // Get the XText interface of the current cell
                    XText xCellText = (XText) UnoRuntime.queryInterface (
                        XText.class, xTable.getCellByName ( sCellName ) );
                   
                    // Set the cell contents of the current cell to be
                    //the name of the of an autotext group
                    xCellText.setString ( aGroupNames[i] );
                   
                    // Access the autotext group with this name
                    XAutoTextGroup xGroup = (XAutoTextGroup)
                        UnoRuntime.queryInterface (XAutoTextGroup.class,
                                       xContainer.getByName(aGroupNames[i]));

                    // Get the titles of each autotext block in this group
                    String [] aBlockNames = xGroup.getTitles();
                   
                    // Make sure that the autotext group contains at least one block
                    if ( aBlockNames.length > 0 )
                    {
                        // Split the current cell vertically into two seperate cells
                        xTableCursor.splitRange ( (short) 1, false );
                       
                        // Put the cursor in the newly created right hand cell
                        // and select it
                        xTableCursor.goRight ( (short) 1, false );
                       
                        // Split this cell horizontally to make a seperate cell
                        // for each Autotext block
                        if ( ( aBlockNames.length -1 ) > 0 )
                            xTableCursor.splitRange (
                                (short) (aBlockNames.length - 1), true );
                       
                        // loop over the block names
                        for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                        {
                            // Get the XText interface of the current cell
                            xCellText = (XText) UnoRuntime.queryInterface (
                                XText.class, xTable.getCellByName (
                                    xTableCursor.getRangeName() ) );
                           
                            // Set the text contents of the current cell to the
                            // title of an Autotext block
                            xCellText.setString ( aBlockNames[j] );
                           
                            // Move the cursor down one cell
                            xTableCursor.goDown( (short)1, false);
                        }
                    }
                    // Go back to the cell we originally split
                    xTableCursor.gotoCellByName ( sCellName, false );
                   
                                    // Go down one cell
                    xTableCursor.goDown( (short)1, false);
                }
               
                XAutoTextGroup xGroup;
                String [] aBlockNames;
               
View Full Code Here

                            // Put a description of the table contents into the first cell
                            insertIntoCell( "A1", "AutoText Groups", xTable);

                            // Create a table cursor pointing at the second cell in the first column
                            XTextTableCursor xTableCursor = xTable.createCursorByCellName ( "A2" );

                            // Loop over the group names
                            for ( int i = 0 ; i < aGroupNames.length ; i ++ )
                            {
                                    // Get the name of the current cell
                                    String sCellName = xTableCursor.getRangeName ();

                                    // Get the XText interface of the current cell
                                    XText xCellText = (XText) UnoRuntime.queryInterface (
                                            XText.class, xTable.getCellByName ( sCellName ) );

                                    // Set the cell contents of the current cell to be
                                    //the name of the of an autotext group
                                    xCellText.setString ( aGroupNames[i] );

                                    // Access the autotext gruop with this name
                                    XAutoTextGroup xGroup = ( XAutoTextGroup ) UnoRuntime.queryInterface (
                                            XAutoTextGroup.class,xContainer.getByName(aGroupNames[i]));

                                    // Get the titles of each autotext block in this group
                                    String [] aBlockNames = xGroup.getTitles();

                                    // Make sure that the autotext group contains at least one block
                                    if ( aBlockNames.length > 0 )
                                    {
                                            // Split the current cell vertically into two seperate cells
                                            xTableCursor.splitRange ( (short) 1, false );

                                            // Put the cursor in the newly created right hand cell
                                            // and select it
                                            xTableCursor.goRight ( (short) 1, false );

                                            // Split this cell horizontally to make a seperate cell
                                            // for each Autotext block
                                            if ( ( aBlockNames.length -1 ) > 0 )
                                                    xTableCursor.splitRange (
                                                            (short) (aBlockNames.length - 1), true );

                                            // loop over the block names
                                            for ( int j = 0 ; j < aBlockNames.length ; j ++ )
                                            {
                                                    // Get the XText interface of the current cell
                                                    xCellText = (XText) UnoRuntime.queryInterface (
                                                            XText.class, xTable.getCellByName (
                                                                    xTableCursor.getRangeName() ) );

                                                    // Set the text contents of the current cell to the             // title of an Autotext block
                                                    xCellText.setString ( aBlockNames[j] );

                                                    // Move the cursor down one cell
                                                    xTableCursor.goDown( (short)1, false);
                                            }
                                    }
                                    // Go back to the cell we originally split
                                    xTableCursor.gotoCellByName ( sCellName, false );

                                    // Go down one cell
                                    xTableCursor.goDown( (short)1, false);
                            }

                            XAutoTextGroup xGroup;
                            String [] aBlockNames;
View Full Code Here

TOP

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

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.