Пример #1
0
        private static Dictionary <int, Shape> GetImageShapeAssignment(PowerPointSlide inSlide, out List <Shape> unassignedShapes)
        {
            var shapes = inSlide.Shapes.Cast <Shape>();

            unassignedShapes = new List <Shape>();
            var shapeAssignment = new Dictionary <int, Shape>();

            foreach (var shape in shapes)
            {
                var agendaShape = AgendaShape.Decode(shape);
                if (agendaShape == null || agendaShape.ShapePurpose != ShapePurpose.VisualAgendaImage)
                {
                    continue;
                }

                int index = agendaShape.Section.Index;
                if (shapeAssignment.ContainsKey(index))
                {
                    unassignedShapes.Add(shape);
                }
                else
                {
                    shapeAssignment.Add(index, shape);
                }
            }

            return(shapeAssignment);
        }
Пример #2
0
        /// <summary>
        /// Extracts a list of the current sections from textboxes of the beamshape.
        /// If the textboxes are not consistent (e.g. repeated or missing section), returns null instead.
        /// </summary>
        private static List <AgendaSection> ExtractAgendaSectionsFromBeam(Shape beamShape)
        {
            var agendaSections = beamShape.GroupItems.Cast <Shape>()
                                 .Where(AgendaShape.WithPurpose(ShapePurpose.BeamShapeText))
                                 .Select(shape => AgendaShape.Decode(shape).Section)
                                 .ToList();

            agendaSections.Sort((s1, s2) => s1.Index - s2.Index);

            for (int i = 0; i < agendaSections.Count; ++i)
            {
                if (agendaSections[i].Index != i + 2)
                {
                    return(null);
                }
            }
            return(agendaSections);
        }
Пример #3
0
        /// <summary>
        /// Within the slide, for all sections that have been "passed", replace their visual agenda image shape with
        /// an image of the end slide of the section.
        /// </summary>
        private static void ReplaceVisualImagesWithAfterZoomOutImages(PowerPointSlide slide, int sectionIndex)
        {
            var indexedShapes = new Dictionary <int, Shape>();

            slide.Shapes.Cast <Shape>()
            .Where(AgendaShape.WithPurpose(ShapePurpose.VisualAgendaImage))
            .ToList()
            .ForEach(shape => indexedShapes.Add(AgendaShape.Decode(shape).Section.Index, shape));

            for (int i = 2; i < sectionIndex; ++i)
            {
                var imageShape = indexedShapes[i];

                var sectionEndSlide = FindSectionLastNonAgendaSlide(i);
                var snapshotShape   = slide.InsertExitSnapshotOfSlide(sectionEndSlide);
                snapshotShape.Name = imageShape.Name;
                Graphics.SyncShape(imageShape, snapshotShape, pickupShapeFormat: true, pickupTextContent: false, pickupTextFormat: false);
                imageShape.Delete();
            }
        }
Пример #4
0
        /// <summary>
        /// Assumes that all shapes in textboxes are beam shape textboxes.
        /// </summary>
        private static Dictionary <int, Shape> GetBeamTextboxAssignment(IEnumerable <Shape> textboxes, out List <Shape> unassignedShapes)
        {
            unassignedShapes = new List <Shape>();
            var shapeAssignment = new Dictionary <int, Shape>();

            foreach (var shape in textboxes)
            {
                var agendaShape = AgendaShape.Decode(shape);

                int index = agendaShape.Section.Index;
                if (shapeAssignment.ContainsKey(index))
                {
                    unassignedShapes.Add(shape);
                }
                else
                {
                    shapeAssignment.Add(index, shape);
                }
            }

            return(shapeAssignment);
        }