Esempio n. 1
0
        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);
        }
        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);
        }
Esempio n. 3
0
        //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 zoomed version of cropped slide picture to be used for zoom out animation
        private void GetShapeToZoomWithBackground(PowerPoint.Shape zoomShape)
        {
            PowerPoint.Shape referenceShape = GetReferenceShape(zoomShape);

            float finalWidthMagnify    = referenceShape.Width;
            float initialWidthMagnify  = zoomShape.Width;
            float finalHeightMagnify   = referenceShape.Height;
            float initialHeightMagnify = zoomShape.Height;

            zoomShape.Copy();
            PowerPoint.Shape zoomShapeCopy = _slide.Shapes.Paste()[1];
            PowerPointLabsGlobals.CopyShapeAttributes(zoomShape, ref zoomShapeCopy);

            Globals.ThisAddIn.Application.ActiveWindow.View.GotoSlide(_slide.SlideIndex);
            zoomSlideCroppedShapes.Select();
            zoomShapeCopy.Visible = Office.MsoTriState.msoTrue;
            zoomShapeCopy.Select(Office.MsoTriState.msoFalse);
            PowerPoint.ShapeRange selection  = Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange;
            PowerPoint.Shape      groupShape = selection.Group();

            groupShape.Width  *= (finalWidthMagnify / initialWidthMagnify);
            groupShape.Height *= (finalHeightMagnify / initialHeightMagnify);
            groupShape.Ungroup();
            zoomSlideCroppedShapes.Left += (referenceShape.Left - zoomShapeCopy.Left);
            zoomSlideCroppedShapes.Top  += (referenceShape.Top - zoomShapeCopy.Top);
            zoomShapeCopy.Delete();
            referenceShape.Delete();
        }
Esempio n. 5
0
 public void Start()
 {
     try
     {
         var th = new Task(StartDownload);
         th.Start();
     }
     catch (Exception e)
     {
         PowerPointLabsGlobals.LogException(e, "Failed to start thread of Downloader.StartDownload");
     }
 }
Esempio n. 6
0
        //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);
        }
Esempio n. 7
0
 /// <summary>
 /// Save images list
 /// </summary>
 /// <param name="list"></param>
 public static void Save(Collection <ImageItem> list)
 {
     try
     {
         using (var writer = new StreamWriter(GetPath(PictureSlidesLabImagesList)))
         {
             var serializer = new XmlSerializer(list.GetType());
             serializer.Serialize(writer, list);
             writer.Flush();
         }
     }
     catch (Exception e)
     {
         PowerPointLabsGlobals.Log("Failed to save Picture Slides Lab settings: " + e.StackTrace, "Error");
     }
 }
        //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);
            }
        }
Esempio n. 9
0
 public void AddSpotlightEffect(List <PowerPoint.Shape> spotlightShapes)
 {
     try
     {
         PowerPoint.Shape indicatorShape = AddPowerPointLabsIndicator();
         AddRectangleShape();
         PowerPoint.Shape spotlightPicture = ConvertToSpotlightPicture(spotlightShapes);
         FormatSpotlightPicture(spotlightPicture);
         RenderSpotlightPicture(spotlightPicture);
         indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
     }
     catch (Exception e)
     {
         PowerPointLabsGlobals.LogException(e, "AddSpotlightEffect");
         throw;
     }
 }
Esempio n. 10
0
        private string GetVstoVersion(String vstoDirectory)
        {
            var currentVsto = new XmlDocument();

            try
            {
                currentVsto.Load(vstoDirectory);
            }
            catch (Exception e)
            {
                PowerPointLabsGlobals.LogException(e, "GetVstoVersion");
            }
            var vstoNode = currentVsto.GetElementsByTagName("assemblyIdentity")[0];

            return(vstoNode.Attributes != null
                ? vstoNode.Attributes["version"].Value
                : "");
        }
Esempio n. 11
0
 /// <summary>
 /// Load images list
 /// </summary>
 /// <returns></returns>
 public static ObservableCollection <ImageItem> Load()
 {
     try
     {
         using (var stream = File.OpenRead(GetPath(PictureSlidesLabImagesList)))
         {
             var serializer = new XmlSerializer(typeof(ObservableCollection <ImageItem>));
             var list       = serializer.Deserialize(stream) as ObservableCollection <ImageItem>
                              ?? new ObservableCollection <ImageItem>();
             return(list);
         }
     }
     catch (Exception e)
     {
         PowerPointLabsGlobals.Log("Failed to load Picture Slides Lab settings: " + e.StackTrace, "Error");
         return(new ObservableCollection <ImageItem>());
     }
 }
Esempio n. 12
0
        private void StartDownload()
        {
            if (_downloadAddress == "" || _destAddress == "")
            {
                return;
            }

            try
            {
                _client.DownloadFile(_downloadAddress, _destAddress);
                CallAfterDownloadDelegate();
            }
            catch (Exception e)
            {
                CallWhenErrorDelegate(e);
                PowerPointLabsGlobals.LogException(e, "Failed to execute Downloader.StartDownload");
            }
        }
Esempio n. 13
0
 public AssumptionFailedException(string errorMsg) : base(errorMsg)
 {
     PowerPointLabsGlobals.Log("Error", errorMsg);
 }