コード例 #1
0
        private static void AddFrameAnimationEffects(PowerPointSlide animationSlide, PowerPoint.Shape initialShape, float incrementLeft, float incrementTop, float incrementWidth, float incrementHeight, float incrementRotation ,float incrementFont, float duration, int numFrames)
        {
            PowerPoint.Shape lastShape = initialShape;
            PowerPoint.Sequence sequence = animationSlide.TimeLine.MainSequence;
            for (int i = 1; i <= numFrames; i++)
            {
                PowerPoint.Shape dupShape = initialShape.Duplicate()[1];
                if (i != 1 && animationType != FrameMotionAnimationType.kZoomToAreaDeMagnify)
                    sequence[sequence.Count].Delete();

                if (animationType == FrameMotionAnimationType.kInSlideAnimate || animationType == FrameMotionAnimationType.kZoomToAreaPan || animationType == FrameMotionAnimationType.kZoomToAreaDeMagnify)
                    animationSlide.DeleteShapeAnimations(dupShape);

                if (animationType == FrameMotionAnimationType.kZoomToAreaPan)
                    dupShape.Name = "PPTLabsMagnifyPanAreaGroup" + DateTime.Now.ToString("yyyyMMddHHmmssffff");

                dupShape.LockAspectRatio = Office.MsoTriState.msoFalse;
                dupShape.Left = initialShape.Left;
                dupShape.Top = initialShape.Top;

                if (incrementWidth != 0.0f)
                    dupShape.ScaleWidth((1.0f + (incrementWidth * i)), Office.MsoTriState.msoFalse, Office.MsoScaleFrom.msoScaleFromMiddle);

                if (incrementHeight != 0.0f)
                    dupShape.ScaleHeight((1.0f + (incrementHeight * i)), Office.MsoTriState.msoFalse, Office.MsoScaleFrom.msoScaleFromMiddle);

                if (incrementRotation != 0.0f)
                    dupShape.Rotation += (incrementRotation * i);

                if (incrementLeft != 0.0f)
                    dupShape.Left += (incrementLeft * i);

                if (incrementTop != 0.0f)
                    dupShape.Top += (incrementTop * i);

                if (incrementFont != 0.0f)
                    dupShape.TextFrame.TextRange.Font.Size += (incrementFont * i);

                if (i == 1 && (animationType == FrameMotionAnimationType.kInSlideAnimate || animationType == FrameMotionAnimationType.kZoomToAreaPan))
                {
                    PowerPoint.Effect appear = sequence.AddEffect(dupShape, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerOnPageClick);
                }
                else
                {
                    PowerPoint.Effect appear = sequence.AddEffect(dupShape, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                    appear.Timing.TriggerDelayTime = ((duration / numFrames) * i);
                }

                PowerPoint.Effect disappear = sequence.AddEffect(lastShape, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                disappear.Exit = Office.MsoTriState.msoTrue;
                disappear.Timing.TriggerDelayTime = ((duration / numFrames) * i);

                lastShape = dupShape;
            }

            if (animationType == FrameMotionAnimationType.kInSlideAnimate || animationType == FrameMotionAnimationType.kZoomToAreaPan || animationType == FrameMotionAnimationType.kZoomToAreaDeMagnify)
            {
                PowerPoint.Effect disappearLast = sequence.AddEffect(lastShape, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
                disappearLast.Exit = Office.MsoTriState.msoTrue;
                disappearLast.Timing.TriggerDelayTime = duration;
            }
        }
コード例 #2
0
        //Delete existing animations
        private static void ProcessExistingHighlightSlide(PowerPointSlide currentSlide, List<PowerPoint.Shape> shapesToUse)
        {
            currentSlide.DeleteIndicator();
            currentSlide.DeleteShapesWithPrefix("PPTLabsHighlightBackgroundShape");

            foreach (PowerPoint.Shape tmp in currentSlide.Shapes)
                if (shapesToUse.Contains(tmp))
                    if (userSelection != HighlightTextSelection.kTextSelected)
                        currentSlide.DeleteShapeAnimations(tmp);
        }
コード例 #3
0
ファイル: AutoZoom.cs プロジェクト: oswellchan/PowerPointLabs
 private static void PrepareZoomShape(PowerPointSlide currentSlide, ref PowerPoint.Shape selectedShape)
 {
     currentSlide.DeleteShapeAnimations(selectedShape);
     RemoveTextFromShape(selectedShape);
     selectedShape.Rotation = 0;
 }
コード例 #4
0
        private static void SelectOldShapesToAnimate(PowerPointSlide currentSlide, List<PowerPoint.Shape> shapesToUse)
        {
            List<PowerPoint.Shape> shapesToDelete = new List<PowerPoint.Shape>();
            bool shouldSelect;

            var shapes = currentSlide.GetShapesOrderedByTimeline();
            foreach (var sh in shapes)
            {
                shouldSelect = true; //We should not select existing highlight shapes. Instead they should be deleted
                if (sh.Name.Contains("PPTLabsHighlightBackgroundShape"))
                {
                    if (userSelection != HighlightBackgroundSelection.kTextSelected)
                    {
                        foreach (PowerPoint.Shape tmp in shapesToUse)
                        {
                            //Each highlight shape stores a tag of the shape it is associated with
                            if (sh.Tags["HighlightBackground"].Equals(tmp.Name))
                            {
                                shapesToDelete.Add(sh);
                                shouldSelect = false;
                                break;
                            }
                        }
                    }
                    if (shouldSelect)
                    {
                        currentSlide.DeleteShapeAnimations(sh);
                        sh.Select(Office.MsoTriState.msoFalse);
                    }
                }
                //Remove existing animations for highlight text as well
                if (sh.Name.Contains("HighlightTextShape"))
                    currentSlide.DeleteShapeAnimations(sh);
            }

            if (shapesToDelete.Count > 0)
                foreach (PowerPoint.Shape sh in shapesToDelete)
                    sh.Delete();
        }