private void PrepareForZoomToArea(PowerPointSlide slideToPanFrom, PowerPointSlide slideToPanTo) { //Delete all shapes from slide excpet last magnified shape List <PowerPoint.Shape> shapes = _slide.Shapes.Cast <PowerPoint.Shape>().ToList(); IEnumerable <PowerPoint.Shape> matchingShapes = shapes.Where(current => (!current.Name.Contains("PPTLabsMagnifyAreaGroup"))); foreach (PowerPoint.Shape s in matchingShapes) { s.Delete(); } panShapeFrom = GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0]; panShapeTo = slideToPanTo.GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0]; //Add fade animation to existing shapes shapes = _slide.Shapes.Cast <PowerPoint.Shape>().ToList(); matchingShapes = shapes.Where(current => (!(current.Equals(indicatorShape) || current.Equals(panShapeFrom)))); foreach (PowerPoint.Shape s in matchingShapes) { DeleteShapeAnimations(s); PowerPoint.Effect effectFade = _slide.TimeLine.MainSequence.AddEffect(s, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious); effectFade.Exit = Office.MsoTriState.msoTrue; effectFade.Timing.Duration = 0.25f; } DeleteSlideNotes(); DeleteSlideMedia(); ManageSlideTransitions(); indicatorShape = AddPowerPointLabsIndicator(); }
private void PrepareForZoomToArea(PowerPointSlide slideToPanFrom, PowerPointSlide slideToPanTo) { //Delete all shapes from slide excpet last magnified shape List<PowerPoint.Shape> shapes = _slide.Shapes.Cast<PowerPoint.Shape>().ToList(); var matchingShapes = shapes.Where(current => (!current.Name.Contains("PPTLabsMagnifyAreaGroup"))); foreach (PowerPoint.Shape s in matchingShapes) s.Delete(); panShapeFrom = GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0]; panShapeTo = slideToPanTo.GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0]; //Add fade animation to existing shapes shapes = _slide.Shapes.Cast<PowerPoint.Shape>().ToList(); matchingShapes = shapes.Where(current => (!(current.Equals(indicatorShape) || current.Equals(panShapeFrom)))); foreach (PowerPoint.Shape s in matchingShapes) { DeleteShapeAnimations(s); PowerPoint.Effect effectFade = _slide.TimeLine.MainSequence.AddEffect(s, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious); effectFade.Exit = Office.MsoTriState.msoTrue; effectFade.Timing.Duration = 0.25f; } DeleteSlideNotes(); DeleteSlideMedia(); ManageSlideTransitions(); indicatorShape = AddPowerPointLabsIndicator(); }
/// <summary> /// /// </summary> /// <param name="targetSlide"></param> /// <param name="isLoadingWithDefaultPicture">when no style found, use default picture to preview style</param> /// <returns>is successfully loaded</returns> private bool LoadStyleAndImage(PowerPointSlide targetSlide, bool isLoadingWithDefaultPicture = true) { if (targetSlide == null) return false; var isSuccessfullyLoaded = false; var originalShapeList = targetSlide .GetShapesWithPrefix(ShapeNamePrefix + "_" + EffectName.Original_DO_NOT_REMOVE); var croppedShapeList = targetSlide .GetShapesWithPrefix(ShapeNamePrefix + "_" + EffectName.Cropped_DO_NOT_REMOVE); // if no original shape, show default picture if (originalShapeList.Count == 0 && isLoadingWithDefaultPicture) { // De-select the picture EnterDefaultPictureMode(); UpdatePreviewImages(isEnteringPictureVariation: true); UpdatePreviewStageControls(); isSuccessfullyLoaded = true; } else if (originalShapeList.Count > 0) // load the style { Logger.Log("Original shapes found."); var originalImageShape = originalShapeList[0]; var isImageStillInListBox = false; var styleName = originalImageShape.Tags[Service.Effect.Tag.ReloadPrefix + "StyleName"]; // if the image source is still in the listbox, // select it as source and also select the target style for (var i = 0; i < ImageSelectionListBox.Items.Count; i++) { var imageItem = (ImageItem)ImageSelectionListBox.Items[i]; if (imageItem.FullSizeImageFile == originalImageShape.Tags[Service.Effect.Tag.ReloadOriginImg] || imageItem.ContextLink == originalImageShape.Tags[Service.Effect.Tag.ReloadImgContext]) { isImageStillInListBox = true; UpdatePictureDimensionsInfo(croppedShapeList, originalImageShape, imageItem); ImageSelectionListBox.SelectedIndex = i; // previewing is done async, need to use beginInvoke // so that it's after previewing OpenVariationFlyoutForReload(styleName, originalImageShape); break; } } // if image source is deleted already, need to re-generate images // and put into listbox if (!isImageStillInListBox) { var imageItem = ExtractImageItem(originalImageShape, croppedShapeList); ViewModel.ImageSelectionList.Add(imageItem); ImageSelectionListBox.SelectedIndex = ImageSelectionListBox.Items.Count - 1; OpenVariationFlyoutForReload(styleName, originalImageShape); } isSuccessfullyLoaded = true; } return isSuccessfullyLoaded; }