コード例 #1
0
        /// <summary>
        /// Applies font highlighting by section to the text in the bullet agenda.
        /// Set currentSection to the first section for everything to be unvisited.
        /// Set currentSection to AgendaSection.None for everything to be visited.
        /// </summary>
        private static void ApplyBulletFormats(TextRange2 textRange, BulletFormats bulletFormats, AgendaSection currentSection)
        {
            // - 1 because first section in agenda is at index 2 (exclude first section)
            int focusIndex = currentSection.IsNone() ? int.MaxValue : currentSection.Index - 1;

            textRange.Font.StrikeThrough = MsoTriState.msoFalse;

            for (var i = 1; i <= textRange.Paragraphs.Count; i++)
            {
                var currentParagraph = textRange.Paragraphs[i];

                if (i == focusIndex)
                {
                    Graphics.SyncTextRange(bulletFormats.Highlighted, currentParagraph, pickupTextContent: false);
                }
                else if (i < focusIndex)
                {
                    Graphics.SyncTextRange(bulletFormats.Visited, currentParagraph, pickupTextContent: false);
                }
                else
                {
                    Graphics.SyncTextRange(bulletFormats.Unvisited, currentParagraph, pickupTextContent: false);
                }
            }
        }
コード例 #2
0
        private static void SyncBulletAgendaSlide(PowerPointSlide refSlide, List <AgendaSection> sections,
                                                  AgendaSection currentSection, List <string> deletedShapeNames, PowerPointSlide targetSlide)
        {
            SyncShapesFromReferenceSlide(refSlide, targetSlide, deletedShapeNames);

            var referenceContentShape = refSlide.GetShape(AgendaShape.WithPurpose(ShapePurpose.ContentShape));
            var targetContentShape    = targetSlide.GetShape(AgendaShape.WithPurpose(ShapePurpose.ContentShape));
            var bulletFormats         = BulletFormats.ExtractFormats(referenceContentShape);

            Graphics.SetText(targetContentShape, sections.Where(section => section.Index > 1)
                             .Select(section => section.Name));
            Graphics.SyncShape(referenceContentShape, targetContentShape, pickupTextContent: false,
                               pickupTextFormat: false);

            ApplyBulletFormats(targetContentShape.TextFrame2.TextRange, bulletFormats, currentSection);
            targetSlide.DeletePlaceholderShapes();
        }
コード例 #3
0
        /// <summary>
        /// Applies font highlighting by section to the text in the bullet agenda.
        /// Set currentSection to the first section for everything to be unvisited.
        /// Set currentSection to AgendaSection.None for everything to be visited.
        /// </summary>
        private static void ApplyBulletFormats(TextRange2 textRange, BulletFormats bulletFormats, AgendaSection currentSection)
        {
            // - 1 because first section in agenda is at index 2 (exclude first section)
            int focusIndex = currentSection.IsNone() ? int.MaxValue : currentSection.Index - 1;

            textRange.Font.StrikeThrough = MsoTriState.msoFalse;

            for (var i = 1; i <= textRange.Paragraphs.Count; i++)
            {
                var currentParagraph = textRange.Paragraphs[i];

                if (i == focusIndex)
                {
                    Graphics.SyncTextRange(bulletFormats.Highlighted, currentParagraph, pickupTextContent: false);
                }
                else if (i < focusIndex)
                {
                    Graphics.SyncTextRange(bulletFormats.Visited, currentParagraph, pickupTextContent: false);
                }
                else
                {
                    Graphics.SyncTextRange(bulletFormats.Unvisited, currentParagraph, pickupTextContent: false);
                }
            }
        }