Package org.apache.poi.hssf.record

Examples of org.apache.poi.hssf.record.ColumnInfoRecord


  }
  public ColumnInfoRecordsAggregate(RecordStream rs) {
    this();

    boolean isInOrder = true;
    ColumnInfoRecord cirPrev = null;
    while(rs.peekNextClass() == ColumnInfoRecord.class) {
      ColumnInfoRecord cir = (ColumnInfoRecord) rs.getNext();
      records.add(cir);
      if (cirPrev != null && CIRComparator.compareColInfos(cirPrev, cir) > 0) {
        isInOrder = false;
      }
      cirPrev = cir;
View Full Code Here


   * Performs a deep clone of the record
   */
  public Object clone() {
    ColumnInfoRecordsAggregate rec = new ColumnInfoRecordsAggregate();
    for (int k = 0; k < records.size(); k++) {
      ColumnInfoRecord ci = ( ColumnInfoRecord ) records.get(k);
      rec.records.add(ci.clone());
    }
    return rec;
  }
View Full Code Here

  public void visitContainedRecords(RecordVisitor rv) {
    int nItems = records.size();
    if (nItems < 1) {
      return;
    }
    ColumnInfoRecord cirPrev = null;
    for(int i=0; i<nItems; i++) {
      ColumnInfoRecord cir = (ColumnInfoRecord)records.get(i);
      rv.visitRecord(cir);
      if (cirPrev != null && CIRComparator.compareColInfos(cirPrev, cir) > 0) {
        // Excel probably wouldn't mind, but there is much logic in this class
        // that assumes the column info records are kept in order
        throw new RuntimeException("Column info records are out of order");
View Full Code Here

    }
  }

  private int findStartOfColumnOutlineGroup(int pIdx) {
    // Find the start of the group.
    ColumnInfoRecord columnInfo = (ColumnInfoRecord) records.get(pIdx);
    int level = columnInfo.getOutlineLevel();
    int idx = pIdx;
    while (idx != 0) {
      ColumnInfoRecord prevColumnInfo = (ColumnInfoRecord) records.get(idx - 1);
      if (!prevColumnInfo.isAdjacentBefore(columnInfo)) {
        break;
      }
      if (prevColumnInfo.getOutlineLevel() < level) {
        break;
      }
      idx--;
      columnInfo = prevColumnInfo;
    }
View Full Code Here

    return idx;
  }

  private int findEndOfColumnOutlineGroup(int colInfoIndex) {
    // Find the end of the group.
    ColumnInfoRecord columnInfo = (ColumnInfoRecord) records.get(colInfoIndex);
    int level = columnInfo.getOutlineLevel();
    int idx = colInfoIndex;
    while (idx < records.size() - 1) {
      ColumnInfoRecord nextColumnInfo = (ColumnInfoRecord) records.get(idx + 1);
      if (!columnInfo.isAdjacentBefore(nextColumnInfo)) {
        break;
      }
      if (nextColumnInfo.getOutlineLevel() < level) {
        break;
      }
      idx++;
      columnInfo = nextColumnInfo;
    }
View Full Code Here

    int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx);
    int nextColInfoIx = endOfOutlineGroupIdx+1;
    if (nextColInfoIx >= records.size()) {
      return false;
    }
    ColumnInfoRecord nextColInfo = getColInfo(nextColInfoIx);
    if (!getColInfo(endOfOutlineGroupIdx).isAdjacentBefore(nextColInfo)) {
      return false;
    }
    return nextColInfo.getCollapsed();
  }
View Full Code Here

    // Look out outline details of end
    int endLevel = 0;
    boolean endHidden = false;
    int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup( idx );
    if (endOfOutlineGroupIdx < records.size()) {
      ColumnInfoRecord nextInfo = getColInfo(endOfOutlineGroupIdx + 1);
      if (getColInfo(endOfOutlineGroupIdx).isAdjacentBefore(nextInfo)) {
        endLevel = nextInfo.getOutlineLevel();
        endHidden = nextInfo.getHidden();
      }
    }
    // Look out outline details of start
    int startLevel = 0;
    boolean startHidden = false;
    int startOfOutlineGroupIdx = findStartOfColumnOutlineGroup( idx );
    if (startOfOutlineGroupIdx > 0) {
      ColumnInfoRecord prevInfo = getColInfo(startOfOutlineGroupIdx - 1);
      if (prevInfo.isAdjacentBefore(getColInfo(startOfOutlineGroupIdx))) {
        startLevel = prevInfo.getOutlineLevel();
        startHidden = prevInfo.getHidden();
      }
    }
    if (endLevel > startLevel) {
      return endHidden;
    }
View Full Code Here

      return;
    }

    // Find the start of the group.
    int groupStartColInfoIx = findStartOfColumnOutlineGroup(colInfoIx);
    ColumnInfoRecord columnInfo = getColInfo(groupStartColInfoIx);

    // Hide all the columns until the end of the group
    int lastColIx = setGroupHidden(groupStartColInfoIx, columnInfo.getOutlineLevel(), true);

    // Write collapse field
    setColumn(lastColIx + 1, null, null, null, null, Boolean.TRUE);
  }
View Full Code Here

   * @param pIdx the col info index of the start of the outline group
   * @return the column index of the last column in the outline group
   */
  private int setGroupHidden(int pIdx, int level, boolean hidden) {
    int idx = pIdx;
    ColumnInfoRecord columnInfo = getColInfo(idx);
    while (idx < records.size()) {
      columnInfo.setHidden(hidden);
      if (idx + 1 < records.size()) {
        ColumnInfoRecord nextColumnInfo = getColInfo(idx + 1);
        if (!columnInfo.isAdjacentBefore(nextColumnInfo)) {
          break;
        }
        if (nextColumnInfo.getOutlineLevel() < level) {
          break;
        }
        columnInfo = nextColumnInfo;
      }
      idx++;
View Full Code Here

    // hidden bit gets unset _if_ surrounding groups are expanded you can determine
    //   this by looking at the hidden bit of the enclosing group.  You will have
    //   to look at the start and the end of the current group to determine which
    //   is the enclosing group
    // hidden bit only is altered for this outline level.  ie.  don't uncollapse contained groups
    ColumnInfoRecord columnInfo = getColInfo(endIdx);
    if (!isColumnGroupHiddenByParent(idx)) {
      int outlineLevel = columnInfo.getOutlineLevel();
      for (int i = startIdx; i <= endIdx; i++) {
        ColumnInfoRecord ci = getColInfo(i);
        if (outlineLevel == ci.getOutlineLevel())
          ci.setHidden(false);
      }
    }

    // Write collapse flag (stored in a single col info record after this outline group)
    setColumn(columnInfo.getLastColumn() + 1, null, null, null, null, Boolean.FALSE);
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.ColumnInfoRecord

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.