public void AddZoomToAreaAnimation(PowerPoint.Shape zoomShape) { PrepareForZoomToArea(); //Create zoomed-in version of the part of the slide specified by zoom shape zoomSlideCroppedShapes.PictureFormat.CropLeft += zoomShape.Left; zoomSlideCroppedShapes.PictureFormat.CropTop += zoomShape.Top; zoomSlideCroppedShapes.PictureFormat.CropRight += (PowerPointPresentation.Current.SlideWidth - (zoomShape.Left + zoomShape.Width)); zoomSlideCroppedShapes.PictureFormat.CropBottom += (PowerPointPresentation.Current.SlideHeight - (zoomShape.Top + zoomShape.Height)); PowerPointLabsGlobals.CopyShapePosition(zoomShape, ref zoomSlideCroppedShapes); zoomSlideCroppedShapes.LockAspectRatio = Office.MsoTriState.msoTrue; if (zoomSlideCroppedShapes.Width > zoomSlideCroppedShapes.Height) { zoomSlideCroppedShapes.Width = PowerPointPresentation.Current.SlideWidth; } else { zoomSlideCroppedShapes.Height = PowerPointPresentation.Current.SlideHeight; } zoomSlideCroppedShapes.Left = (PowerPointPresentation.Current.SlideWidth / 2) - (zoomSlideCroppedShapes.Width / 2); zoomSlideCroppedShapes.Top = (PowerPointPresentation.Current.SlideHeight / 2) - (zoomSlideCroppedShapes.Height / 2); zoomSlideCroppedShapes.PictureFormat.CropLeft = 0; zoomSlideCroppedShapes.PictureFormat.CropTop = 0; zoomSlideCroppedShapes.PictureFormat.CropRight = 0; zoomSlideCroppedShapes.PictureFormat.CropBottom = 0; indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront); }
public void AddZoomToAreaAnimation(PowerPoint.Shape zoomShape) { PrepareForZoomToArea(zoomShape); PowerPoint.Shape shapeToZoom = null, referenceShape = null; if (!ZoomToArea.backgroundZoomChecked) { shapeToZoom = GetShapeToZoom(zoomShape); referenceShape = GetReferenceShape(shapeToZoom); DefaultMotionAnimation.AddDefaultMotionAnimation(this, shapeToZoom, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious); } else { shapeToZoom = zoomSlideCroppedShapes.Duplicate()[1]; DeleteShapeAnimations(shapeToZoom); PowerPointLabsGlobals.CopyShapePosition(zoomSlideCroppedShapes, ref shapeToZoom); referenceShape = GetReferenceShape(zoomShape); DefaultMotionAnimation.AddZoomToAreaMotionAnimation(this, shapeToZoom, zoomShape, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious); } shapeToZoom.Name = "PPTLabsMagnifyAreaSlide" + DateTime.Now.ToString("yyyyMMddHHmmssffff"); referenceShape.Delete(); zoomSlideCroppedShapes.Visible = Office.MsoTriState.msoFalse; indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront); }
//Edit selected spotlight shape to fit within the current slide public PowerPoint.Shape CreateSpotlightShape(PowerPoint.Shape spotShape) { spotShape.Copy(); bool isCallout = false; PowerPoint.Shape spotlightShape; if (spotShape.Type == Office.MsoShapeType.msoCallout) { isCallout = true; } if (isCallout) { spotlightShape = this.Shapes.Paste()[1]; PowerPointLabsGlobals.CopyShapePosition(spotShape, ref spotlightShape); } else { spotlightShape = this.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1]; PowerPointLabsGlobals.CopyShapePosition(spotShape, ref spotlightShape); CropSpotlightPictureToSlide(ref spotlightShape); } PrepareSpotlightShape(ref spotlightShape); return(spotlightShape); }
//Return cropped version of slide picture private PowerPoint.Shape GetShapeToZoom(PowerPoint.Shape zoomShape) { PowerPoint.Shape shapeToZoom = zoomSlideCroppedShapes.Duplicate()[1]; DeleteShapeAnimations(shapeToZoom); PowerPointLabsGlobals.CopyShapePosition(zoomSlideCroppedShapes, ref shapeToZoom); shapeToZoom.PictureFormat.CropLeft += zoomShape.Left; shapeToZoom.PictureFormat.CropTop += zoomShape.Top; shapeToZoom.PictureFormat.CropRight += (PowerPointPresentation.Current.SlideWidth - (zoomShape.Left + zoomShape.Width)); shapeToZoom.PictureFormat.CropBottom += (PowerPointPresentation.Current.SlideHeight - (zoomShape.Top + zoomShape.Height)); PowerPointLabsGlobals.CopyShapePosition(zoomShape, ref shapeToZoom); return(shapeToZoom); }
//Store cropped version of slide picture as global variable private void AddZoomSlideCroppedPicture(PowerPoint.Shape zoomShape) { zoomSlideCroppedShapes = GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0]; zoomSlideCroppedShapes.Visible = Office.MsoTriState.msoTrue; DeleteShapeAnimations(zoomSlideCroppedShapes); if (!ZoomToArea.backgroundZoomChecked) { zoomSlideCroppedShapes.PictureFormat.CropLeft += zoomShape.Left; zoomSlideCroppedShapes.PictureFormat.CropTop += zoomShape.Top; zoomSlideCroppedShapes.PictureFormat.CropRight += (PowerPointPresentation.Current.SlideWidth - (zoomShape.Left + zoomShape.Width)); zoomSlideCroppedShapes.PictureFormat.CropBottom += (PowerPointPresentation.Current.SlideHeight - (zoomShape.Top + zoomShape.Height)); PowerPointLabsGlobals.CopyShapePosition(zoomShape, ref zoomSlideCroppedShapes); } }