Пример #1
0
        /// <summary>
        /// Scrambles the slide section names to avoid duplicate names later on, which can crash powerpoint.
        /// Use this just before reassigning the slide section names! Don't keep the slide names this way!
        /// </summary>
        private static void ScrambleSlideSectionNames()
        {
            var slides = PowerPointPresentation.Current.Slides;

            slides.Where(slide => AgendaSlide.IsAnyAgendaSlide(slide) && AgendaSlide.IsNotReferenceslide(slide))
            .ToList()
            .ForEach(AgendaSlide.AssignUniqueSectionName);
        }
Пример #2
0
        /// <summary>
        /// Checks whether there is a section with no slides.
        /// Agenda slides are not counted.
        /// </summary>
        private static bool HasEmptySection()
        {
            var sections = Sections;

            foreach (var section in sections)
            {
                var sectionSlides = GetSectionSlides(section);
                if (sectionSlides.All(slide => AgendaSlide.IsAnyAgendaSlide(slide) || PowerPointAckSlide.IsAckSlide(slide)))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
        private static Type GetAnyAgendaSlideType()
        {
            var agendaSlide = PowerPointPresentation.Current
                              .Slides
                              .FirstOrDefault(slide => AgendaSlide.IsAnyAgendaSlide(slide) ||
                                              HasBeamShape(slide));

            if (agendaSlide == null)
            {
                return(Type.None);
            }
            if (HasBeamShape(agendaSlide))
            {
                return(Type.Beam);
            }
            return(AgendaSlide.Decode(agendaSlide).AgendaType);
        }
Пример #4
0
        private static PowerPointSlide FindSectionLastNonAgendaSlide(int sectionIndex)
        {
            var presentation = PowerPointPresentation.Current;

            int currentIndex = SectionLastSlideIndex(sectionIndex);
            var slide        = presentation.GetSlide(currentIndex);

            while (AgendaSlide.IsAnyAgendaSlide(slide))
            {
                currentIndex--;
                if (currentIndex <= 0)
                {
                    return(null);
                }

                slide = presentation.GetSlide(currentIndex);
            }
            return(slide);
        }
Пример #5
0
        private static PowerPointSlide FindSectionFirstNonAgendaSlide(int sectionIndex)
        {
            PowerPointPresentation presentation = PowerPointPresentation.Current;
            int slideCount = presentation.SlideCount;

            int             currentIndex = SectionFirstSlideIndex(sectionIndex);
            PowerPointSlide slide        = presentation.GetSlide(currentIndex);

            while (AgendaSlide.IsAnyAgendaSlide(slide))
            {
                currentIndex++;
                if (currentIndex > slideCount)
                {
                    return(null);
                }

                slide = presentation.GetSlide(currentIndex);
            }
            return(slide);
        }
        /// <summary>
        /// The assignment list indicates the new position of each of the previous slides.
        /// assignmentList[oldSlideIndex] = newSlideIndex
        ///
        /// if newSlideIndex is equal to TemplateIndexTable.NoSlide, it means the slide is marked for deletion.
        ///
        /// All slideIndexes are relative to the index of the first slide in the section. first slide is index 0.
        /// </summary>
        private static void GenerateInitialAssignmentList(out int indexOfFirstBackSlide, AgendaTemplate template,
                                                          TemplateIndexTable templateTable, List <int> assignmentList, List <PowerPointSlide> sectionSlides)
        {
            for (int i = 0; i < template.FrontSlidesCount; ++i)
            {
                int chosenSlide = templateTable.FrontIndexes[i];
                if (chosenSlide == -1)
                {
                    continue;
                }
                assignmentList[chosenSlide] = i;
            }
            int currentIndex = template.FrontSlidesCount;

            for (int i = 0; i < assignmentList.Count; ++i)
            {
                if (assignmentList[i] == TemplateIndexTable.NoSlide)
                {
                    if (!AgendaSlide.IsAnyAgendaSlide(sectionSlides[i]))
                    {
                        assignmentList[i] = currentIndex;
                        currentIndex++;
                    }
                }
            }
            indexOfFirstBackSlide = currentIndex;
            for (int i = 0; i < template.BackSlidesCount; ++i)
            {
                int chosenSlide = templateTable.BackIndexes[i];
                if (chosenSlide == -1)
                {
                    continue;
                }
                assignmentList[chosenSlide] = indexOfFirstBackSlide + i;
            }
        }