diff --git a/GreenshotOfficePlugin/OfficeExport/OutlookEmailExporter.cs b/GreenshotOfficePlugin/OfficeExport/OutlookEmailExporter.cs index 14733d626..af0e5e163 100644 --- a/GreenshotOfficePlugin/OfficeExport/OutlookEmailExporter.cs +++ b/GreenshotOfficePlugin/OfficeExport/OutlookEmailExporter.cs @@ -44,6 +44,7 @@ namespace Greenshot.Interop.Office { private const int OUTLOOK_2003 = 11; private const int OUTLOOK_2007 = 12; private const int OUTLOOK_2010 = 14; + private const int OUTLOOK_2013 = 15; // The signature key can be found at: // HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\\9375CFF0413111d3B88A00104B2A6676\ [New Signature] @@ -65,12 +66,26 @@ namespace Greenshot.Interop.Office { return null; } - using (Inspectors inspectors = outlookApplication.Inspectors) { + if (outlookVersion.Major >= OUTLOOK_2013) { + // Check inline "panel" for Outlook 2013 + using (var activeExplorer = outlookApplication.ActiveExplorer()) { + if (activeExplorer != null) { + using (var inlineResponse = activeExplorer.ActiveInlineResponse) { + if (canExportToInspector(inlineResponse, allowMeetingAsTarget)) { + OlObjectClass currentItemClass = inlineResponse.Class; + inspectorCaptions.Add(activeExplorer.Caption, currentItemClass); + } + } + } + } + } + + using (IInspectors inspectors = outlookApplication.Inspectors) { if (inspectors != null && inspectors.Count > 0) { for (int i = 1; i <= inspectors.Count; i++) { - using (Inspector inspector = outlookApplication.Inspectors[i]) { + using (IInspector inspector = outlookApplication.Inspectors[i]) { string inspectorCaption = inspector.Caption; - using (Item currentItem = inspector.CurrentItem) { + using (IItem currentItem = inspector.CurrentItem) { if (canExportToInspector(currentItem, allowMeetingAsTarget)) { OlObjectClass currentItemClass = currentItem.Class; inspectorCaptions.Add(inspector.Caption, currentItemClass); @@ -93,7 +108,7 @@ namespace Greenshot.Interop.Office { /// the Item to check /// bool true if also exporting to meetings /// - private static bool canExportToInspector(Item currentItem, bool allowMeetingAsTarget) { + private static bool canExportToInspector(IItem currentItem, bool allowMeetingAsTarget) { try { if (currentItem != null) { OlObjectClass currentItemClass = currentItem.Class; @@ -133,14 +148,37 @@ namespace Greenshot.Interop.Office { bool allowMeetingAsTarget = true; using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) { if (outlookApplication != null) { - Inspectors inspectors = outlookApplication.Inspectors; + + if (outlookVersion.Major >= OUTLOOK_2013) { + // Check inline "panel" for Outlook 2013 + using (var activeExplorer = outlookApplication.ActiveExplorer()) { + if (activeExplorer != null) { + var currentCaption = activeExplorer.Caption; + if (currentCaption.StartsWith(inspectorCaption)) { + using (var inlineResponse = activeExplorer.ActiveInlineResponse) { + using (IItem currentItem = activeExplorer.ActiveInlineResponse) { + if (canExportToInspector(inlineResponse, allowMeetingAsTarget)) { + try { + return ExportToInspector(activeExplorer, currentItem, tmpFile, attachmentName); + } catch (Exception exExport) { + LOG.Error("Export to " + currentCaption + " failed.", exExport); + } + } + } + } + } + } + } + } + + IInspectors inspectors = outlookApplication.Inspectors; if (inspectors != null && inspectors.Count > 0) { LOG.DebugFormat("Got {0} inspectors to check", inspectors.Count); for (int i = 1; i <= inspectors.Count; i++) { - using (Inspector inspector = outlookApplication.Inspectors[i]) { + using (IInspector inspector = outlookApplication.Inspectors[i]) { string currentCaption = inspector.Caption; if (currentCaption.StartsWith(inspectorCaption)) { - using (Item currentItem = inspector.CurrentItem) { + using (IItem currentItem = inspector.CurrentItem) { if (canExportToInspector(currentItem, allowMeetingAsTarget)) { try { return ExportToInspector(inspector, currentItem, tmpFile, attachmentName); @@ -166,7 +204,7 @@ namespace Greenshot.Interop.Office { /// /// /// - private static bool ExportToInspector(Inspector inspector, Item currentItem, string tmpFile, string attachmentName) { + private static bool ExportToInspector(ICommonExplorer inspectorOrExplorer, IItem currentItem, string tmpFile, string attachmentName) { if (currentItem == null) { LOG.Warn("No current item."); return false; @@ -191,7 +229,7 @@ namespace Greenshot.Interop.Office { // Make sure the inspector is activated, only this way the word editor is active! // This also ensures that the window is visible! - inspector.Activate(); + inspectorOrExplorer.Activate(); bool isTextFormat = false; if (isMail) { isTextFormat = OlBodyFormat.olFormatPlain.Equals(mailItem.BodyFormat); @@ -200,9 +238,19 @@ namespace Greenshot.Interop.Office { // Check for wordmail, if so use the wordexporter // http://msdn.microsoft.com/en-us/library/dd492012%28v=office.12%29.aspx // Earlier versions of Outlook also supported an Inspector.HTMLEditor object property, but since Internet Explorer is no longer the rendering engine for HTML messages and posts, HTMLEditor is no longer supported. - if (inspector.IsWordMail() && inspector.WordEditor != null) { + IWordDocument wordDocument = null; + if (inspectorOrExplorer is IExplorer) { + var explorer = inspectorOrExplorer as IExplorer; + wordDocument = explorer.ActiveInlineResponseWordEditor; + } else if (inspectorOrExplorer is IInspector) { + var inspector = inspectorOrExplorer as IInspector; + if (inspector.IsWordMail()) { + wordDocument = inspector.WordEditor; + } + } + if (wordDocument != null) { try { - if (WordExporter.InsertIntoExistingDocument(inspector.WordEditor.Application, inspector.WordEditor, tmpFile, null, null)) { + if (WordExporter.InsertIntoExistingDocument(wordDocument.Application, wordDocument, tmpFile, null, null)) { LOG.Info("Inserted into Wordmail"); // check the format afterwards, otherwise we lose the selection @@ -240,11 +288,11 @@ namespace Greenshot.Interop.Office { //} bool inlinePossible = false; - if (OlBodyFormat.olFormatHTML.Equals(mailItem.BodyFormat)) { + if (inspectorOrExplorer is IInspector && OlBodyFormat.olFormatHTML.Equals(mailItem.BodyFormat)) { // if html we can try to inline it // The following might cause a security popup... can't ignore it. try { - IHTMLDocument2 document2 = inspector.HTMLEditor as IHTMLDocument2; + IHTMLDocument2 document2 = (inspectorOrExplorer as IInspector).HTMLEditor as IHTMLDocument2; if (document2 != null) { IHTMLSelectionObject selection = document2.selection; if (selection != null) { @@ -254,13 +302,13 @@ namespace Greenshot.Interop.Office { range.pasteHTML("
\""
"); inlinePossible = true; } else { - LOG.DebugFormat("No range for '{0}'", inspector.Caption); + LOG.DebugFormat("No range for '{0}'", inspectorOrExplorer.Caption); } } else { - LOG.DebugFormat("No selection for '{0}'", inspector.Caption); + LOG.DebugFormat("No selection for '{0}'", inspectorOrExplorer.Caption); } } else { - LOG.DebugFormat("No HTML editor for '{0}'", inspector.Caption); + LOG.DebugFormat("No HTML editor for '{0}'", inspectorOrExplorer.Caption); } } catch (Exception e) { // Continue with non inline image @@ -269,24 +317,24 @@ namespace Greenshot.Interop.Office { } // Create the attachment (if inlined the attachment isn't visible as attachment!) - using (Attachment attachment = mailItem.Attachments.Add(tmpFile, OlAttachmentType.olByValue, inlinePossible ? 0 : 1, attachmentName)) { + using (IAttachment attachment = mailItem.Attachments.Add(tmpFile, OlAttachmentType.olByValue, inlinePossible ? 0 : 1, attachmentName)) { if (outlookVersion.Major >= OUTLOOK_2007) { // Add the content id to the attachment, this only works for Outlook >= 2007 try { - PropertyAccessor propertyAccessor = attachment.PropertyAccessor; + IPropertyAccessor propertyAccessor = attachment.PropertyAccessor; propertyAccessor.SetProperty(PropTag.ATTACHMENT_CONTENT_ID, contentID); } catch { } } } } catch (Exception ex) { - LOG.WarnFormat("Problem while trying to add attachment to Item '{0}' : {1}", inspector.Caption, ex); + LOG.WarnFormat("Problem while trying to add attachment to Item '{0}' : {1}", inspectorOrExplorer.Caption, ex); return false; } try { - inspector.Activate(); + inspectorOrExplorer.Activate(); } catch (Exception ex) { - LOG.Warn("Problem activating inspector: ", ex); + LOG.Warn("Problem activating inspector/explorer: ", ex); return false; } LOG.Debug("Finished!"); @@ -299,7 +347,7 @@ namespace Greenshot.Interop.Office { /// /// private static void ExportToNewEmail(IOutlookApplication outlookApplication, EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC, string url) { - Item newItem = outlookApplication.CreateItem(OlItemType.olMailItem); + IItem newItem = outlookApplication.CreateItem(OlItemType.olMailItem); if (newItem == null) { return; } @@ -336,12 +384,12 @@ namespace Greenshot.Interop.Office { default: string contentID = Path.GetFileName(tmpFile); // Create the attachment - using (Attachment attachment = newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 0, attachmentName)) { + using (IAttachment attachment = newMail.Attachments.Add(tmpFile, OlAttachmentType.olByValue, 0, attachmentName)) { // add content ID to the attachment if (outlookVersion.Major >= OUTLOOK_2007) { try { contentID = Guid.NewGuid().ToString(); - PropertyAccessor propertyAccessor = attachment.PropertyAccessor; + IPropertyAccessor propertyAccessor = attachment.PropertyAccessor; propertyAccessor.SetProperty(PropTag.ATTACHMENT_CONTENT_ID, contentID); } catch { LOG.Info("Error working with the PropertyAccessor, using filename as contentid"); diff --git a/GreenshotOfficePlugin/OfficeInterop/ExcelInterop.cs b/GreenshotOfficePlugin/OfficeInterop/ExcelInterop.cs index 333c86289..f2fc13159 100644 --- a/GreenshotOfficePlugin/OfficeInterop/ExcelInterop.cs +++ b/GreenshotOfficePlugin/OfficeInterop/ExcelInterop.cs @@ -22,7 +22,7 @@ namespace Greenshot.Interop.Office { // See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application.aspx [ComProgId("Excel.Application")] - public interface IExcelApplication : Common { + public interface IExcelApplication : ICommon { IWorkbook ActiveWorkbook { get; } //ISelection Selection {get;} IWorkbooks Workbooks { get; } @@ -30,14 +30,14 @@ namespace Greenshot.Interop.Office { } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.aspx - public interface IWorkbooks : Common, Collection { + public interface IWorkbooks : ICommon, ICollection { IWorkbook Add(object template); // Use index + 1!! IWorkbook this[object Index] { get; } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbook.aspx - public interface IWorkbook : Common { + public interface IWorkbook : ICommon { IWorksheet ActiveSheet { get; } string Name { get; } void Activate(); @@ -45,19 +45,19 @@ namespace Greenshot.Interop.Office { } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet_members.aspx - public interface IWorksheet : Common { + public interface IWorksheet : ICommon { IPictures Pictures { get; } IShapes Shapes {get; } string Name { get; } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.iworksheets_members.aspx - public interface IWorksheets : Common, Collection { + public interface IWorksheets : ICommon, ICollection { // Use index + 1!! IWorksheet this[object Index] { get; } } - public interface IPictures : Common, Collection { + public interface IPictures : ICommon, ICollection { // Use index + 1!! //IPicture this[object Index] { get; } void Insert(string file); diff --git a/GreenshotOfficePlugin/OfficeInterop/OfficeInterop.cs b/GreenshotOfficePlugin/OfficeInterop/OfficeInterop.cs index b1fe06003..69cf4cd20 100644 --- a/GreenshotOfficePlugin/OfficeInterop/OfficeInterop.cs +++ b/GreenshotOfficePlugin/OfficeInterop/OfficeInterop.cs @@ -24,7 +24,7 @@ namespace Greenshot.Interop.Office { /// /// If the "type" this[object index] { get; } is implemented, use index + 1!!! (starts at 1) /// - public interface Collection : Common, IEnumerable { + public interface ICollection : ICommon, IEnumerable { int Count { get; } void Remove(int index); } diff --git a/GreenshotOfficePlugin/OfficeInterop/OneNoteInterop.cs b/GreenshotOfficePlugin/OfficeInterop/OneNoteInterop.cs index 23bfb9be2..e28e2938a 100644 --- a/GreenshotOfficePlugin/OfficeInterop/OneNoteInterop.cs +++ b/GreenshotOfficePlugin/OfficeInterop/OneNoteInterop.cs @@ -25,7 +25,7 @@ namespace Greenshot.Interop.Office { // See http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.applicationclass_members%28v=Office.11%29.aspx [ComProgId("OneNote.Application")] - public interface IOneNoteApplication : Common { + public interface IOneNoteApplication : ICommon { /// /// Make sure that the notebookXml is of type string, e.g. "", otherwise a type error occurs. /// For more info on the methods: http://msdn.microsoft.com/en-us/library/gg649853.aspx diff --git a/GreenshotOfficePlugin/OfficeInterop/OutlookInterop.cs b/GreenshotOfficePlugin/OfficeInterop/OutlookInterop.cs index 528dac2e6..bb3d9fbd1 100644 --- a/GreenshotOfficePlugin/OfficeInterop/OutlookInterop.cs +++ b/GreenshotOfficePlugin/OfficeInterop/OutlookInterop.cs @@ -21,27 +21,52 @@ using System; using System.Collections; -/// -/// This utils class should help setting the content-id on the attachment for Outlook < 2007 -/// But this somehow doesn't work yet -/// namespace Greenshot.Interop.Office { + /// + /// Wrapper for Outlook.Application, see: http://msdn.microsoft.com/en-us/library/aa210897%28v=office.11%29.aspx + /// This is the initial COM-Object which is created/retrieved + /// + [ComProgId("Outlook.Application")] + public interface IOutlookApplication : ICommon { + string Name { + get; + } + string Version { + get; + } + IItem CreateItem(OlItemType ItemType); + object CreateItemFromTemplate(string TemplatePath, object InFolder); + object CreateObject(string ObjectName); + IInspector ActiveInspector(); + IInspectors Inspectors { + get; + } + INameSpace GetNameSpace(string type); + IExplorer ActiveExplorer(); + IExplorers Explorers { + get; + } + } + + /// /// See: http://msdn.microsoft.com/en-us/library/bb208387%28v=office.12%29.aspx /// - public interface Items : Collection, IEnumerable { - Item this[object index] { get; } - Item GetFirst(); - Item GetNext(); - Item GetLast(); - Item GetPrevious(); + public interface IItems : ICollection, IEnumerable { + IItem this[object index] { + get; + } + IItem GetFirst(); + IItem GetNext(); + IItem GetLast(); + IItem GetPrevious(); bool IncludeRecurrences { get; set; } - Items Restrict(string filter); + IItems Restrict(string filter); void Sort(string property, object descending); // Actual definition is "object Add( object )", just making it convenient @@ -50,58 +75,137 @@ namespace Greenshot.Interop.Office { // Common attributes of all the Items (MailItem, AppointmentItem) // See: http://msdn.microsoft.com/en-us/library/ff861252.aspx - public interface Item : Common { - Attachments Attachments { get; } - string Body { get; set; } - OlObjectClass Class { get; } - DateTime CreationTime { get; } - string EntryID { get; } - DateTime LastModificationTime { get; } - string MessageClass { get; set; } - bool NoAging { get; set; } - int OutlookInternalVersion { get; } - string OutlookVersion { get; } - bool Saved { get; } - OlSensitivity Sensitivity { get; set; } - int Size { get; } - string Subject { get; set; } - bool UnRead { get; set; } + public interface IItem : ICommon { + IAttachments Attachments { + get; + } + string Body { + get; + set; + } + OlObjectClass Class { + get; + } + DateTime CreationTime { + get; + } + string EntryID { + get; + } + DateTime LastModificationTime { + get; + } + string MessageClass { + get; + set; + } + bool NoAging { + get; + set; + } + int OutlookInternalVersion { + get; + } + string OutlookVersion { + get; + } + bool Saved { + get; + } + OlSensitivity Sensitivity { + get; + set; + } + int Size { + get; + } + string Subject { + get; + set; + } + bool UnRead { + get; + set; + } object Copy(); void Display(bool Modal); void Save(); - PropertyAccessor PropertyAccessor { get; } - Inspector GetInspector(); + IPropertyAccessor PropertyAccessor { + get; + } + IInspector GetInspector(); } // See: http://msdn.microsoft.com/en-us/library/ff861252.aspx // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem.aspx - public interface MailItem : Item, Common { - bool Sent { get; } - object MAPIOBJECT { get; } - string HTMLBody { get; set; } - DateTime ExpiryTime { get; set; } - DateTime ReceivedTime { get; } - string SenderName { get; } - DateTime SentOn { get; } - OlBodyFormat BodyFormat { get; set; } - string To { get; set; } - string CC { get; set; } - string BCC { get; set; } + public interface MailItem : IItem, ICommon { + bool Sent { + get; + } + object MAPIOBJECT { + get; + } + string HTMLBody { + get; + set; + } + DateTime ExpiryTime { + get; + set; + } + DateTime ReceivedTime { + get; + } + string SenderName { + get; + } + DateTime SentOn { + get; + } + OlBodyFormat BodyFormat { + get; + set; + } + string To { + get; + set; + } + string CC { + get; + set; + } + string BCC { + get; + set; + } } // See: http://msdn.microsoft.com/en-us/library/ff869026.aspx // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.appointmentitem.aspx - public interface AppointmentItem : Item, Common { - string Organizer { get; set; } - string SendUsingAccount { get; } - string Categories { get; } - DateTime Start { get; } - DateTime End { get; } - OlReoccurenceState RecurrenceState { get; } + public interface AppointmentItem : IItem, ICommon { + string Organizer { + get; + set; + } + string SendUsingAccount { + get; + } + string Categories { + get; + } + DateTime Start { + get; + } + DateTime End { + get; + } + OlReoccurenceState RecurrenceState { + get; + } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.contactitem.aspx - public interface ContactItem : Item, Common { + public interface IContactItem : IItem, ICommon { bool HasPicture { get; } @@ -118,24 +222,37 @@ namespace Greenshot.Interop.Office { } } - public interface Attachments : Collection { - Attachment Add(object source, object type, object position, object displayName); + public interface IAttachments : ICollection { + IAttachment Add(object source, object type, object position, object displayName); // Use index+1!!!! - Attachment this[object index] { get; } + IAttachment this[object index] { + get; + } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.attachment_members.aspx - public interface Attachment : Common { - string DisplayName { get; set; } - string FileName { get; } - OlAttachmentType Type { get; } - PropertyAccessor PropertyAccessor { get; } - object MAPIOBJECT { get; } + public interface IAttachment : ICommon { + string DisplayName { + get; + set; + } + string FileName { + get; + } + OlAttachmentType Type { + get; + } + IPropertyAccessor PropertyAccessor { + get; + } + object MAPIOBJECT { + get; + } void SaveAsFile(string path); } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.propertyaccessor_members.aspx - public interface PropertyAccessor : Common { + public interface IPropertyAccessor : ICommon { void SetProperty(string SchemaName, Object Value); Object GetProperty(string SchemaName); } @@ -146,74 +263,128 @@ namespace Greenshot.Interop.Office { public static class PropTag { public const string ATTACHMENT_CONTENT_ID = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E"; } - /// - /// Wrapper for Outlook.Application, see: http://msdn.microsoft.com/en-us/library/aa210897%28v=office.11%29.aspx - /// - [ComProgId("Outlook.Application")] - public interface IOutlookApplication : Common { - string Name { get; } - string Version { get; } - Item CreateItem(OlItemType ItemType); - object CreateItemFromTemplate(string TemplatePath, object InFolder); - object CreateObject(string ObjectName); - Inspector ActiveInspector(); - Inspectors Inspectors { get; } - INameSpace GetNameSpace(string type); - } /// /// See: http://msdn.microsoft.com/en-us/library/bb176693%28v=office.12%29.aspx /// - public interface INameSpace : Common { - IRecipient CurrentUser { get; } + public interface INameSpace : ICommon { + IRecipient CurrentUser { + get; + } IFolder GetDefaultFolder(OlDefaultFolders defaultFolder); } /// /// See: http://msdn.microsoft.com/en-us/library/bb176362%28v=office.12%29.aspx /// - public interface IFolder : Common { - Items Items {get;} + public interface IFolder : ICommon { + IItems Items { + get; + } } - public interface IRecipient : Common { - string Name { get; } + public interface IRecipient : ICommon { + string Name { + get; + } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspector_members.aspx - public interface Inspector : Common { - Item CurrentItem { get; } - OlEditorType EditorType { get; } - object ModifiedFormPages { get; } + public interface IInspector : ICommonExplorer { + IItem CurrentItem { + get; + } + OlEditorType EditorType { + get; + } + object ModifiedFormPages { + get; + } void Close(OlInspectorClose SaveMode); void Display(object Modal); void HideFormPage(string PageName); bool IsWordMail(); void SetCurrentFormPage(string PageName); void ShowFormPage(string PageName); - object HTMLEditor { get; } - IWordDocument WordEditor { get; } - string Caption { get; } - int Height { get; set; } - int Left { get; set; } - int Top { get; set; } - int Width { get; set; } - OlWindowState WindowState { get; set; } - void Activate(); + object HTMLEditor { + get; + } + IWordDocument WordEditor { + get; + } void SetControlItemProperty(object Control, string PropertyName); } + /// + /// Is a joined interface of the Explorer an Inspector + /// + public interface ICommonExplorer : ICommon { + void Activate(); + string Caption { + get; + } + int Height { + get; + set; + } + int Left { + get; + set; + } + int Top { + get; + set; + } + int Width { + get; + set; + } + OlWindowState WindowState { + get; + set; + } + } + + /// + /// Since Outlook 2010, but since 2013 one can edit inside an explorer + /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.explorer_members(v=office.15).aspx + /// + /// + public interface IExplorer : ICommonExplorer { + IItem ActiveInlineResponse { + get; + } + IWordDocument ActiveInlineResponseWordEditor { + get; + } + } + + // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._application.inspectors.aspx - public interface Inspectors : Common, Collection, IEnumerable { + public interface IInspectors : ICommon, ICollection, IEnumerable { // Use index + 1!! - Inspector this[Object Index] { get; } + IInspector this[Object Index] { + get; + } + } + + /// + /// Since Outlook 2010, but since 2013 one can edit inside an explorer + /// See: http://msdn.microsoft.com/en-us/library/office/ff867227(v=office.15).aspx + /// + public interface IExplorers : ICommon, ICollection, IEnumerable { + // Use index + 1!! + IExplorer this[Object Index] { + get; + } } /// /// Specifies which EmailFormat the email needs to use /// public enum EmailFormat { - Text, HTML + Text, + HTML } public enum OlBodyFormat { // Fields diff --git a/GreenshotOfficePlugin/OfficeInterop/OutlookUtils.cs b/GreenshotOfficePlugin/OfficeInterop/OutlookUtils.cs index 30d5f3af9..9a38daa9b 100644 --- a/GreenshotOfficePlugin/OfficeInterop/OutlookUtils.cs +++ b/GreenshotOfficePlugin/OfficeInterop/OutlookUtils.cs @@ -652,7 +652,7 @@ namespace Greenshot.Interop.Office { /// /// /// - public static void SetContentID(Attachment attachment, string contentId) { + public static void SetContentID(IAttachment attachment, string contentId) { // Pointer to IUnknown Interface IntPtr IUnknown = IntPtr.Zero; // Pointer to IMAPIProp Interface @@ -715,7 +715,7 @@ namespace Greenshot.Interop.Office { /// /// /// - public static bool SetMAPIProperty(Attachment attachment, PropTags proptag, string propertyValue) { + public static bool SetMAPIProperty(IAttachment attachment, PropTags proptag, string propertyValue) { // Pointer to IUnknown Interface IntPtr IUnknown = IntPtr.Zero; // Pointer to IMAPIProp Interface diff --git a/GreenshotOfficePlugin/OfficeInterop/PowerpointInterop.cs b/GreenshotOfficePlugin/OfficeInterop/PowerpointInterop.cs index 9a5bd8340..daeed366c 100644 --- a/GreenshotOfficePlugin/OfficeInterop/PowerpointInterop.cs +++ b/GreenshotOfficePlugin/OfficeInterop/PowerpointInterop.cs @@ -23,7 +23,7 @@ using System.Collections; namespace Greenshot.Interop.Office { // See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.application_members.aspx [ComProgId("Powerpoint.Application")] - public interface IPowerpointApplication : Common { + public interface IPowerpointApplication : ICommon { IPresentation ActivePresentation { get; } IPresentations Presentations { get; } bool Visible { get; set; } @@ -33,24 +33,24 @@ namespace Greenshot.Interop.Office { } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.slides_members.aspx - public interface ISlides : Common { + public interface ISlides : ICommon { int Count { get; } ISlide Add(int Index, int layout); } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.documentwindow.view.aspx - public interface IPowerpointWindow : Common { + public interface IPowerpointWindow : ICommon { void Activate(); IPowerpointView View { get; } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.view_members.aspx - public interface IPowerpointView : Common { + public interface IPowerpointView : ICommon { IZoom Zoom { get; } void GotoSlide(int index); } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.presentation_members.aspx - public interface IPresentation : Common { + public interface IPresentation : ICommon { string Name { get; } ISlides Slides { get; } IPowerpointApplication Application { get; } @@ -60,19 +60,19 @@ namespace Greenshot.Interop.Office { } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.presentations_members.aspx - public interface IPresentations : Common, Collection { + public interface IPresentations : ICommon, ICollection { IPresentation Add(MsoTriState WithWindow); IPresentation item(int index); } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.pagesetup_members.aspx - public interface IPageSetup : Common, Collection { + public interface IPageSetup : ICommon, ICollection { float SlideWidth { get; set; } float SlideHeight { get; set; } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.slide_members.aspx - public interface ISlide : Common { + public interface ISlide : ICommon { IShapes Shapes { get; } void Select(); int SlideNumber { get; } @@ -80,14 +80,14 @@ namespace Greenshot.Interop.Office { } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.shapes_members.aspx - public interface IShapes : Common, IEnumerable { + public interface IShapes : ICommon, IEnumerable { int Count { get; } IShape item(int index); IShape AddPicture(string FileName, MsoTriState LinkToFile, MsoTriState SaveWithDocument, float Left, float Top, float Width, float Height); } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.shape_members.aspx - public interface IShape : Common { + public interface IShape : ICommon { float Left { get; set; } float Top { get; set; } float Width { get; set; } @@ -99,11 +99,11 @@ namespace Greenshot.Interop.Office { MsoTriState LockAspectRatio { get; set; } } - public interface ITextFrame : Common { + public interface ITextFrame : ICommon { ITextRange TextRange { get; } MsoTriState HasText { get; } } - public interface ITextRange : Common { + public interface ITextRange : ICommon { string Text { get; set; } } diff --git a/GreenshotOfficePlugin/OfficeInterop/WordInterop.cs b/GreenshotOfficePlugin/OfficeInterop/WordInterop.cs index 2904fe7d2..eede30db4 100644 --- a/GreenshotOfficePlugin/OfficeInterop/WordInterop.cs +++ b/GreenshotOfficePlugin/OfficeInterop/WordInterop.cs @@ -22,7 +22,7 @@ namespace Greenshot.Interop.Office { // See http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.applicationclass_members%28v=Office.11%29.aspx [ComProgId("Word.Application")] - public interface IWordApplication : Common { + public interface IWordApplication : ICommon { IWordDocument ActiveDocument { get; } ISelection Selection { get; } IDocuments Documents { get; } @@ -32,7 +32,7 @@ namespace Greenshot.Interop.Office { } // See: http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.documents_members(v=office.11).aspx - public interface IDocuments : Common, Collection { + public interface IDocuments : ICommon, ICollection { IWordDocument Add(ref object Template, ref object NewTemplate, ref object DocumentType, ref object Visible); IWordDocument item(int index); } @@ -40,7 +40,7 @@ namespace Greenshot.Interop.Office { /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document%28v=office.14%29.aspx /// - public interface IWordDocument : Common { + public interface IWordDocument : ICommon { void Activate(); IWordApplication Application { get; } IWordWindow ActiveWindow { get; } @@ -54,7 +54,7 @@ namespace Greenshot.Interop.Office { /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.window_members.aspx /// - public interface IWordWindow : Common { + public interface IWordWindow : ICommon { IPane ActivePane { get; } void Activate(); string Caption { @@ -65,26 +65,26 @@ namespace Greenshot.Interop.Office { /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.pane_members.aspx /// - public interface IPane : Common { + public interface IPane : ICommon { IWordView View { get; } } /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.view_members.aspx /// - public interface IWordView : Common { + public interface IWordView : ICommon { IZoom Zoom { get; } } // See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.zoom_members.aspx - public interface IZoom : Common { + public interface IZoom : ICommon { int Percentage { get; set; } } /// /// See: http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.selection_members(v=office.11).aspx /// - public interface ISelection : Common { + public interface ISelection : ICommon { IInlineShapes InlineShapes { get; } void InsertAfter(string text); } @@ -92,14 +92,14 @@ namespace Greenshot.Interop.Office { /// /// See: http://msdn.microsoft.com/en-us/library/ms263866%28v=office.14%29.aspx /// - public interface IInlineShapes : Common { + public interface IInlineShapes : ICommon { IInlineShape AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Range); } /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.inlineshape_members%28v=office.14%29.aspx /// - public interface IInlineShape : Common { + public interface IInlineShape : ICommon { IHyperlink Hyperlink { get; } MsoTriState LockAspectRatio { get; @@ -110,7 +110,7 @@ namespace Greenshot.Interop.Office { /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.hyperlink_members%28v=office.14%29.aspx /// - public interface IHyperlink : Common { + public interface IHyperlink : ICommon { string Address { get; set; @@ -120,7 +120,7 @@ namespace Greenshot.Interop.Office { /// /// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.hyperlinks%28v=office.14%29.aspx /// - public interface IHyperlinks : Common, Collection { + public interface IHyperlinks : ICommon, ICollection { IHyperlink Add(object Anchor, object Address, object SubAddress, object ScreenTip, object TextToDisplay, object Target); } }