コード例 #1
0
        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);
        }
コード例 #2
0
        private static void UpdateBeamReferenceSlide(PowerPointSlide refSlide)
        {
            var beamShape       = FindBeamShape(refSlide);
            var currentSections = ExtractAgendaSectionsFromBeam(beamShape);
            var newSections     = GetAllButFirstSection();

            var beamFormats        = BeamFormats.ExtractFormats(beamShape);
            var oldTextBoxes       = BeamFormats.GetAllShapesWithPurpose(beamShape, ShapePurpose.BeamShapeText);
            var highlightedTextBox = BeamFormats.GetShapeWithPurpose(beamShape, ShapePurpose.BeamShapeHighlightedText);
            var background         = BeamFormats.GetShapeWithPurpose(beamShape, ShapePurpose.BeamShapeBackground);

            MatchColour(highlightedTextBox, background);

            if (SectionsMatch(currentSections, newSections))
            {
                return;
            }


            var confirmResult = MessageBox.Show(new Form()
            {
                TopMost = true
            },
                                                TextCollection.AgendaLabReorganiseSidebarContent,
                                                TextCollection.AgendaLabReorganiseSidebarTitle,
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                ReorganiseBeam(refSlide, newSections, highlightedTextBox, background, beamFormats, oldTextBoxes, beamShape);
            }
            else
            {
                UpdateBeamItems(refSlide, newSections, highlightedTextBox, background, beamFormats, oldTextBoxes, beamShape);
            }
        }