private static void RunAnimateInSlide()
        {
            bool oldFrameAnimationChecked = AnimateInSlide.frameAnimationChecked;

            AnimateInSlide.frameAnimationChecked    = false;
            AnimateInSlide.isHighlightBullets       = false;
            AnimateInSlide.isHighlightTextFragments = true;
            AnimateInSlide.AddAnimationInSlide();
            AnimateInSlide.frameAnimationChecked = oldFrameAnimationChecked;
        }
示例#2
0
        public static void AddHighlightBulletsBackground()
        {
            try
            {
                var currentSlide = PowerPointCurrentPresentationInfo.CurrentSlide as PowerPointSlide;
                currentSlide.Name = "PPTLabsHighlightBulletsSlide" + DateTime.Now.ToString("yyyyMMddHHmmssffff");

                PowerPoint.ShapeRange selectedShapes = null;
                Office.TextRange2     selectedText   = null;

                //Get shapes to consider for animation
                List <PowerPoint.Shape> shapesToUse = null;
                switch (userSelection)
                {
                case HighlightBackgroundSelection.kShapeSelected:
                    selectedShapes = Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange;
                    shapesToUse    = GetShapesToUse(currentSlide, selectedShapes);
                    break;

                case HighlightBackgroundSelection.kTextSelected:
                    selectedShapes = Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange;
                    selectedText   = Globals.ThisAddIn.Application.ActiveWindow.Selection.TextRange2.TrimText();
                    shapesToUse    = GetShapesToUse(currentSlide, selectedShapes);
                    break;

                case HighlightBackgroundSelection.kNoneSelected:
                    currentSlide.DeleteIndicator();
                    currentSlide.DeleteShapesWithPrefix("PPTLabsHighlightBackgroundShape");
                    shapesToUse = GetAllUsableShapesInSlide(currentSlide);
                    break;

                default:
                    break;
                }

                Globals.ThisAddIn.Application.ActiveWindow.Selection.Unselect();
                Globals.ThisAddIn.Application.ActiveWindow.View.GotoSlide(currentSlide.Index);

                if (shapesToUse == null || shapesToUse.Count == 0)
                {
                    return;
                }

                SelectOldShapesToAnimate(currentSlide, shapesToUse);
                bool newShapesAdded = AddNewShapesToAnimate(currentSlide, shapesToUse, selectedText);

                if (newShapesAdded)
                {
                    bool oldValue = AnimateInSlide.frameAnimationChecked;
                    AnimateInSlide.frameAnimationChecked = false;
                    AnimateInSlide.isHighlightBullets    = true;
                    AnimateInSlide.AddAnimationInSlide();
                    AnimateInSlide.frameAnimationChecked = oldValue;
                    PowerPointPresentation.Current.AddAckSlide();
                }
                Globals.ThisAddIn.Application.ActiveWindow.Selection.Unselect();
            }
            catch (Exception e)
            {
                PowerPointLabsGlobals.LogException(e, "AddHighlightBulletsBackground");
                throw;
            }
        }