private static void UpdateBeamOnSlide(PowerPointSlide slide, Shape refBeamShape) { RemoveBeamAgendaFromSlide(slide); refBeamShape.Copy(); var beamShape = slide.Shapes.Paste(); var section = GetSlideSection(slide); beamShape.GroupItems.Cast <Shape>() .Where(AgendaShape.WithPurpose(ShapePurpose.BeamShapeHighlightedText)) .ToList() .ForEach(shape => shape.Delete()); if (section.Index == 1) { return; } var beamFormats = BeamFormats.ExtractFormats(refBeamShape); var currentSectionTextBox = beamShape.GroupItems .Cast <Shape>() .Where(AgendaShape.MeetsConditions(shape => shape.ShapePurpose == ShapePurpose.BeamShapeText && shape.Section.Index == section.Index)) .FirstOrDefault(); var currentSectionText = currentSectionTextBox.TextFrame2.TextRange; Graphics.SyncTextRange(beamFormats.Highlighted, currentSectionText, pickupTextContent: false); }
/// <summary> /// Searches for the visual agenda image shape that corresponds to the given section index in the slide and returns it. /// </summary> private static Shape FindShapeCorrespondingToSection(PowerPointSlide inSlide, int sectionIndex) { return(inSlide.GetShape(AgendaShape.MeetsConditions(shape => shape.ShapePurpose == ShapePurpose.VisualAgendaImage && sectionIndex == shape.Section.Index))); }