public bool IsPresentation(IRibbonControl control) { var window = control.Window(); return window != null && window.Presentation != null; }
public void ShowProperties(IRibbonControl control) { var window = control.Window(); Globals.ThisAddIn.ShowProperties(window.Presentation); }
public void InsertSpecialPage(IRibbonControl control) { control.Window().View.Slide = control.Window().Presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); }
public void SavePdf(IRibbonControl control) { using (var dialog = new SaveFileDialog { Filter = "PDF Files (*.pdf)|*.pdf", FileName = Path.ChangeExtension(control.Journal().Presentation.FullName, ".pdf"), Title = "Export PDF" }) { if (dialog.ShowDialog(new ArbitraryWindow((IntPtr)control.Window().HWND)) == DialogResult.Cancel) return; control.Journal().Presentation.ExportAsFixedFormat(dialog.FileName, PpFixedFormatType.ppFixedFormatTypePDF, PpFixedFormatIntent.ppFixedFormatIntentPrint, RangeType: control.Id == "SavePdfSlide" ? PpPrintRangeType.ppPrintCurrent : PpPrintRangeType.ppPrintAll); } }
public void SavePdfTypes(IRibbonControl control) { using (var dialog = new FolderBrowserDialog { Description = "Export PDFs by ad type", ShowNewFolderButton = true }) { if (dialog.ShowDialog(new ArbitraryWindow((IntPtr)control.Window().HWND)) == DialogResult.Cancel) return; var ranges = new List<PageRange>(); var presentation = control.Journal().Presentation; for (int i = 1; i <= presentation.Slides.Count; i++) { var currentType = presentation.Slides[i].CustomLayout.Name; if (ranges.Count == 0 || ranges.Last().Type != currentType) ranges.Add(new PageRange { Type = currentType, Start = i, End = i }); else ranges.Last().End = i; } for (int i = 0; i < ranges.Count; i++) { var range = ranges[i]; presentation.ExportAsFixedFormat( Path.Combine(dialog.SelectedPath, $"{i:00} - {range.Type} " + (range.Start == range.End ? $"(Page {range.Start}).pdf" : $"(Pages {range.Start} - {range.End}).pdf")), PpFixedFormatType.ppFixedFormatTypePDF, PpFixedFormatIntent.ppFixedFormatIntentPrint, PrintRange: presentation.PrintOptions.Ranges.Add(range.Start, range.End), RangeType: PpPrintRangeType.ppPrintSlideRange); } } }
public void ShowImportForm(IRibbonControl control) { if (!control.Journal().ConfirmModification()) return; AppFramework.LoadTables(EmailAddress.Schema, ImportedPayment.Schema); Program.Current.MefContainer.Value .GetExport<Billing.PaymentImport.ImportForm>() .SetPledgeTypes(Names.JournalPledgeType) .RequirePledge() .SetCreationCallback(control.Journal().ImportAd) .SetJournalMode(control.Journal().Year) .Show(new ArbitraryWindow((IntPtr)control.Window().HWND)); }
public void ShowDetailPane(IRibbonControl control) { var window = control.Window(); var jp = control.Journal(); // CustomTaskPanes cannot be reused; I need to create a new one. Globals.ThisAddIn.CustomTaskPanes.Add(new AdPane(jp), "Ad Details", jp.Presentation.Windows[1]).Visible = true; }