/// <summary>
        /// Gets a cell.
        /// </summary>
        /// <param name="sectionCellLocator">The section cell locator.</param>
        /// <param name="currentCell">The current cell.</param>
        /// <returns>
        /// The cell.
        /// </returns>
        public ICell GetCell(
            SectionCellLocator sectionCellLocator,
            ICell currentCell)
        {
            if (sectionCellLocator == null)
            {
                throw new ArgumentNullException(nameof(sectionCellLocator));
            }

            if (currentCell == null)
            {
                throw new ArgumentNullException(nameof(currentCell));
            }

            if (!this.cellToSectionIdMap.TryGetValue(currentCell, out var sectionId))
            {
                throw new CellNotFoundException(Invariant($"{nameof(currentCell)} is not a cell in the report."), sectionCellLocator);
            }

            var reportCellLocator = new ReportCellLocator(sectionId, sectionCellLocator.CellId, sectionCellLocator.SlotId, sectionCellLocator.SlotSelectionStrategy);

            var result = this.GetCell(reportCellLocator);

            return(result);
        }
Example #2
0
        /// <summary>
        /// Builds a <see cref="SectionCellLocator"/>.
        /// </summary>
        /// <param name="cellId">The id of the cell.</param>
        /// <param name="slotId">OPTIONAL id of the slot to use -OR- null if not addressing an <see cref="ISlottedCell"/>.  DEFAULT is to address an <see cref="INotSlottedCell"/>.</param>
        /// <param name="slotSelectionStrategy">OPTIONAL strategy to use to select a slot if addressing an <see cref="ISlottedCell"/>.  DEFAULT is to throw if addressing an <see cref="ISlottedCell"/> -AND- <paramref name="slotId"/> is not specified.</param>
        /// <returns>
        /// A <see cref="SectionCellLocator"/>.
        /// </returns>
        public static SectionCellLocator InThisSection(
            string cellId,
            string slotId = null,
            SlotSelectionStrategy slotSelectionStrategy = SlotSelectionStrategy.ThrowIfSlotIdNotSpecified)
        {
            var result = new SectionCellLocator(cellId, slotId, slotSelectionStrategy);

            return(result);
        }