/// <summary> /// Sets all adjacent columns of the same outline level to the specified hidden status. /// </summary> /// <param name="pIdx">the col info index of the start of the outline group.</param> /// <param name="level">The level.</param> /// <param name="hidden">The hidden.</param> /// <returns>the column index of the last column in the outline group</returns> private int SetGroupHidden(int pIdx, int level, bool hidden) { int idx = pIdx; ColumnInfoRecord columnInfo = GetColInfo(idx); while (idx < records.Count) { columnInfo.IsHidden = (hidden); if (idx + 1 < records.Count) { ColumnInfoRecord nextColumnInfo = GetColInfo(idx + 1); if (!columnInfo.IsAdjacentBefore(nextColumnInfo)) { break; } if (nextColumnInfo.OutlineLevel < level) { break; } columnInfo = nextColumnInfo; } idx++; } return(columnInfo.LastColumn); }
/** * merges two column info records (if they are adjacent and have the same formatting, etc) * @return <c>false</c> if the two column records could not be merged */ private static bool MergeColInfoRecords(ColumnInfoRecord ciA, ColumnInfoRecord ciB) { if (ciA.IsAdjacentBefore(ciB) && ciA.FormatMatches(ciB)) { ciA.LastColumn = ciB.LastColumn; return(true); } return(false); }
/// <summary> /// Determines whether [is column group hidden by parent] [the specified idx]. /// </summary> /// <param name="idx">The idx.</param> /// <returns> /// <c>true</c> if [is column group hidden by parent] [the specified idx]; otherwise, <c>false</c>. /// </returns> public bool IsColumnGroupHiddenByParent(int idx) { // Look out outline details of end int endLevel = 0; bool endHidden = false; int endOfOutlineGroupIdx = FindEndOfColumnOutlineGroup(idx); if (endOfOutlineGroupIdx < records.Count) { ColumnInfoRecord nextInfo = GetColInfo(endOfOutlineGroupIdx + 1); if (GetColInfo(endOfOutlineGroupIdx).IsAdjacentBefore(nextInfo)) { endLevel = nextInfo.OutlineLevel; endHidden = nextInfo.IsHidden; } } // Look out outline details of start int startLevel = 0; bool startHidden = false; int startOfOutlineGroupIdx = FindStartOfColumnOutlineGroup(idx); if (startOfOutlineGroupIdx > 0) { ColumnInfoRecord prevInfo = GetColInfo(startOfOutlineGroupIdx - 1); if (prevInfo.IsAdjacentBefore(GetColInfo(startOfOutlineGroupIdx))) { startLevel = prevInfo.OutlineLevel; startHidden = prevInfo.IsHidden; } } if (endLevel > startLevel) { return(endHidden); } return(startHidden); }