Exemplo n.º 1
0
        private static void RunAnimateInSlide()
        {
            bool oldFrameAnimationChecked = AnimationLabSettings.IsUseFrameAnimation;

            AnimationLabSettings.IsUseFrameAnimation = false;
            AnimateInSlide.AddAnimationInSlide(isHighlightTextFragments: true);
            AnimationLabSettings.IsUseFrameAnimation = oldFrameAnimationChecked;
        }
        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 = AnimationLabSettings.IsUseFrameAnimation;
                    AnimationLabSettings.IsUseFrameAnimation = false;
                    AnimateInSlide.AddAnimationInSlide(isHighlightBullets: true);
                    AnimationLabSettings.IsUseFrameAnimation = oldValue;
                    PowerPointPresentation.Current.AddAckSlide();
                }
                Globals.ThisAddIn.Application.ActiveWindow.Selection.Unselect();
            }
            catch (Exception e)
            {
                Logger.LogException(e, "AddHighlightBulletsBackground");
                throw;
            }
        }
        protected override void ExecuteAction(string ribbonId)
        {
            this.StartNewUndoEntry();

            AnimateInSlide.AddAnimationInSlide();
        }