private ChapterEntry GetCalculatedChapterEntry() { ChapterEntry result = null; if (ElementType == ElementType.TableCell) { var hierarchyInfo = (TableHierarchyInfo)ParentHierarchy.ParentHierarchy.HierarchyInfo; if (hierarchyInfo.CurrentRow > 0) { result = hierarchyInfo.FirstRowParseContexts.TryGetAt(hierarchyInfo.CurrentColumn)?.ChapterEntry; } if (!(result?.Found).GetValueOrDefault() && !(result?.AtStartOfParagraph).GetValueOrDefault() && hierarchyInfo.CurrentColumn > 0) { result = hierarchyInfo.FirstColumnParseContexts.TryGetAt(hierarchyInfo.CurrentRow)?.ChapterEntry; } } else if (ElementType.CanBeLinear() || PreviousSibling?.ElementType.CanBeLinear() == true) { result = GetPreviousSiblingChapterEntry(); } return(result); }