Ejemplo n.º 1
0
const TXshCell &TXsheet::getCell(int row, int col) const {
  static const TXshCell emptyCell;
  TXshColumnP column = m_imp->m_columnSet.getColumn(col);
  if (!column) return emptyCell;
  TXshCellColumn *xshColumn = column->getCellColumn();
  if (!xshColumn) return emptyCell;
  return xshColumn->getCell(row);
}
Ejemplo n.º 2
0
int TXsheet::getCellRange(int col, int &r0, int &r1) const {
  r0                 = 0;
  r1                 = -1;
  TXshColumnP column = m_imp->m_columnSet.getColumn(col);
  if (!column) return 0;
  TXshCellColumn *cellColumn = column->getCellColumn();
  if (!cellColumn) return 0;
  return cellColumn->getRange(r0, r1);
}
Ejemplo n.º 3
0
void TXsheet::insertCells(int row, int col, int rowCount) {
  TXshColumnP column = m_imp->m_columnSet.getColumn(col);
  if (!column || column->isLocked()) return;
  TXshCellColumn *xshColumn = column->getCellColumn();
  if (!xshColumn) return;
  xshColumn->insertEmptyCells(row, rowCount);
  // aggiorno il frame count
  int fc = xshColumn->getMaxFrame() + 1;
  if (fc > m_imp->m_frameCount) m_imp->m_frameCount = fc;
}
Ejemplo n.º 4
0
void TXsheet::removeCells(int row, int col, int rowCount) {
  TXshColumnP column = m_imp->m_columnSet.getColumn(col);
  if (!column || column->isLocked()) return;

  TXshCellColumn *xshCellColumn = column->getCellColumn();
  if (!xshCellColumn) return;

  int oldColRowCount = xshCellColumn->getMaxFrame() + 1;
  xshCellColumn->removeCells(row, rowCount);

  // aggiornamento framecount
  if (oldColRowCount == m_imp->m_frameCount) updateFrameCount();

  TNotifier::instance()->notify(TXsheetChange());
}
Ejemplo n.º 5
0
void TXsheet::getCells(int row, int col, int rowCount, TXshCell cells[]) const {
  static const TXshCell emptyCell;
  int i;
  TXshColumnP column = m_imp->m_columnSet.getColumn(col);
  if (!column) {
    for (i = 0; i < rowCount; i++) cells[i] = emptyCell;
    return;
  }
  TXshCellColumn *xshColumn = column->getCellColumn();
  if (!xshColumn) {
    for (i = 0; i < rowCount; i++) cells[i] = emptyCell;
    return;
  }
  xshColumn->getCells(row, rowCount, cells);
}
Ejemplo n.º 6
0
void TXsheet::getUsedLevels(set<TXshLevel *> &levels) const {
  set<const TXsheet *> visitedXshs;
  vector<const TXsheet *> todoXshs;

  visitedXshs.insert(this);
  todoXshs.push_back(this);

  while (!todoXshs.empty()) {
    const TXsheet *xsh = todoXshs.back();
    todoXshs.pop_back();

    int c0 = 0, c1 = xsh->getColumnCount() - 1;
    for (int c = c0; c <= c1; ++c) {
      TXshColumnP column = const_cast<TXsheet *>(xsh)->getColumn(c);
      if (!column) continue;

      TXshCellColumn *cellColumn = column->getCellColumn();
      if (!cellColumn) continue;

      int r0, r1;
      if (!cellColumn->getRange(r0, r1)) continue;

      TXshLevel *level = 0;
      for (int r = r0; r <= r1; r++) {
        TXshCell cell = cellColumn->getCell(r);
        if (cell.isEmpty() || !cell.m_level) continue;

        if (level != cell.m_level.getPointer()) {
          level = cell.m_level.getPointer();
          levels.insert(level);
          if (level->getChildLevel()) {
            TXsheet *childXsh = level->getChildLevel()->getXsheet();
            if (visitedXshs.count(childXsh) == 0) {
              visitedXshs.insert(childXsh);
              todoXshs.push_back(childXsh);
            }
          }
        }
      }
    }
  }
}