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); }
void CellsMover::restoreColumns(int c) const { std::set<int> ii; for (int i = 0; i < m_colCount; i++) ii.insert(c + i); TXsheet *xsh = getXsheet(); for (int i = 0; i < m_colCount; i++) xsh->removeColumn(c); std::list<int> restoredSplineIds; m_columnsData->restoreObjects( ii, restoredSplineIds, xsh, StageObjectsData::eDoClone | StageObjectsData::eResetFxDagPositions); for (int i = 0; i < m_colCount; i++) { TXshColumn *column = xsh->getColumn(c + i); if (!column) continue; TXshCellColumn *cellColumn = column->getCellColumn(); if (!cellColumn) continue; int r0 = 0, r1 = -1; cellColumn->getRange(r0, r1); if (r0 <= r1) cellColumn->clearCells(r0, r1 - r0 + 1); } }
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); } } } } } } }