Exemple #1
0
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            base.SetDefaults(surface);
            ExportInformation exportInformation = new ExportInformation(Designation, Description);
            string            tmpFile           = captureDetails.Filename;
            Size imageSize = Size.Empty;

            if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$"))
            {
                tmpFile   = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat());
                imageSize = surface.Image.Size;
            }
            if (_presentationName != null)
            {
                exportInformation.ExportMade = PowerpointExporter.ExportToPresentation(_presentationName, tmpFile, imageSize, captureDetails.Title);
            }
            else
            {
                if (!manuallyInitiated)
                {
                    var presentations = PowerpointExporter.GetPowerpointPresentations();
                    if (presentations != null && presentations.Count > 0)
                    {
                        var destinations = new List <IDestination> {
                            new PowerpointDestination()
                        };
                        foreach (string presentation in presentations)
                        {
                            destinations.Add(new PowerpointDestination(presentation));
                        }
                        // Return the ExportInformation from the picker without processing, as this indirectly comes from us self
                        return(ShowPickerMenu(false, surface, captureDetails, destinations));
                    }
                }
                else if (!exportInformation.ExportMade)
                {
                    exportInformation.ExportMade = PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
                }
            }
            ProcessExport(exportInformation, surface);
            return(exportInformation);
        }
        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            string tmpFile   = captureDetails.Filename;
            Size   imageSize = Size.Empty;

            if (tmpFile == null || surface.Modified)
            {
                using (Image image = surface.GetImageForExport()) {
                    tmpFile   = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors);
                    imageSize = image.Size;
                }
            }
            if (presentationName != null)
            {
                PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title);
            }
            else
            {
                if (!manuallyInitiated)
                {
                    List <string> presentations = PowerpointExporter.GetPowerpointPresentations();
                    if (presentations != null && presentations.Count > 0)
                    {
                        List <IDestination> destinations = new List <IDestination>();
                        destinations.Add(new PowerpointDestination());
                        foreach (string presentation in presentations)
                        {
                            destinations.Add(new PowerpointDestination(presentation));
                        }
                        ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations);
                        PickerDestination.ShowMenuAtCursor(menu);
                        return(false);
                    }
                }
                PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
            }
            surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
            surface.Modified = false;
            return(true);
        }