Package ag.ion.bion.officelayer.text

Examples of ag.ion.bion.officelayer.text.ITextTableCellRange


        range = range
            + TextTableCellNameHelper
                .getColumnCharacter(lastCellName)
            + TextTableCellNameHelper
                .getRowCounterValue(lastCellName);
        ITextTableCellRange cellRange = getCellRange(range);
        ITextDocument textDocument = getTextDocument();
        if (textDocument.isOpen()) {
          XCell cell = getXTextTable().getCellByName(firstCell);
          XPropertySet xPropertySet = (XPropertySet) UnoRuntime
              .queryInterface(XPropertySet.class, cell);
          if (xPropertySet != null) {
            Object value = xPropertySet
                .getPropertyValue("TextSection");
            boolean select = true;
            XTextSection xTextSection = (XTextSection) UnoRuntime
                .queryInterface(XTextSection.class, value);
            if (xTextSection != null) {
              XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime
                  .queryInterface(XPropertySet.class,
                      xTextSection);
              if (xTextSectionPropertySet != null) {
                Boolean visible = (Boolean) xTextSectionPropertySet
                    .getPropertyValue("IsVisible");
                select = visible.booleanValue();
              }
            }
            if (select)
              textDocument
                  .setSelection(new XInterfaceObjectSelection(
                      cellRange.getXCellRange()));
          }
        }
      }
    } catch (Throwable throwable) {
      // no marking possible
View Full Code Here


      ITextTableRow[] rows = getRows();
      if(rows.length > 0) {
        ITextTableCell[] cells = rows[rows.length - 1].getCells();
        String lastCellName = cells[cells.length - 1].getName().getName();       
        range = range + TextTableCellNameHelper.getColumnCharacter(lastCellName) + TextTableCellNameHelper.getRowCounterValue(lastCellName);
        ITextTableCellRange cellRange = getCellRange(range);
        ITextDocument textDocument = getTextDocument();
        if(textDocument.isOpen()) {
          XCell cell = getXTextTable().getCellByName(firstCell);
          XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, cell);
          if(xPropertySet != null) {
            Object value = xPropertySet.getPropertyValue("TextSection");
            boolean select = true;
            XTextSection xTextSection = (XTextSection)UnoRuntime.queryInterface(XTextSection.class, value);
            if(xTextSection != null) {
              XPropertySet xTextSectionPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextSection);
              if(xTextSectionPropertySet != null) {
                Boolean visible = (Boolean)xTextSectionPropertySet.getPropertyValue("IsVisible");
                select = visible.booleanValue();
              }
            }
            if(select)
              textDocument.setSelection(new XInterfaceObjectSelection(cellRange.getXCellRange()));
          }
        }
      }
    }
    catch(Throwable throwable) {
View Full Code Here

   * @throws TextException if the row(s) can not be added
   *
   * @author Miriam Sutter
   */
  public void addRows(int count) throws TextException {
    ITextTableCellRange textTableCellRangeClone = textTableManagement.getLastTextTable().getCellRange(0,textTableManagement.getLastTextTable().getRowCount()-1,columnCount-1,textTableManagement.getLastTextTable().getRowCount()-1);
    addRowsProperty(count,textTableCellRangeClone);
  }
View Full Code Here

      int singleTableRowCount = textTableLast.getRowCount();
      if((singleTableRowCount + count) * columnCount <= ITextTable.MAX_CELLS_IN_TABLE) {
        textTableLast.addRow(count);
      }
      else {
        ITextTableCellRange textTableCellRangeHeaderClone = textTableLast.getCellRange(0,0,columnCount-1,0);
        int helpRows = maxRowsInTable-singleTableRowCount;
        if(helpRows > 0) {
          textTableLast.addRow(helpRows);
        }
        int helpCount = count-helpRows;
        while(helpCount > 0) {
          int insert = helpCount;
          TextTablePropertyStore tablePropertyStore = new TextTablePropertyStore(textTableManagement.getFirstTextTable());
          if(tablePropertyStore.repeatHeadline()) {
            insert = insert + 1;
          }
          if(helpCount * columnCount > ITextTable.MAX_CELLS_IN_TABLE) {
            insert = maxRowsInTable;
          }
          ITextTable textTable = textDocument.getTextTableService().constructTextTable(1,columnCount);
          ITextTableProperties properties = textTable.getProperties();
          properties.setRepeatHeadline(tablePropertyStore.repeatHeadline());
          textDocument.getTextService().getTextContentService().insertTextContentAfter(textTable,textTableLast);
          properties.setTableColumnSeparators(tablePropertyStore.getTableColumnSeparators());
          IDestinationPosition destinationPosition = new DestinationPosition(textTable.getCell("A1"));
          if(tablePropertyStore.repeatHeadline()) {
            textTableCellRangeHeaderClone.getCloneService().cloneToPositionNoReturn(destinationPosition,null);
            destinationPosition = new DestinationPosition(textTable.getCell("A2"));
            textTableCellRangeClone.getCloneService().cloneToPositionNoReturn(destinationPosition,false,null);
          }
          else {
            textTableCellRangeClone.getCloneService().cloneToPositionNoReturn(destinationPosition,false,null);
View Full Code Here

      int rowCount = table.getRowCount()-1;
      int rowIndex = getRowIndexInTable(tableNumber,index);
     
      removeTables(tableNumber+1,textTableManagement.getTextTables().length-tableNumber-1);
     
      ITextTableCellRange textTableCellRangeClone = table.getCellRange(0,rowIndex,columnCount-1,rowIndex);
     
      int help = rowIndex + count - (rowCount+1);
      if(help < 0) {
        for(int i = rowIndex; i <= count; i++) {
          ITextTableCellRange cellRange = table.getCellRange(0,i,columnCount-1,i);
          destinationPosition = new DestinationPosition(cellRange);
          textTableCellRangeClone.getCloneService().cloneToPosition(destinationPosition,null);
        }
        IETextTableCellRange cellRange = getCellRange(0,index,columnCount-1,index+count-1);
        clearTableRange(cellRange);
        table.removeRows(rowIndex+count,rowCount-(rowIndex+count)+1);
      }
      else {
        for(int i = rowIndex; i <= rowCount; i++) {
          ITextTableCellRange cellRange = table.getCellRange(0,i,columnCount-1,i);
          destinationPosition = new DestinationPosition(cellRange);
          textTableCellRangeClone.getCloneService().cloneToPosition(destinationPosition,null);
        }
        IETextTableCellRange cellRange = getCellRange(0,index,columnCount-1,index + (rowCount-rowIndex));
        clearTableRange(cellRange);
View Full Code Here

          throw cloneException;
        }
      }
      else if(TextTableRow.class.isAssignableFrom(position.getType())) {
        TextTableRow textTableRow = ((TextTableRow)position.getDestinationObject());       
        ITextTableCellRange tableCellRange = textTableRow.getCellRange();
        int tmpColumnCount = tableCellRange.getColumnCount();
        int tmpRowCount = tableCellRange.getRowCount();
        if(tmpColumnCount == 0 || tmpRowCount==0) {
          CloneException cloneException =  new CloneException("No range selected.");
          throw cloneException;
        }
        newTable = tableCellRange.getCell(0,0).getTextTable();;
        ITextTableCellRangeName rangeName = tableCellRange.getRangeName();
        columnStart = rangeName.getRangeStartColumnIndex();
        rowStart = rangeName.getRangeStartRowIndex();
        if(tmpColumnCount != columnCount || tmpRowCount != rowCount) {
          CloneException cloneException =  new CloneException("The selected range is not valid.");
          throw cloneException;
        }
      }
      else if(TextTableColumn.class.isAssignableFrom(position.getType())) {
        //TODO fill with logic
      }
      else {
        CloneException cloneException =  new CloneException("No range selected.");
        throw cloneException;
      }
      if(newTable != null) {
        int rowArrayLength = cellCloneServices.length;
        for (int rows = 0; rows < rowArrayLength; rows++) {
          for (int columns = 0; columns < columnArrayLength ; columns++) {
            ICloneService cellClone = cellCloneServices[rows][columns];
            ITextTableCell textTableCell = newTable.getCell(columnStart + columns, rowStart + rows);
            CloneDestinationPosition destinationCell = new CloneDestinationPosition(textTableCell, textTableCell.getClass());
            cellClone.cloneToPositionNoReturn(destinationCell, adoptContent,propertyKeysContainer);
          }
        }
        if(generateReturnValue) {
          ITextTableCellRange textTableCellRange = newTable.getCellRange(columnStart,rowStart,columnArrayLength,rowArrayLength);
          return new ClonedObject(textTableCellRange, textTableCellRange.getClass());
        }
        else
          return null;
      }
      else {
View Full Code Here

          throw cloneException;
        }
      } else if (TextTableRow.class.isAssignableFrom(position.getType())) {
        TextTableRow textTableRow = ((TextTableRow) position
            .getDestinationObject());
        ITextTableCellRange tableCellRange = textTableRow
            .getCellRange();
        int tmpColumnCount = tableCellRange.getColumnCount();
        int tmpRowCount = tableCellRange.getRowCount();
        if (tmpColumnCount == 0 || tmpRowCount == 0) {
          CloneException cloneException = new CloneException(
              "No range selected.");
          throw cloneException;
        }
        newTable = tableCellRange.getCell(0, 0).getTextTable();
        ;
        ITextTableCellRangeName rangeName = tableCellRange
            .getRangeName();
        columnStart = rangeName.getRangeStartColumnIndex();
        rowStart = rangeName.getRangeStartRowIndex();
        if (tmpColumnCount != columnCount || tmpRowCount != rowCount) {
          CloneException cloneException = new CloneException(
              "The selected range is not valid.");
          throw cloneException;
        }
      } else if (TextTableColumn.class.isAssignableFrom(position
          .getType())) {
        // TODO fill with logic
      } else {
        CloneException cloneException = new CloneException(
            "No range selected.");
        throw cloneException;
      }
      if (newTable != null) {
        int rowArrayLength = cellCloneServices.length;
        for (int rows = 0; rows < rowArrayLength; rows++) {
          for (int columns = 0; columns < columnArrayLength; columns++) {
            ICloneService cellClone = cellCloneServices[rows][columns];
            ITextTableCell textTableCell = newTable.getCell(
                columnStart + columns, rowStart + rows);
            CloneDestinationPosition destinationCell = new CloneDestinationPosition(
                textTableCell, textTableCell.getClass());
            cellClone.cloneToPositionNoReturn(destinationCell,
                adoptContent, propertyKeysContainer);
          }
        }
        if (generateReturnValue) {
          ITextTableCellRange textTableCellRange = newTable
              .getCellRange(columnStart, rowStart,
                  columnArrayLength, rowArrayLength);
          return new ClonedObject(textTableCellRange,
              textTableCellRange.getClass());
        } else
          return null;
      } else {
        CloneException cloneException = new CloneException(
            "No range selected.");
View Full Code Here

   *             if the row(s) can not be added
   *
   * @author Miriam Sutter
   */
  public void addRows(int count) throws TextException {
    ITextTableCellRange textTableCellRangeClone = textTableManagement
        .getLastTextTable()
        .getCellRange(
            0,
            textTableManagement.getLastTextTable().getRowCount() - 1,
            columnCount - 1,
View Full Code Here

      ITextTable textTableLast = textTableManagement.getLastTextTable();
      int singleTableRowCount = textTableLast.getRowCount();
      if ((singleTableRowCount + count) * columnCount <= ITextTable.MAX_CELLS_IN_TABLE) {
        textTableLast.addRow(count);
      } else {
        ITextTableCellRange textTableCellRangeHeaderClone = textTableLast
            .getCellRange(0, 0, columnCount - 1, 0);
        int helpRows = maxRowsInTable - singleTableRowCount;
        if (helpRows > 0) {
          textTableLast.addRow(helpRows);
        }
        int helpCount = count - helpRows;
        while (helpCount > 0) {
          int insert = helpCount;
          TextTablePropertyStore tablePropertyStore = new TextTablePropertyStore(
              textTableManagement.getFirstTextTable());
          if (tablePropertyStore.repeatHeadline()) {
            insert = insert + 1;
          }
          if (helpCount * columnCount > ITextTable.MAX_CELLS_IN_TABLE) {
            insert = maxRowsInTable;
          }
          ITextTable textTable = textDocument.getTextTableService()
              .constructTextTable(1, columnCount);
          ITextTableProperties properties = textTable.getProperties();
          properties.setRepeatHeadline(tablePropertyStore
              .repeatHeadline());
          textDocument.getTextService().getTextContentService()
              .insertTextContentAfter(textTable, textTableLast);
          properties.setTableColumnSeparators(tablePropertyStore
              .getTableColumnSeparators());
          IDestinationPosition destinationPosition = new DestinationPosition(
              textTable.getCell("A1"));
          if (tablePropertyStore.repeatHeadline()) {
            textTableCellRangeHeaderClone.getCloneService()
                .cloneToPositionNoReturn(destinationPosition,
                    null);
            destinationPosition = new DestinationPosition(textTable
                .getCell("A2"));
            textTableCellRangeClone.getCloneService()
View Full Code Here

      removeTables(tableNumber + 1,
          textTableManagement.getTextTables().length - tableNumber
              - 1);

      ITextTableCellRange textTableCellRangeClone = table.getCellRange(0,
          rowIndex, columnCount - 1, rowIndex);

      int help = rowIndex + count - (rowCount + 1);
      if (help < 0) {
        for (int i = rowIndex; i <= count; i++) {
          ITextTableCellRange cellRange = table.getCellRange(0, i,
              columnCount - 1, i);
          destinationPosition = new DestinationPosition(cellRange);
          textTableCellRangeClone.getCloneService().cloneToPosition(
              destinationPosition, null);
        }
        IETextTableCellRange cellRange = getCellRange(0, index,
            columnCount - 1, index + count - 1);
        clearTableRange(cellRange);
        table.removeRows(rowIndex + count, rowCount
            - (rowIndex + count) + 1);
      } else {
        for (int i = rowIndex; i <= rowCount; i++) {
          ITextTableCellRange cellRange = table.getCellRange(0, i,
              columnCount - 1, i);
          destinationPosition = new DestinationPosition(cellRange);
          textTableCellRangeClone.getCloneService().cloneToPosition(
              destinationPosition, null);
        }
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.text.ITextTableCellRange

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.