private PowerPoint.Shape ConvertToSpotlightPicture(List <PowerPoint.Shape> spotlightShapes)
        {
            Globals.ThisAddIn.Application.ActiveWindow.View.GotoSlide(this.Index);
            List <String> shapeNames = new List <String>();

            shapeNames.Add("SpotlightShape1");
            foreach (PowerPoint.Shape sh in spotlightShapes)
            {
                shapeNames.Add(sh.Name);
            }
            String[] shapeNamesArray       = shapeNames.ToArray();
            PowerPoint.ShapeRange newRange = this.Shapes.Range(shapeNamesArray);
            newRange.Select();

            PowerPoint.Selection currentSelection = Globals.ThisAddIn.Application.ActiveWindow.Selection;

            // Save the original dimensions because ppPastePNG is resized in PowerPoint 2016
            float originalWidth  = currentSelection.ShapeRange[1].Width;
            float originalHeight = currentSelection.ShapeRange[1].Height;

            currentSelection.Cut();

            PowerPoint.Shape spotlightPicture = this.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1];
            spotlightPicture.Width  = originalWidth;
            spotlightPicture.Height = originalHeight;

            return(spotlightPicture);
        }
 public static PowerPoint.ShapeRange Crop(PowerPoint.Selection selection, float aspectRatio)
 {
     PowerPoint.ShapeRange croppedShape = Crop(selection.ShapeRange, aspectRatio);
     if (croppedShape != null)
     {
         croppedShape.Select();
     }
     return(croppedShape);
 }
Esempio n. 3
0
        public ShapeRange SelectShapes(IEnumerable <string> shapeNames)
        {
            ShapeRange range = FunctionalTestExtensions.GetCurrentSlide().Shapes.Range(shapeNames.ToArray());

            if (range.Count > 0)
            {
                range.Select();
                return(range);
            }
            return(null);
        }
Esempio n. 4
0
        public static PowerPoint.ShapeRange ExecuteBlurSelected(Models.PowerPointSlide slide, PowerPoint.Selection selection, int percentage)
        {
            if (!IsValidSelection(selection))
            {
                return(null);
            }

            PowerPoint.ShapeRange range = BlurSelected(slide, selection, percentage);
            if (range != null)
            {
                range.Select();
            }

            return(range);
        }
Esempio n. 5
0
        private PowerPoint.Shape ConvertToSpotlightPicture(List <PowerPoint.Shape> spotlightShapes)
        {
            Globals.ThisAddIn.Application.ActiveWindow.View.GotoSlide(this.Index);
            List <String> shapeNames = new List <String>();

            shapeNames.Add("SpotlightShape1");
            foreach (PowerPoint.Shape sh in spotlightShapes)
            {
                shapeNames.Add(sh.Name);
            }
            String[] shapeNamesArray       = shapeNames.ToArray();
            PowerPoint.ShapeRange newRange = this.Shapes.Range(shapeNamesArray);
            newRange.Select();

            PowerPoint.Selection currentSelection = Globals.ThisAddIn.Application.ActiveWindow.Selection;
            currentSelection.Cut();

            PowerPoint.Shape spotlightPicture = this.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1];
            return(spotlightPicture);
        }