Fixed plugin loading

Moved all office interop types in their own file.
This commit is contained in:
Krom, Robertus 2020-02-18 15:10:37 +01:00
parent 80d8f51fc5
commit bef29df3db
125 changed files with 1628 additions and 1373 deletions

View file

@ -45,13 +45,9 @@ namespace Greenshot.Destinations {
this.editor = editor;
}
public override string Designation {
get {
return DESIGNATION;
}
}
public override string Designation => DESIGNATION;
public override string Description {
public override string Description {
get {
if (editor == null) {
return Language.GetString(LangKey.settings_destination_editor);
@ -60,25 +56,13 @@ namespace Greenshot.Destinations {
}
}
public override int Priority {
get {
return 1;
}
}
public override int Priority => 1;
public override bool IsDynamic {
get {
return true;
}
}
public override bool IsDynamic => true;
public override Image DisplayIcon {
get {
return greenshotIcon;
}
}
public override Image DisplayIcon => greenshotIcon;
public override IEnumerable<IDestination> DynamicDestinations() {
public override IEnumerable<IDestination> DynamicDestinations() {
foreach (IImageEditor someEditor in ImageEditorForm.Editors) {
yield return new EditorDestination(someEditor);
}
@ -94,12 +78,12 @@ namespace Greenshot.Destinations {
if (editor == null) {
if (editorConfiguration.ReuseEditor) {
foreach(IImageEditor openedEditor in ImageEditorForm.Editors) {
if (!openedEditor.Surface.Modified) {
openedEditor.Surface = surface;
exportInformation.ExportMade = true;
break;
}
}
if (openedEditor.Surface.Modified) continue;
openedEditor.Surface = surface;
exportInformation.ExportMade = true;
break;
}
}
if (!exportInformation.ExportMade) {
try {

View file

@ -39,26 +39,24 @@ namespace Greenshot.Destinations {
static EmailDestination() {
// Logic to decide what email implementation we use
if (EmailConfigHelper.HasMapi()) {
_isActiveFlag = false;
_mapiClient = EmailConfigHelper.GetMapiClient();
if (!string.IsNullOrEmpty(_mapiClient)) {
// Active as we have a mapi client, can be disabled later
_isActiveFlag = true;
}
}
}
if (!EmailConfigHelper.HasMapi()) return;
_isActiveFlag = false;
_mapiClient = EmailConfigHelper.GetMapiClient();
if (!string.IsNullOrEmpty(_mapiClient)) {
// Active as we have a mapi client, can be disabled later
_isActiveFlag = true;
}
}
public override string Designation => DESIGNATION;
public override string Description {
get {
// Make sure there is some kind of "mail" name
if (_mapiClient == null) {
_mapiClient = Language.GetString(LangKey.editor_email);
}
return _mapiClient;
}
get
{
// Make sure there is some kind of "mail" name
return _mapiClient ??= Language.GetString(LangKey.editor_email);
}
}
public override int Priority => 3;

View file

@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
@ -35,54 +36,34 @@ namespace Greenshot.Destinations {
/// </summary>
public class PrinterDestination : AbstractDestination {
public const string DESIGNATION = "Printer";
public readonly string printerName;
private readonly string _printerName;
public PrinterDestination() {
}
public PrinterDestination(string printerName) {
this.printerName = printerName;
}
public override string Designation {
get {
return DESIGNATION;
}
_printerName = printerName;
}
public override string Designation => DESIGNATION;
public override string Description {
public override string Description {
get {
if (printerName != null) {
return Language.GetString(LangKey.settings_destination_printer) + " - " + printerName;
if (_printerName != null) {
return Language.GetString(LangKey.settings_destination_printer) + " - " + _printerName;
}
return Language.GetString(LangKey.settings_destination_printer);
}
}
public override int Priority {
get {
return 2;
}
}
public override int Priority => 2;
public override Keys EditorShortcutKeys {
get {
return Keys.Control | Keys.P;
}
}
public override Keys EditorShortcutKeys => Keys.Control | Keys.P;
public override Image DisplayIcon {
get {
return GreenshotResources.getImage("Printer.Image");
}
}
public override Image DisplayIcon => GreenshotResources.getImage("Printer.Image");
public override bool IsDynamic {
get {
return true;
}
}
public override bool IsDynamic => true;
/// <summary>
/// <summary>
/// Create destinations for all the installed printers
/// </summary>
/// <returns>IEnumerable of IDestination</returns>
@ -101,7 +82,7 @@ namespace Greenshot.Destinations {
if(defaultPrinter.Equals(p2)) {
return 1;
}
return p1.CompareTo(p2);
return string.Compare(p1, p2, StringComparison.Ordinal);
});
foreach(string printer in printers) {
yield return new PrinterDestination(printer);
@ -118,10 +99,10 @@ namespace Greenshot.Destinations {
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description);
PrinterSettings printerSettings;
if (!string.IsNullOrEmpty(printerName))
if (!string.IsNullOrEmpty(_printerName))
{
using PrintHelper printHelper = new PrintHelper(surface, captureDetails);
printerSettings = printHelper.PrintTo(printerName);
printerSettings = printHelper.PrintTo(_printerName);
} else if (!manuallyInitiated) {
PrinterSettings settings = new PrinterSettings();
using PrintHelper printHelper = new PrintHelper(surface, captureDetails);

View file

@ -26,7 +26,7 @@ namespace Greenshot.Drawing.Fields.Binding {
/// </summary>
public class DecimalDoublePercentageConverter : AbstractBindingConverter<double, decimal>
{
private static DecimalDoublePercentageConverter uniqueInstance;
private static DecimalDoublePercentageConverter _uniqueInstance;
private DecimalDoublePercentageConverter() {}
@ -38,10 +38,10 @@ namespace Greenshot.Drawing.Fields.Binding {
return Convert.ToDouble(o)/100;
}
public static DecimalDoublePercentageConverter GetInstance() {
if(uniqueInstance == null) uniqueInstance = new DecimalDoublePercentageConverter();
return uniqueInstance;
}
public static DecimalDoublePercentageConverter GetInstance()
{
return _uniqueInstance ??= new DecimalDoublePercentageConverter();
}
}
}

View file

@ -26,7 +26,7 @@ namespace Greenshot.Drawing.Fields.Binding {
/// </summary>
public class DecimalFloatConverter : AbstractBindingConverter<float, decimal>
{
private static DecimalFloatConverter uniqueInstance;
private static DecimalFloatConverter _uniqueInstance;
private DecimalFloatConverter() {}
@ -38,10 +38,10 @@ namespace Greenshot.Drawing.Fields.Binding {
return Convert.ToInt16(o);
}
public static DecimalFloatConverter GetInstance() {
if(uniqueInstance == null) uniqueInstance = new DecimalFloatConverter();
return uniqueInstance;
}
public static DecimalFloatConverter GetInstance()
{
return _uniqueInstance ??= new DecimalFloatConverter();
}
}
}

View file

@ -26,7 +26,7 @@ namespace Greenshot.Drawing.Fields.Binding {
/// </summary>
public class DecimalIntConverter : AbstractBindingConverter<int, decimal>
{
private static DecimalIntConverter uniqueInstance;
private static DecimalIntConverter _uniqueInstance;
private DecimalIntConverter() {}
@ -38,10 +38,10 @@ namespace Greenshot.Drawing.Fields.Binding {
return Convert.ToInt16(o);
}
public static DecimalIntConverter GetInstance() {
if(uniqueInstance == null) uniqueInstance = new DecimalIntConverter();
return uniqueInstance;
}
public static DecimalIntConverter GetInstance()
{
return _uniqueInstance ??= new DecimalIntConverter();
}
}
}

View file

@ -24,7 +24,7 @@ namespace Greenshot.Drawing.Fields.Binding {
/// Validates a value not to be null.
/// </summary>
public class NotNullValidator : IBindingValidator {
private static NotNullValidator uniqueInstance;
private static NotNullValidator _uniqueInstance;
private NotNullValidator() {
}
@ -33,9 +33,9 @@ namespace Greenshot.Drawing.Fields.Binding {
return o != null;
}
public static NotNullValidator GetInstance() {
if(uniqueInstance == null) uniqueInstance = new NotNullValidator();
return uniqueInstance;
}
public static NotNullValidator GetInstance()
{
return _uniqueInstance ??= new NotNullValidator();
}
}
}

View file

@ -330,7 +330,7 @@ namespace Greenshot {
return base.ProcessCmdKey(ref msg, keyData);
}
} catch (Exception ex) {
LOG.Error(string.Format("Error handling key '{0}'", keyData), ex);
LOG.Error($"Error handling key '{keyData}'", ex);
}
return true;
}

View file

@ -30,8 +30,8 @@ namespace Greenshot.Forms {
/// </summary>
public partial class LanguageDialog : Form {
private static readonly ILog LOG = LogManager.GetLogger(typeof(LanguageDialog));
private static LanguageDialog uniqueInstance;
private bool properOkPressed;
private static LanguageDialog _uniqueInstance;
private bool _properOkPressed;
private LanguageDialog() {
//
@ -44,16 +44,14 @@ namespace Greenshot.Forms {
}
private void PreventFormClose(object sender, FormClosingEventArgs e) {
if(!properOkPressed) {
if(!_properOkPressed) {
e.Cancel = true;
}
}
public string SelectedLanguage {
get { return comboBoxLanguage.SelectedValue.ToString(); }
}
protected void FormLoad(object sender, EventArgs e) {
public string SelectedLanguage => comboBoxLanguage.SelectedValue.ToString();
protected void FormLoad(object sender, EventArgs e) {
// Initialize the Language ComboBox
comboBoxLanguage.DisplayMember = "Description";
comboBoxLanguage.ValueMember = "Ietf";
@ -74,23 +72,21 @@ namespace Greenshot.Forms {
if (Language.SupportedLanguages.Count == 1) {
comboBoxLanguage.SelectedValue = Language.SupportedLanguages[0].Ietf;
Language.CurrentLanguage = SelectedLanguage;
properOkPressed = true;
_properOkPressed = true;
Close();
}
}
private void BtnOKClick(object sender, EventArgs e) {
properOkPressed = true;
_properOkPressed = true;
// Fix for Bug #3431100
Language.CurrentLanguage = SelectedLanguage;
Close();
}
public static LanguageDialog GetInstance() {
if(uniqueInstance == null) {
uniqueInstance = new LanguageDialog();
}
return uniqueInstance;
}
public static LanguageDialog GetInstance()
{
return _uniqueInstance ??= new LanguageDialog();
}
}
}

View file

@ -98,7 +98,7 @@ namespace Greenshot.Helpers
{
environment.Append(", ");
}
environment.Append(string.Format("OS: {0} {1} {2} (x{3}) {4}", OsInfo.Name, OsInfo.Edition, OsInfo.ServicePack, OsInfo.Bits, OsInfo.VersionString));
environment.Append($"OS: {OsInfo.Name} {OsInfo.Edition} {OsInfo.ServicePack} (x{OsInfo.Bits}) {OsInfo.VersionString}");
if (newline)
{
environment.AppendLine();

View file

@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
@ -171,8 +172,9 @@ namespace Greenshot.Helpers {
if (!Directory.Exists(path)) return pluginFiles;
try
{
pluginFiles = Directory.GetFiles(path, "*Plugin.dll", SearchOption.AllDirectories);
pluginFiles = Directory.GetFiles(path, "*Plugin.dll", SearchOption.AllDirectories)
// Skip the GreenshotPlugin.dll itself
.Where(p => CultureInfo.CurrentCulture.CompareInfo.IndexOf(p, "GreenshotPlugin.dll", CompareOptions.IgnoreCase) < 0);
} catch (Exception ex) {
Log.Error("Error loading plugin: ", ex);
}

View file

@ -38,53 +38,43 @@ namespace Greenshot.Processors {
public TitleFixProcessor() {
List<string> corruptKeys = new List<string>();
foreach(string key in config.ActiveTitleFixes) {
if (!config.TitleFixMatcher.ContainsKey(key)) {
LOG.WarnFormat("Key {0} not found, configuration is broken! Disabling this key!");
corruptKeys.Add(key);
}
}
if (config.TitleFixMatcher.ContainsKey(key)) continue;
LOG.WarnFormat("Key {0} not found, configuration is broken! Disabling this key!", key);
corruptKeys.Add(key);
}
// Fix configuration if needed
if(corruptKeys.Count > 0) {
foreach(string corruptKey in corruptKeys) {
// Removing any reference to the key
config.ActiveTitleFixes.Remove(corruptKey);
config.TitleFixMatcher.Remove(corruptKey);
config.TitleFixReplacer.Remove(corruptKey);
}
config.IsDirty = true;
}
}
if (corruptKeys.Count <= 0) return;
foreach(string corruptKey in corruptKeys) {
// Removing any reference to the key
config.ActiveTitleFixes.Remove(corruptKey);
config.TitleFixMatcher.Remove(corruptKey);
config.TitleFixReplacer.Remove(corruptKey);
}
config.IsDirty = true;
}
public override string Designation {
get {
return "TitleFix";
}
}
public override string Designation => "TitleFix";
public override string Description {
get {
return Designation;
}
}
public override string Description => Designation;
public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) {
public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) {
bool changed = false;
string title = captureDetails.Title;
if (!string.IsNullOrEmpty(title)) {
title = title.Trim();
foreach(string titleIdentifier in config.ActiveTitleFixes) {
string regexpString = config.TitleFixMatcher[titleIdentifier];
string replaceString = config.TitleFixReplacer[titleIdentifier];
if (replaceString == null) {
replaceString = "";
}
if (!string.IsNullOrEmpty(regexpString)) {
Regex regex = new Regex(regexpString);
title = regex.Replace(title, replaceString);
changed = true;
}
}
string replaceString = config.TitleFixReplacer[titleIdentifier] ?? "";
if (string.IsNullOrEmpty(regexpString)) continue;
var regex = new Regex(regexpString);
title = regex.Replace(title, replaceString);
changed = true;
}
}
captureDetails.Title = title;
return changed;

View file

@ -31,6 +31,7 @@ namespace GreenshotConfluencePlugin {
/// <summary>
/// This is the ConfluencePlugin base code
/// </summary>
[Plugin("Confluence", true)]
public class ConfluencePlugin : IGreenshotPlugin {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluencePlugin));
private static ConfluenceConnector _confluenceConnector;

View file

@ -45,22 +45,12 @@ namespace GreenshotConfluencePlugin {
private Page _searchPage;
public Page SearchPage {
get {
if (_searchPage == null) {
_searchPage = new ConfluenceSearch(this);
}
return _searchPage;
}
get { return _searchPage ??= new ConfluenceSearch(this); }
}
private Page _browsePage;
public Page BrowsePage {
get {
if (_browsePage == null) {
_browsePage = new ConfluenceTreePicker(this);
}
return _browsePage;
}
get { return _browsePage ??= new ConfluenceTreePicker(this); }
}
private Confluence.Page _selectedPage;
@ -70,11 +60,7 @@ namespace GreenshotConfluencePlugin {
}
set {
_selectedPage = value;
if (_selectedPage != null) {
Upload.IsEnabled = true;
} else {
Upload.IsEnabled = false;
}
Upload.IsEnabled = _selectedPage != null;
IsOpenPageSelected = false;
}
}

View file

@ -25,7 +25,7 @@ namespace TranslationByMarkupExtension {
}
}*/
public static TranslationManager Instance => _translationManager ?? (_translationManager = new TranslationManager());
public static TranslationManager Instance => _translationManager ??= new TranslationManager();
public ITranslationProvider TranslationProvider { get; set; }

View file

@ -18,13 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.IO;
using Greenshot.IniFile;
using GreenshotPlugin.Core;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
/// <summary>
/// Description of FlickrConfiguration.
/// </summary>

View file

@ -18,18 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Threading;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using System.ComponentModel;
using System.Text.RegularExpressions;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
/// <summary>
/// Description of OCRDestination.
/// </summary>
@ -63,12 +64,9 @@ namespace ExternalCommand {
config.RunInbackground.Add(_presetCommand, true);
}
bool runInBackground = config.RunInbackground[_presetCommand];
string fullPath = captureDetails.Filename;
if (fullPath == null) {
fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
}
string fullPath = captureDetails.Filename ?? ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
string output;
string output;
string error;
if (runInBackground) {
Thread commandThread = new Thread(delegate()

View file

@ -18,9 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using GreenshotPlugin.Controls;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
/// <summary>
/// This class is needed for design-time resolving of the language files
/// </summary>

View file

@ -19,16 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
/// <summary>
/// An Plugin to run commands after an image was written
/// </summary>

View file

@ -25,7 +25,7 @@ using System.IO;
using Greenshot.IniFile;
using GreenshotPlugin.Core;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
public static class IconCache {
private static readonly ExternalCommandConfiguration config = IniConfig.GetIniSection<ExternalCommandConfiguration>();
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(IconCache));

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
partial class SettingsForm {
/// <summary>
/// Designer variable used to keep track of non-visual components.

View file

@ -19,12 +19,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
using System;
using System.Drawing;
using System.Windows.Forms;
using Greenshot.IniFile;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
/// <summary>
/// Description of SettingsForm.
/// </summary>

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
partial class SettingsFormDetail {
/// <summary>
/// Designer variable used to keep track of non-visual components.

View file

@ -19,14 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Greenshot.IniFile;
using GreenshotPlugin.Core;
namespace ExternalCommand {
namespace GreenshotExternalCommandPlugin {
/// <summary>
/// Description of SettingsFormDetail.
/// </summary>

View file

@ -35,6 +35,7 @@ namespace GreenshotFlickrPlugin
/// <summary>
/// This is the Flickr base code
/// </summary>
[Plugin("Flickr", true)]
public class FlickrPlugin : IGreenshotPlugin {
private static readonly ILog Log = LogManager.GetLogger(typeof(FlickrPlugin));
private static FlickrConfiguration _config;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<RootNamespace>GreenshotOCR</RootNamespace>
<RootNamespace>GreenshotOCRPlugin</RootNamespace>
<AssemblyName>GreenshotOCRPlugin</AssemblyName>
</PropertyGroup>

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GreenshotOCR
namespace GreenshotOCRPlugin
{
/// <summary>
/// Needed for the drop down, available languages for OCR

View file

@ -18,9 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
namespace GreenshotOCR {
namespace GreenshotOCRPlugin {
/// <summary>
/// Description of CoreConfiguration.
/// </summary>

View file

@ -18,12 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Drawing;
using System.IO;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
namespace GreenshotOCR {
namespace GreenshotOCRPlugin {
/// <summary>
/// Description of OCRDestination.
/// </summary>

View file

@ -21,7 +21,7 @@
using GreenshotPlugin.Controls;
namespace GreenshotOCR {
namespace GreenshotOCRPlugin {
/// <summary>
/// This class is needed for design-time resolving of the language files
/// </summary>

View file

@ -18,6 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Diagnostics;
using System.IO;
@ -29,7 +30,7 @@ using GreenshotPlugin.Effects;
//using Microsoft.Win32;
namespace GreenshotOCR {
namespace GreenshotOCRPlugin {
/// <summary>
/// OCR Plugin Greenshot
/// </summary>
@ -45,14 +46,13 @@ namespace GreenshotOCR {
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
if (disposing) {
if (_ocrMenuItem != null) {
_ocrMenuItem.Dispose();
_ocrMenuItem = null;
}
}
}
protected void Dispose(bool disposing)
{
if (!disposing) return;
if (_ocrMenuItem == null) return;
_ocrMenuItem.Dispose();
_ocrMenuItem = null;
}
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GreenshotOCR
namespace GreenshotOCRPlugin
{
partial class SettingsForm
{

View file

@ -18,9 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
namespace GreenshotOCR {
namespace GreenshotOCRPlugin {
/// <summary>
/// Description of SettingsForm.
/// </summary>

View file

@ -22,12 +22,12 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Interop.Office;
using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotOfficePlugin.OfficeExport;
using GreenshotPlugin.Core;
namespace GreenshotOfficePlugin {
namespace GreenshotOfficePlugin.Destinations {
/// <summary>
/// Description of PowerpointDestination.
/// </summary>

View file

@ -19,15 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.Interop.Office;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Greenshot.Plugin;
using GreenshotOfficePlugin.OfficeExport;
using GreenshotOfficePlugin.OfficeInterop.OneNote;
using GreenshotPlugin.Core;
namespace GreenshotOfficePlugin {
namespace GreenshotOfficePlugin.Destinations {
public class OneNoteDestination : AbstractDestination {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WordDestination));
private const int ICON_APPLICATION = 0;

View file

@ -19,17 +19,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
using Greenshot.Interop.Office;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotOfficePlugin.OfficeExport;
using GreenshotOfficePlugin.OfficeInterop.Outlook;
using GreenshotPlugin.Core;
namespace GreenshotOfficePlugin {
namespace GreenshotOfficePlugin.Destinations {
/// <summary>
/// Description of OutlookDestination.
/// </summary>

View file

@ -22,12 +22,12 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Interop.Office;
using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotOfficePlugin.OfficeExport;
using GreenshotPlugin.Core;
namespace GreenshotOfficePlugin {
namespace GreenshotOfficePlugin.Destinations {
/// <summary>
/// Description of PowerpointDestination.
/// </summary>

View file

@ -19,16 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.Interop.Office;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotOfficePlugin.OfficeExport;
using GreenshotPlugin.Core;
namespace GreenshotOfficePlugin {
namespace GreenshotOfficePlugin.Destinations {
/// <summary>
/// Description of EmailDestination.
/// </summary>

View file

@ -19,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
using Greenshot.Interop.Office;
using GreenshotOfficePlugin.OfficeInterop.Outlook;
using GreenshotOfficePlugin.OfficeInterop.Powerpoint;
namespace GreenshotOfficePlugin {

View file

@ -18,13 +18,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Drawing;
using System.Reflection;
using Greenshot.Interop;
using GreenshotOfficePlugin.OfficeInterop;
using GreenshotOfficePlugin.OfficeInterop.Excel;
using GreenshotOfficePlugin.OfficeInterop.Outlook;
using GreenshotOfficePlugin.OfficeInterop.Powerpoint;
using GreenshotPlugin.Core;
namespace Greenshot.Interop.Office {
namespace GreenshotOfficePlugin.OfficeExport {
public class ExcelExporter {
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(ExcelExporter));
private static Version _excelVersion;
@ -89,22 +95,17 @@ namespace Greenshot.Interop.Office {
/// <param name="imageSize"></param>
private static void InsertIntoExistingWorkbook(IWorkbook workbook, string tmpFile, Size imageSize) {
IWorksheet workSheet = workbook.ActiveSheet;
if (workSheet == null) {
return;
}
using IShapes shapes = workSheet.Shapes;
if (shapes != null)
{
using IShape shape = shapes.AddPicture(tmpFile, MsoTriState.msoFalse, MsoTriState.msoTrue, 0, 0, imageSize.Width, imageSize.Height);
if (shape != null) {
shape.Top = 40;
shape.Left = 40;
shape.LockAspectRatio = MsoTriState.msoTrue;
shape.ScaleHeight(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromTopLeft);
shape.ScaleWidth(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromTopLeft);
}
}
using IShapes shapes = workSheet?.Shapes;
using IShape shape = shapes?.AddPicture(tmpFile, MsoTriState.msoFalse, MsoTriState.msoTrue, 0, 0, imageSize.Width, imageSize.Height);
if (shape == null) return;
shape.Top = 40;
shape.Left = 40;
shape.LockAspectRatio = MsoTriState.msoTrue;
shape.ScaleHeight(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromTopLeft);
shape.ScaleWidth(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromTopLeft);
}
/// <summary>

View file

@ -19,15 +19,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Runtime.InteropServices;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Xml;
using Greenshot.Interop;
using Greenshot.Plugin;
using GreenshotOfficePlugin.OfficeInterop.OneNote;
using GreenshotPlugin.Core;
namespace Greenshot.Interop.Office {
namespace GreenshotOfficePlugin.OfficeExport {
public class OneNoteExporter {
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(OneNoteExporter));

View file

@ -18,17 +18,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.Win32;
using Greenshot.Interop.IE;
using GreenshotOfficePlugin;
using System.Text;
using Greenshot.IniFile;
using Greenshot.Interop;
using Greenshot.Interop.IE;
using GreenshotOfficePlugin.OfficeInterop;
using GreenshotOfficePlugin.OfficeInterop.Outlook;
using GreenshotOfficePlugin.OfficeInterop.Word;
using Microsoft.Win32;
namespace Greenshot.Interop.Office {
namespace GreenshotOfficePlugin.OfficeExport {
/// <summary>
/// Outlook exporter has all the functionality to export to outlook
/// </summary>

View file

@ -19,13 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.IniFile;
using GreenshotOfficePlugin;
using System;
using System.Collections.Generic;
using System.Drawing;
using Greenshot.IniFile;
using Greenshot.Interop;
using GreenshotOfficePlugin.OfficeInterop;
using GreenshotOfficePlugin.OfficeInterop.Outlook;
using GreenshotOfficePlugin.OfficeInterop.Powerpoint;
namespace Greenshot.Interop.Office {
namespace GreenshotOfficePlugin.OfficeExport {
public class PowerpointExporter {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PowerpointExporter));
private static Version _powerpointVersion;

View file

@ -18,13 +18,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using GreenshotOfficePlugin;
using Greenshot.IniFile;
using Greenshot.Interop;
using GreenshotOfficePlugin.OfficeInterop;
using GreenshotOfficePlugin.OfficeInterop.Outlook;
using GreenshotOfficePlugin.OfficeInterop.Word;
using GreenshotPlugin.Core;
namespace Greenshot.Interop.Office {
namespace GreenshotOfficePlugin.OfficeExport {
public class WordExporter {
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(WordExporter));
private static Version _wordVersion;

View file

@ -19,21 +19,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Greenshot.Interop.Office {
// See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application.aspx
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Excel {
/// <summary>
/// See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application.aspx
/// </summary>
[ComProgId("Excel.Application")]
public interface IExcelApplication : ICommon {
IWorkbook ActiveWorkbook {
get;
}
//ISelection Selection {get;}
IWorkbooks Workbooks {
get;
}
bool Visible {
get;
set;
}
string Version {
get;
}
@ -46,54 +53,4 @@ namespace Greenshot.Interop.Office {
get;
}
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.aspx
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 : ICommon {
IWorksheet ActiveSheet {
get;
}
string Name {
get;
}
void Activate();
IWorksheets Worksheets {
get;
}
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet_members.aspx
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 : ICollection {
// Use index + 1!!
IWorksheet this[object index] {
get;
}
}
public interface IPictures : ICollection {
// Use index + 1!!
//IPicture this[object Index] { get; }
void Insert(string file);
}
}

View file

@ -0,0 +1,8 @@
namespace GreenshotOfficePlugin.OfficeInterop.Excel
{
public interface IPictures : ICollection {
// Use index + 1!!
//IPicture this[object Index] { get; }
void Insert(string file);
}
}

View file

@ -0,0 +1,20 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Excel
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbook.aspx
/// </summary>
public interface IWorkbook : ICommon {
IWorksheet ActiveSheet {
get;
}
string Name {
get;
}
void Activate();
IWorksheets Worksheets {
get;
}
}
}

View file

@ -0,0 +1,15 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Excel
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.aspx
/// </summary>
public interface IWorkbooks : ICommon, ICollection {
IWorkbook Add(object template);
// Use index + 1!!
IWorkbook this[object index] {
get;
}
}
}

View file

@ -0,0 +1,20 @@
using Greenshot.Interop;
using GreenshotOfficePlugin.OfficeInterop.Powerpoint;
namespace GreenshotOfficePlugin.OfficeInterop.Excel
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._worksheet_members.aspx
/// </summary>
public interface IWorksheet : ICommon {
IPictures Pictures {
get;
}
IShapes Shapes {
get;
}
string Name {
get;
}
}
}

View file

@ -0,0 +1,12 @@
namespace GreenshotOfficePlugin.OfficeInterop.Excel
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.iworksheets_members.aspx
/// </summary>
public interface IWorksheets : ICollection {
// Use index + 1!!
IWorksheet this[object index] {
get;
}
}
}

View file

@ -18,20 +18,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Collections;
using Greenshot.Interop;
namespace Greenshot.Interop.Office {
public enum OfficeVersion : int {
OFFICE_97 = 8,
OFFICE_2000 = 9,
OFFICE_2002 = 10,
OFFICE_2003 = 11,
OFFICE_2007 = 12,
OFFICE_2010 = 14,
OFFICE_2013 = 15
}
/// <summary>
namespace GreenshotOfficePlugin.OfficeInterop {
/// <summary>
/// If the "type" this[object index] { get; } is implemented, use index + 1!!! (starts at 1)
/// </summary>
public interface ICollection : ICommon, IEnumerable {

View file

@ -0,0 +1,8 @@
namespace GreenshotOfficePlugin.OfficeInterop
{
public enum MsoScaleFrom {
msoScaleFromTopLeft = 0,
msoScaleFromMiddle = 1,
msoScaleFromBottomRight = 2
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop
{
public enum MsoTriState {
msoTrue = -1,
msoFalse = 0,
msoCTrue = 1,
msoTriStateToggle = -3,
msoTriStateMixed = -2
}
}

View file

@ -0,0 +1,12 @@
namespace GreenshotOfficePlugin.OfficeInterop
{
public enum OfficeVersion : int {
OFFICE_97 = 8,
OFFICE_2000 = 9,
OFFICE_2002 = 10,
OFFICE_2003 = 11,
OFFICE_2007 = 12,
OFFICE_2010 = 14,
OFFICE_2013 = 15
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public enum HierarchyScope {
hsSelf = 0, // Gets just the start node specified and no descendants.
hsChildren = 1, //Gets the immediate child nodes of the start node, and no descendants in higher or lower subsection groups.
hsNotebooks = 2, // Gets all notebooks below the start node, or root.
hsSections = 3, //Gets all sections below the start node, including sections in section groups and subsection groups.
hsPages = 4 //Gets all pages below the start node, including all pages in section groups and subsection groups.
}
}

View file

@ -0,0 +1,19 @@
using System;
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
[ComProgId("OneNote.Application")]
public interface IOneNoteApplication : ICommon {
/// <summary>
/// Make sure that the out variables are filled with a string, e.g. "", otherwise a type error occurs.
/// For more info on the methods: http://msdn.microsoft.com/en-us/library/gg649853.aspx
/// </summary>
void GetHierarchy(string startNode, HierarchyScope scope, out string notebookXml, XMLSchema schema);
void GetSpecialLocation(SpecialLocation specialLocation, out string specialLocationPath);
void UpdatePageContent(string pageChangesXml, DateTime dateExpectedLastModified, XMLSchema schema, bool force);
void GetPageContent(string pageId, out string pageXml, PageInfo pageInfoToExport, XMLSchema schema);
void NavigateTo(string hierarchyObjectID, string objectId, bool newWindow);
void CreateNewPage(string sectionID, out string pageID, NewPageStyle newPageStyle);
}
}

View file

@ -0,0 +1,8 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public enum NewPageStyle {
npsDefault = 0,
npsBlankPageWithTitle = 1,
npsBlankPageNoTitle = 2
}
}

View file

@ -0,0 +1,7 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public class OneNoteNotebook {
public string Name { get; set; }
public string ID { get; set; }
}
}

View file

@ -0,0 +1,43 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GreenshotOfficePlugin.OfficeInterop.OneNote {
// More details about OneNote: http://msdn.microsoft.com/en-us/magazine/ff796230.aspx
// See http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.applicationclass_members%28v=Office.11%29.aspx
public class OneNotePage {
public OneNoteSection Parent { get; set; }
public string Name { get; set; }
public string ID { get; set; }
public bool IsCurrentlyViewed { get; set; }
public string DisplayName {
get {
OneNoteNotebook notebook = Parent.Parent;
if(string.IsNullOrEmpty(notebook.Name)) {
return $"{Parent.Name} / {Name}";
}
return $"{Parent.Parent.Name} / {Parent.Name} / {Name}";
}
}
}
}

View file

@ -0,0 +1,8 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public class OneNoteSection {
public OneNoteNotebook Parent { get; set; }
public string Name { get; set; }
public string ID { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public enum PageInfo {
piBasic = 0, // Returns only basic page content, without selection markup and binary data objects. This is the standard value to pass.
piBinaryData = 1, // Returns page content with no selection markup, but with all binary data.
piSelection = 2, // Returns page content with selection markup, but no binary data.
piBinaryDataSelection = 3, // Returns page content with selection markup and all binary data.
piAll = 3 // Returns all page content.
}
}

View file

@ -0,0 +1,8 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public enum SpecialLocation : int {
slBackupFolder = 0,
slUnfiledNotesSection = 1,
slDefaultNotebookFolder = 2
}
}

View file

@ -0,0 +1,8 @@
namespace GreenshotOfficePlugin.OfficeInterop.OneNote
{
public enum XMLSchema {
xs2007 = 0,
xs2010 = 1,
xsCurrent= xs2010
}
}

View file

@ -1,103 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
namespace Greenshot.Interop.Office {
// More details about OneNote: http://msdn.microsoft.com/en-us/magazine/ff796230.aspx
// 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 : ICommon {
/// <summary>
/// Make sure that the out variables are filled with a string, e.g. "", otherwise a type error occurs.
/// For more info on the methods: http://msdn.microsoft.com/en-us/library/gg649853.aspx
/// </summary>
void GetHierarchy(string startNode, HierarchyScope scope, out string notebookXml, XMLSchema schema);
void GetSpecialLocation(SpecialLocation specialLocation, out string specialLocationPath);
void UpdatePageContent(string pageChangesXml, DateTime dateExpectedLastModified, XMLSchema schema, bool force);
void GetPageContent(string pageId, out string pageXml, PageInfo pageInfoToExport, XMLSchema schema);
void NavigateTo(string hierarchyObjectID, string objectId, bool newWindow);
void CreateNewPage(string sectionID, out string pageID, NewPageStyle newPageStyle);
}
public enum PageInfo {
piBasic = 0, // Returns only basic page content, without selection markup and binary data objects. This is the standard value to pass.
piBinaryData = 1, // Returns page content with no selection markup, but with all binary data.
piSelection = 2, // Returns page content with selection markup, but no binary data.
piBinaryDataSelection = 3, // Returns page content with selection markup and all binary data.
piAll = 3 // Returns all page content.
}
public enum HierarchyScope {
hsSelf = 0, // Gets just the start node specified and no descendants.
hsChildren = 1, //Gets the immediate child nodes of the start node, and no descendants in higher or lower subsection groups.
hsNotebooks = 2, // Gets all notebooks below the start node, or root.
hsSections = 3, //Gets all sections below the start node, including sections in section groups and subsection groups.
hsPages = 4 //Gets all pages below the start node, including all pages in section groups and subsection groups.
}
public enum XMLSchema {
xs2007 = 0,
xs2010 = 1,
xsCurrent= xs2010
}
public enum SpecialLocation : int {
slBackupFolder = 0,
slUnfiledNotesSection = 1,
slDefaultNotebookFolder = 2
}
public enum NewPageStyle {
npsDefault = 0,
npsBlankPageWithTitle = 1,
npsBlankPageNoTitle = 2
}
public class OneNotePage {
public OneNoteSection Parent { get; set; }
public string Name { get; set; }
public string ID { get; set; }
public bool IsCurrentlyViewed { get; set; }
public string DisplayName {
get {
OneNoteNotebook notebook = Parent.Parent;
if(string.IsNullOrEmpty(notebook.Name)) {
return string.Format("{0} / {1}", Parent.Name, Name);
} else {
return string.Format("{0} / {1} / {2}", Parent.Parent.Name, Parent.Name, Name);
}
}
}
}
public class OneNoteSection {
public OneNoteNotebook Parent { get; set; }
public string Name { get; set; }
public string ID { get; set; }
}
public class OneNoteNotebook {
public string Name { get; set; }
public string ID { get; set; }
}
}

View file

@ -0,0 +1,31 @@
using System;
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/ff869026.aspx
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.appointmentitem.aspx
/// </summary>
public interface AppointmentItem : IItem, ICommon {
string Organizer {
get;
set;
}
string SendUsingAccount {
get;
}
string Categories {
get;
}
DateTime Start {
get;
}
DateTime End {
get;
}
OlReoccurenceState RecurrenceState {
get;
}
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// Specifies which EmailFormat the email needs to use
/// </summary>
public enum EmailFormat {
Text,
HTML
}
}

View file

@ -0,0 +1,27 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.attachment_members.aspx
/// </summary>
public interface IAttachment : ICommon {
string DisplayName {
get;
set;
}
string FileName {
get;
}
OlAttachmentType Type {
get;
}
IPropertyAccessor PropertyAccessor {
get;
}
object MAPIOBJECT {
get;
}
void SaveAsFile(string path);
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public interface IAttachments : ICollection {
IAttachment Add(object source, object type, object position, object displayName);
// Use index+1!!!!
IAttachment this[object index] {
get;
}
}
}

View file

@ -0,0 +1,34 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// Is a joined interface of the Explorer an Inspector
/// </summary>
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;
}
}
}

View file

@ -0,0 +1,24 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.contactitem.aspx
/// </summary>
public interface IContactItem : IItem, ICommon {
bool HasPicture {
get;
}
void SaveBusinessCardImage(string path);
void AddPicture(string path);
void RemovePicture();
string FirstName {
get;
set;
}
string LastName {
get;
set;
}
}
}

View file

@ -0,0 +1,18 @@
using GreenshotOfficePlugin.OfficeInterop.Word;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// 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
///
/// </summary>
public interface IExplorer : ICommonExplorer {
IItem ActiveInlineResponse {
get;
}
IWordDocument ActiveInlineResponseWordEditor {
get;
}
}
}

View file

@ -0,0 +1,16 @@
using System.Collections;
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// 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
/// </summary>
public interface IExplorers : ICommon, ICollection, IEnumerable {
// Use index + 1!!
IExplorer this[object Index] {
get;
}
}
}

View file

@ -0,0 +1,13 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb176362%28v=office.12%29.aspx
/// </summary>
public interface IFolder : ICommon {
IItems Items {
get;
}
}
}

View file

@ -0,0 +1,32 @@
using GreenshotOfficePlugin.OfficeInterop.Word;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspector_members.aspx
/// </summary>
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;
}
void SetControlItemProperty(object Control, string PropertyName);
}
}

View file

@ -0,0 +1,15 @@
using System.Collections;
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._application.inspectors.aspx
/// </summary>
public interface IInspectors : ICommon, ICollection, IEnumerable {
// Use index + 1!!
IInspector this[object Index] {
get;
}
}
}

View file

@ -0,0 +1,70 @@
using System;
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// Common attributes of all the Items (MailItem, AppointmentItem)
/// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
/// </summary>
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();
IPropertyAccessor PropertyAccessor {
get;
}
IInspector GetInspector();
}
}

View file

@ -0,0 +1,28 @@
using System.Collections;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb208387%28v=office.12%29.aspx
/// </summary>
public interface IItems : ICollection, IEnumerable {
IItem this[object index] {
get;
}
IItem GetFirst();
IItem GetNext();
IItem GetLast();
IItem GetPrevious();
bool IncludeRecurrences {
get;
set;
}
IItems Restrict(string filter);
void Sort(string property, object descending);
// Actual definition is "object Add( object )", just making it convenient
object Add(OlItemType type);
}
}

View file

@ -0,0 +1,14 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb176693%28v=office.12%29.aspx
/// </summary>
public interface INameSpace : ICommon {
IRecipient CurrentUser {
get;
}
IFolder GetDefaultFolder(OlDefaultFolders defaultFolder);
}
}

View file

@ -0,0 +1,30 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// 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
/// </summary>
[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;
}
}
}

View file

@ -0,0 +1,12 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.propertyaccessor_members.aspx
/// </summary>
public interface IPropertyAccessor : ICommon {
void SetProperty(string SchemaName, object Value);
object GetProperty(string SchemaName);
}
}

View file

@ -0,0 +1,10 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public interface IRecipient : ICommon {
string Name {
get;
}
}
}

View file

@ -0,0 +1,51 @@
using System;
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem.aspx
/// </summary>
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;
}
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlAttachmentType {
// Fields
olByReference = 4,
olByValue = 1,
olEmbeddeditem = 5,
olOLE = 6
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlBodyFormat {
// Fields
olFormatHTML = 2,
olFormatPlain = 1,
olFormatRichText = 3,
olFormatUnspecified = 0
}
}

View file

@ -0,0 +1,24 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlDefaultFolders {
olFolderCalendar = 9, // The Calendar folder.
olFolderConflicts = 19, // The Conflicts folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderContacts = 10, // The Contacts folder.
olFolderDeletedItems = 3, // The Deleted Items folder.
olFolderDrafts = 16, // The Drafts folder.
olFolderInbox = 6, // The Inbox folder.
olFolderJournal = 11, // The Journal folder.
olFolderJunk = 23, // The Junk E-Mail folder.
olFolderLocalFailures = 21, // The Local Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderManagedEmail = 29, // The top-level folder in the Managed Folders group. For more information on Managed Folders, see Help in Microsoft Outlook. Only available for an Exchange account.
olFolderNotes = 12, // The Notes folder.
olFolderOutbox = 4, // The Outbox folder.
olFolderSentMail = 5, // The Sent Mail folder.
olFolderServerFailures = 22, // The Server Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderSyncIssues = 20, // The Sync Issues folder. Only available for an Exchange account.
olFolderTasks = 13, // The Tasks folder.
olFolderToDo = 28, // The To Do folder.
olPublicFoldersAllPublicFolders = 18, // The All Public Folders folder in the Exchange Public Folders store. Only available for an Exchange account.
olFolderRssFeeds = 25 // The RSS Feeds folder.
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlEditorType {
// Fields
olEditorHTML = 2,
olEditorRTF = 3,
olEditorText = 1,
olEditorWord = 4
}
}

View file

@ -0,0 +1,9 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlInspectorClose {
// Fields
olDiscard = 1,
olPromptForSave = 2,
olSave = 0
}
}

View file

@ -0,0 +1,14 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlItemType {
// Fields
olAppointmentItem = 1,
olContactItem = 2,
olDistributionListItem = 7,
olJournalItem = 4,
olMailItem = 0,
olNoteItem = 5,
olPostItem = 6,
olTaskItem = 3
}
}

View file

@ -0,0 +1,151 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/ff863329.aspx
/// </summary>
public enum OlObjectClass {
olAccount = 105, // Represents an Account object.
olAccountRuleCondition = 135, // Represents an AccountRuleCondition object.
olAccounts = 106, // Represents an Accounts object.
olAction = 32, // Represents an Action object.
olActions = 33, // Represents an Actions object.
olAddressEntries = 21, // Represents an AddressEntries object.
olAddressEntry = 8, // Represents an AddressEntry object.
olAddressList = 7, // Represents an AddressList object.
olAddressLists = 20, // Represents an AddressLists object.
olAddressRuleCondition = 170, // Represents an AddressRuleCondition object.
olApplication = 0, // Represents an Application object.
olAppointment = 26, // Represents an AppointmentItem object.
olAssignToCategoryRuleAction = 122, // Represents an AssignToCategoryRuleAction object.
olAttachment = 5, // Represents an Attachment object.
olAttachments = 18, // Represents an Attachments object.
olAttachmentSelection = 169, // Represents an AttachmentSelection object.
olAutoFormatRule = 147, // Represents an AutoFormatRule object.
olAutoFormatRules = 148, // Represents an AutoFormatRules object.
olCalendarModule = 159, // Represents a CalendarModule object.
olCalendarSharing = 151, // Represents a CalendarSharing object.
olCategories = 153, // Represents a Categories object.
olCategory = 152, // Represents a Category object.
olCategoryRuleCondition = 130, // Represents a CategoryRuleCondition object.
olClassBusinessCardView = 168, // Represents a BusinessCardView object.
olClassCalendarView = 139, // Represents a CalendarView object.
olClassCardView = 138, // Represents a CardView object.
olClassIconView = 137, // Represents a IconView object.
olClassNavigationPane = 155, // Represents a NavigationPane object.
olClassTableView = 136, // Represents a TableView object.
olClassTimeLineView = 140, // Represents a TimelineView object.
olClassTimeZone = 174, // Represents a TimeZone object.
olClassTimeZones = 175, // Represents a TimeZones object.
olColumn = 154, // Represents a Column object.
olColumnFormat = 149, // Represents a ColumnFormat object.
olColumns = 150, // Represents a Columns object.
olConflict = 102, // Represents a Conflict object.
olConflicts = 103, // Represents a Conflicts object.
olContact = 40, // Represents a ContactItem object.
olContactsModule = 160, // Represents a ContactsModule object.
olDistributionList = 69, // Represents a ExchangeDistributionList object.
olDocument = 41, // Represents a DocumentItem object.
olException = 30, // Represents an Exception object.
olExceptions = 29, // Represents an Exceptions object.
olExchangeDistributionList = 111, // Represents an ExchangeDistributionList object.
olExchangeUser = 110, // Represents an ExchangeUser object.
olExplorer = 34, // Represents an Explorer object.
olExplorers = 60, // Represents an Explorers object.
olFolder = 2, // Represents a Folder object.
olFolders = 15, // Represents a Folders object.
olFolderUserProperties = 172, // Represents a UserDefinedProperties object.
olFolderUserProperty = 171, // Represents a UserDefinedProperty object.
olFormDescription = 37, // Represents a FormDescription object.
olFormNameRuleCondition = 131, // Represents a FormNameRuleCondition object.
olFormRegion = 129, // Represents a FormRegion object.
olFromRssFeedRuleCondition = 173, // Represents a FromRssFeedRuleCondition object.
olFromRuleCondition = 132, // Represents a ToOrFromRuleCondition object.
olImportanceRuleCondition = 128, // Represents an ImportanceRuleCondition object.
olInspector = 35, // Represents an Inspector object.
olInspectors = 61, // Represents an Inspectors object.
olItemProperties = 98, // Represents an ItemProperties object.
olItemProperty = 99, // Represents an ItemProperty object.
olItems = 16, // Represents an Items object.
olJournal = 42, // Represents a JournalItem object.
olJournalModule = 162, // Represents a JournalModule object.
olLink = 75, // Represents a Link object.
olLinks = 76, // Represents a Links object.
olMail = 43, // Represents a MailItem object.
olMailModule = 158, // Represents a MailModule object.
olMarkAsTaskRuleAction = 124, // Represents a MarkAsTaskRuleAction object.
olMeetingCancellation = 54, // Represents a MeetingItem object that is a meeting cancellation notice.
olMeetingRequest = 53, // Represents a MeetingItem object that is a meeting request.
olMeetingResponseNegative = 55, // Represents a MeetingItem object that is a refusal of a meeting request.
olMeetingResponsePositive = 56, // Represents a MeetingItem object that is an acceptance of a meeting request.
olMeetingResponseTentative = 57, // Represents a MeetingItem object that is a tentative acceptance of a meeting request.
olMoveOrCopyRuleAction = 118, // Represents a MoveOrCopyRuleAction object.
olNamespace = 1, // Represents a NameSpace object.
olNavigationFolder = 167, // Represents a NavigationFolder object.
olNavigationFolders = 166, // Represents a NavigationFolders object.
olNavigationGroup = 165, // Represents a NavigationGroup object.
olNavigationGroups = 164, // Represents a NavigationGroups object.
olNavigationModule = 157, // Represents a NavigationModule object.
olNavigationModules = 156, // Represents a NavigationModules object.
olNewItemAlertRuleAction = 125, // Represents a NewItemAlertRuleAction object.
olNote = 44, // Represents a NoteItem object.
olNotesModule = 163, // Represents a NotesModule object.
olOrderField = 144, // Represents an OrderField object.
olOrderFields = 145, // Represents an OrderFields object.
olOutlookBarGroup = 66, // Represents an OutlookBarGroup object.
olOutlookBarGroups = 65, // Represents an OutlookBarGroups object.
olOutlookBarPane = 63, // Represents an OutlookBarPane object.
olOutlookBarShortcut = 68, // Represents an OutlookBarShortcut object.
olOutlookBarShortcuts = 67, // Represents an OutlookBarShortcuts object.
olOutlookBarStorage = 64, // Represents an OutlookBarStorage object.
olPages = 36, // Represents a Pages object.
olPanes = 62, // Represents a Panes object.
olPlaySoundRuleAction = 123, // Represents a PlaySoundRuleAction object.
olPost = 45, // Represents a PostItem object.
olPropertyAccessor = 112, // Represents a PropertyAccessor object.
olPropertyPages = 71, // Represents a PropertyPages object.
olPropertyPageSite = 70, // Represents a PropertyPageSite object.
olRecipient = 4, // Represents a Recipient object.
olRecipients = 17, // Represents a Recipients object.
olRecurrencePattern = 28, // Represents a RecurrencePattern object.
olReminder = 101, // Represents a Reminder object.
olReminders = 100, // Represents a Reminders object.
olRemote = 47, // Represents a RemoteItem object.
olReport = 46, // Represents a ReportItem object.
olResults = 78, // Represents a Results object.
olRow = 121, // Represents a Row object.
olRule = 115, // Represents a Rule object.
olRuleAction = 117, // Represents a RuleAction object.
olRuleActions = 116, // Represents a RuleAction object.
olRuleCondition = 127, // Represents a RuleCondition object.
olRuleConditions = 126, // Represents a RuleConditions object.
olRules = 114, // Represents a Rules object.
olSearch = 77, // Represents a Search object.
olSelection = 74, // Represents a Selection object.
olSelectNamesDialog = 109, // Represents a SelectNamesDialog object.
olSenderInAddressListRuleCondition = 133, // Represents a SenderInAddressListRuleCondition object.
olSendRuleAction = 119, // Represents a SendRuleAction object.
olSharing = 104, // Represents a SharingItem object.
olStorageItem = 113, // Represents a StorageItem object.
olStore = 107, // Represents a Store object.
olStores = 108, // Represents a Stores object.
olSyncObject = 72, // Represents a SyncObject object.
olSyncObjects = 73, // Represents a SyncObject object.
olTable = 120, // Represents a Table object.
olTask = 48, // Represents a TaskItem object.
olTaskRequest = 49, // Represents a TaskRequestItem object.
olTaskRequestAccept = 51, // Represents a TaskRequestAcceptItem object.
olTaskRequestDecline = 52, // Represents a TaskRequestDeclineItem object.
olTaskRequestUpdate = 50, // Represents a TaskRequestUpdateItem object.
olTasksModule = 161, // Represents a TasksModule object.
olTextRuleCondition = 134, // Represents a TextRuleCondition object.
olUserDefinedProperties = 172, // Represents a UserDefinedProperties object.
olUserDefinedProperty = 171, // Represents a UserDefinedProperty object.
olUserProperties = 38, // Represents a UserProperties object.
olUserProperty = 39, // Represents a UserProperty object.
olView = 80, // Represents a View object.
olViewField = 142, // Represents a ViewField object.
olViewFields = 141, // Represents a ViewFields object.
olViewFont = 146, // Represents a ViewFont object.
olViews = 79 // Represents a Views object.
}
}

View file

@ -0,0 +1,9 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlReoccurenceState {
olApptException,
olApptMaster,
olApptNotRecurring,
olApptOccurrence
}
}

View file

@ -0,0 +1,10 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlSensitivity {
// Fields
olConfidential = 3,
olNormal = 0,
olPersonal = 1,
olPrivate = 2
}
}

View file

@ -0,0 +1,9 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
public enum OlWindowState {
// Fields
olMaximized = 0,
olMinimized = 1,
olNormalWindow = 2
}
}

View file

@ -18,10 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Runtime.InteropServices;
namespace Greenshot.Interop.Office {
namespace GreenshotOfficePlugin.OfficeInterop.Outlook {
internal enum PT : uint {
PT_UNSPECIFIED = 0, /* (Reserved for interface use) type doesn't matter to caller */
PT_NULL = 1, /* NULL property value */

View file

@ -0,0 +1,31 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GreenshotOfficePlugin.OfficeInterop.Outlook {
/// <summary>
/// Schema definitions for the MAPI properties
/// See: http://msdn.microsoft.com/en-us/library/aa454438.aspx
/// and see: http://msdn.microsoft.com/en-us/library/bb446117.aspx
/// </summary>
public static class PropTag {
public const string ATTACHMENT_CONTENT_ID = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E";
}
}

View file

@ -0,0 +1,24 @@
namespace GreenshotOfficePlugin.OfficeInterop.Outlook
{
/// <summary>
/// Units: http://msdn.microsoft.com/en-us/library/office/bb214015(v=office.12).aspx
/// </summary>
public enum WdUnits {
wdCell = 12,
wdCharacter = 1,
wdCharacterFormatting = 13,
wdColumn = 9,
wdItem = 16,
wdLine = 5,
wdParagraph = 4,
wdParagraphFormatting = 14,
wdRow = 10,
wdScreen = 7,
wdSection = 8,
wdSentence = 3,
wdStory = 6,
wdTable = 15,
wdWindow = 11,
wdWord = 2
}
}

View file

@ -1,660 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections;
namespace Greenshot.Interop.Office {
/// <summary>
/// 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
/// </summary>
[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;
}
}
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb208387%28v=office.12%29.aspx
/// </summary>
public interface IItems : ICollection, IEnumerable {
IItem this[object index] {
get;
}
IItem GetFirst();
IItem GetNext();
IItem GetLast();
IItem GetPrevious();
bool IncludeRecurrences {
get;
set;
}
IItems Restrict(string filter);
void Sort(string property, object descending);
// Actual definition is "object Add( object )", just making it convenient
object Add(OlItemType type);
}
// Common attributes of all the Items (MailItem, AppointmentItem)
// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
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();
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 : 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 : 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 IContactItem : IItem, ICommon {
bool HasPicture {
get;
}
void SaveBusinessCardImage(string path);
void AddPicture(string path);
void RemovePicture();
string FirstName {
get;
set;
}
string LastName {
get;
set;
}
}
public interface IAttachments : ICollection {
IAttachment Add(object source, object type, object position, object displayName);
// Use index+1!!!!
IAttachment this[object index] {
get;
}
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.attachment_members.aspx
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 IPropertyAccessor : ICommon {
void SetProperty(string SchemaName, object Value);
object GetProperty(string SchemaName);
}
// Schema definitions for the MAPI properties
// See: http://msdn.microsoft.com/en-us/library/aa454438.aspx
// and see: http://msdn.microsoft.com/en-us/library/bb446117.aspx
public static class PropTag {
public const string ATTACHMENT_CONTENT_ID = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E";
}
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb176693%28v=office.12%29.aspx
/// </summary>
public interface INameSpace : ICommon {
IRecipient CurrentUser {
get;
}
IFolder GetDefaultFolder(OlDefaultFolders defaultFolder);
}
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb176362%28v=office.12%29.aspx
/// </summary>
public interface IFolder : ICommon {
IItems Items {
get;
}
}
public interface IRecipient : ICommon {
string Name {
get;
}
}
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspector_members.aspx
/// </summary>
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;
}
void SetControlItemProperty(object Control, string PropertyName);
}
/// <summary>
/// Is a joined interface of the Explorer an Inspector
/// </summary>
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;
}
}
/// <summary>
/// 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
///
/// </summary>
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 IInspectors : ICommon, ICollection, IEnumerable {
// Use index + 1!!
IInspector this[object Index] {
get;
}
}
/// <summary>
/// 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
/// </summary>
public interface IExplorers : ICommon, ICollection, IEnumerable {
// Use index + 1!!
IExplorer this[object Index] {
get;
}
}
/// <summary>
/// Specifies which EmailFormat the email needs to use
/// </summary>
public enum EmailFormat {
Text,
HTML
}
public enum OlBodyFormat {
// Fields
olFormatHTML = 2,
olFormatPlain = 1,
olFormatRichText = 3,
olFormatUnspecified = 0
}
public enum OlAttachmentType {
// Fields
olByReference = 4,
olByValue = 1,
olEmbeddeditem = 5,
olOLE = 6
}
public enum OlSensitivity {
// Fields
olConfidential = 3,
olNormal = 0,
olPersonal = 1,
olPrivate = 2
}
// See: http://msdn.microsoft.com/en-us/library/ff863329.aspx
public enum OlObjectClass {
olAccount = 105, // Represents an Account object.
olAccountRuleCondition = 135, // Represents an AccountRuleCondition object.
olAccounts = 106, // Represents an Accounts object.
olAction = 32, // Represents an Action object.
olActions = 33, // Represents an Actions object.
olAddressEntries = 21, // Represents an AddressEntries object.
olAddressEntry = 8, // Represents an AddressEntry object.
olAddressList = 7, // Represents an AddressList object.
olAddressLists = 20, // Represents an AddressLists object.
olAddressRuleCondition = 170, // Represents an AddressRuleCondition object.
olApplication = 0, // Represents an Application object.
olAppointment = 26, // Represents an AppointmentItem object.
olAssignToCategoryRuleAction = 122, // Represents an AssignToCategoryRuleAction object.
olAttachment = 5, // Represents an Attachment object.
olAttachments = 18, // Represents an Attachments object.
olAttachmentSelection = 169, // Represents an AttachmentSelection object.
olAutoFormatRule = 147, // Represents an AutoFormatRule object.
olAutoFormatRules = 148, // Represents an AutoFormatRules object.
olCalendarModule = 159, // Represents a CalendarModule object.
olCalendarSharing = 151, // Represents a CalendarSharing object.
olCategories = 153, // Represents a Categories object.
olCategory = 152, // Represents a Category object.
olCategoryRuleCondition = 130, // Represents a CategoryRuleCondition object.
olClassBusinessCardView = 168, // Represents a BusinessCardView object.
olClassCalendarView = 139, // Represents a CalendarView object.
olClassCardView = 138, // Represents a CardView object.
olClassIconView = 137, // Represents a IconView object.
olClassNavigationPane = 155, // Represents a NavigationPane object.
olClassTableView = 136, // Represents a TableView object.
olClassTimeLineView = 140, // Represents a TimelineView object.
olClassTimeZone = 174, // Represents a TimeZone object.
olClassTimeZones = 175, // Represents a TimeZones object.
olColumn = 154, // Represents a Column object.
olColumnFormat = 149, // Represents a ColumnFormat object.
olColumns = 150, // Represents a Columns object.
olConflict = 102, // Represents a Conflict object.
olConflicts = 103, // Represents a Conflicts object.
olContact = 40, // Represents a ContactItem object.
olContactsModule = 160, // Represents a ContactsModule object.
olDistributionList = 69, // Represents a ExchangeDistributionList object.
olDocument = 41, // Represents a DocumentItem object.
olException = 30, // Represents an Exception object.
olExceptions = 29, // Represents an Exceptions object.
olExchangeDistributionList = 111, // Represents an ExchangeDistributionList object.
olExchangeUser = 110, // Represents an ExchangeUser object.
olExplorer = 34, // Represents an Explorer object.
olExplorers = 60, // Represents an Explorers object.
olFolder = 2, // Represents a Folder object.
olFolders = 15, // Represents a Folders object.
olFolderUserProperties = 172, // Represents a UserDefinedProperties object.
olFolderUserProperty = 171, // Represents a UserDefinedProperty object.
olFormDescription = 37, // Represents a FormDescription object.
olFormNameRuleCondition = 131, // Represents a FormNameRuleCondition object.
olFormRegion = 129, // Represents a FormRegion object.
olFromRssFeedRuleCondition = 173, // Represents a FromRssFeedRuleCondition object.
olFromRuleCondition = 132, // Represents a ToOrFromRuleCondition object.
olImportanceRuleCondition = 128, // Represents an ImportanceRuleCondition object.
olInspector = 35, // Represents an Inspector object.
olInspectors = 61, // Represents an Inspectors object.
olItemProperties = 98, // Represents an ItemProperties object.
olItemProperty = 99, // Represents an ItemProperty object.
olItems = 16, // Represents an Items object.
olJournal = 42, // Represents a JournalItem object.
olJournalModule = 162, // Represents a JournalModule object.
olLink = 75, // Represents a Link object.
olLinks = 76, // Represents a Links object.
olMail = 43, // Represents a MailItem object.
olMailModule = 158, // Represents a MailModule object.
olMarkAsTaskRuleAction = 124, // Represents a MarkAsTaskRuleAction object.
olMeetingCancellation = 54, // Represents a MeetingItem object that is a meeting cancellation notice.
olMeetingRequest = 53, // Represents a MeetingItem object that is a meeting request.
olMeetingResponseNegative = 55, // Represents a MeetingItem object that is a refusal of a meeting request.
olMeetingResponsePositive = 56, // Represents a MeetingItem object that is an acceptance of a meeting request.
olMeetingResponseTentative = 57, // Represents a MeetingItem object that is a tentative acceptance of a meeting request.
olMoveOrCopyRuleAction = 118, // Represents a MoveOrCopyRuleAction object.
olNamespace = 1, // Represents a NameSpace object.
olNavigationFolder = 167, // Represents a NavigationFolder object.
olNavigationFolders = 166, // Represents a NavigationFolders object.
olNavigationGroup = 165, // Represents a NavigationGroup object.
olNavigationGroups = 164, // Represents a NavigationGroups object.
olNavigationModule = 157, // Represents a NavigationModule object.
olNavigationModules = 156, // Represents a NavigationModules object.
olNewItemAlertRuleAction = 125, // Represents a NewItemAlertRuleAction object.
olNote = 44, // Represents a NoteItem object.
olNotesModule = 163, // Represents a NotesModule object.
olOrderField = 144, // Represents an OrderField object.
olOrderFields = 145, // Represents an OrderFields object.
olOutlookBarGroup = 66, // Represents an OutlookBarGroup object.
olOutlookBarGroups = 65, // Represents an OutlookBarGroups object.
olOutlookBarPane = 63, // Represents an OutlookBarPane object.
olOutlookBarShortcut = 68, // Represents an OutlookBarShortcut object.
olOutlookBarShortcuts = 67, // Represents an OutlookBarShortcuts object.
olOutlookBarStorage = 64, // Represents an OutlookBarStorage object.
olPages = 36, // Represents a Pages object.
olPanes = 62, // Represents a Panes object.
olPlaySoundRuleAction = 123, // Represents a PlaySoundRuleAction object.
olPost = 45, // Represents a PostItem object.
olPropertyAccessor = 112, // Represents a PropertyAccessor object.
olPropertyPages = 71, // Represents a PropertyPages object.
olPropertyPageSite = 70, // Represents a PropertyPageSite object.
olRecipient = 4, // Represents a Recipient object.
olRecipients = 17, // Represents a Recipients object.
olRecurrencePattern = 28, // Represents a RecurrencePattern object.
olReminder = 101, // Represents a Reminder object.
olReminders = 100, // Represents a Reminders object.
olRemote = 47, // Represents a RemoteItem object.
olReport = 46, // Represents a ReportItem object.
olResults = 78, // Represents a Results object.
olRow = 121, // Represents a Row object.
olRule = 115, // Represents a Rule object.
olRuleAction = 117, // Represents a RuleAction object.
olRuleActions = 116, // Represents a RuleAction object.
olRuleCondition = 127, // Represents a RuleCondition object.
olRuleConditions = 126, // Represents a RuleConditions object.
olRules = 114, // Represents a Rules object.
olSearch = 77, // Represents a Search object.
olSelection = 74, // Represents a Selection object.
olSelectNamesDialog = 109, // Represents a SelectNamesDialog object.
olSenderInAddressListRuleCondition = 133, // Represents a SenderInAddressListRuleCondition object.
olSendRuleAction = 119, // Represents a SendRuleAction object.
olSharing = 104, // Represents a SharingItem object.
olStorageItem = 113, // Represents a StorageItem object.
olStore = 107, // Represents a Store object.
olStores = 108, // Represents a Stores object.
olSyncObject = 72, // Represents a SyncObject object.
olSyncObjects = 73, // Represents a SyncObject object.
olTable = 120, // Represents a Table object.
olTask = 48, // Represents a TaskItem object.
olTaskRequest = 49, // Represents a TaskRequestItem object.
olTaskRequestAccept = 51, // Represents a TaskRequestAcceptItem object.
olTaskRequestDecline = 52, // Represents a TaskRequestDeclineItem object.
olTaskRequestUpdate = 50, // Represents a TaskRequestUpdateItem object.
olTasksModule = 161, // Represents a TasksModule object.
olTextRuleCondition = 134, // Represents a TextRuleCondition object.
olUserDefinedProperties = 172, // Represents a UserDefinedProperties object.
olUserDefinedProperty = 171, // Represents a UserDefinedProperty object.
olUserProperties = 38, // Represents a UserProperties object.
olUserProperty = 39, // Represents a UserProperty object.
olView = 80, // Represents a View object.
olViewField = 142, // Represents a ViewField object.
olViewFields = 141, // Represents a ViewFields object.
olViewFont = 146, // Represents a ViewFont object.
olViews = 79 // Represents a Views object.
}
public enum OlDefaultFolders {
olFolderCalendar = 9, // The Calendar folder.
olFolderConflicts = 19, // The Conflicts folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderContacts = 10, // The Contacts folder.
olFolderDeletedItems = 3, // The Deleted Items folder.
olFolderDrafts = 16, // The Drafts folder.
olFolderInbox = 6, // The Inbox folder.
olFolderJournal = 11, // The Journal folder.
olFolderJunk = 23, // The Junk E-Mail folder.
olFolderLocalFailures = 21, // The Local Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderManagedEmail = 29, // The top-level folder in the Managed Folders group. For more information on Managed Folders, see Help in Microsoft Outlook. Only available for an Exchange account.
olFolderNotes = 12, // The Notes folder.
olFolderOutbox = 4, // The Outbox folder.
olFolderSentMail = 5, // The Sent Mail folder.
olFolderServerFailures = 22, // The Server Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderSyncIssues = 20, // The Sync Issues folder. Only available for an Exchange account.
olFolderTasks = 13, // The Tasks folder.
olFolderToDo = 28, // The To Do folder.
olPublicFoldersAllPublicFolders = 18, // The All Public Folders folder in the Exchange Public Folders store. Only available for an Exchange account.
olFolderRssFeeds = 25 // The RSS Feeds folder.
}
public enum OlItemType {
// Fields
olAppointmentItem = 1,
olContactItem = 2,
olDistributionListItem = 7,
olJournalItem = 4,
olMailItem = 0,
olNoteItem = 5,
olPostItem = 6,
olTaskItem = 3
}
public enum OlEditorType {
// Fields
olEditorHTML = 2,
olEditorRTF = 3,
olEditorText = 1,
olEditorWord = 4
}
public enum OlWindowState {
// Fields
olMaximized = 0,
olMinimized = 1,
olNormalWindow = 2
}
public enum OlInspectorClose {
// Fields
olDiscard = 1,
olPromptForSave = 2,
olSave = 0
}
public enum MsoTriState {
msoTrue = -1,
msoFalse = 0,
msoCTrue = 1,
msoTriStateToggle = -3,
msoTriStateMixed = -2
}
public enum OlReoccurenceState {
olApptException,
olApptMaster,
olApptNotRecurring,
olApptOccurrence
}
public enum MsoScaleFrom {
msoScaleFromTopLeft = 0,
msoScaleFromMiddle = 1,
msoScaleFromBottomRight = 2
}
/// <summary>
/// Units: http://msdn.microsoft.com/en-us/library/office/bb214015(v=office.12).aspx
/// </summary>
public enum WdUnits {
wdCell = 12,
wdCharacter = 1,
wdCharacterFormatting = 13,
wdColumn = 9,
wdItem = 16,
wdLine = 5,
wdParagraph = 4,
wdParagraphFormatting = 14,
wdRow = 10,
wdScreen = 7,
wdSection = 8,
wdSentence = 3,
wdStory = 6,
wdTable = 15,
wdWindow = 11,
wdWord = 2
}
}

View file

@ -0,0 +1,12 @@
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Powerpoint
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.pagesetup_members.aspx
/// </summary>
public interface IPageSetup : ICommon, ICollection {
float SlideWidth { get; set; }
float SlideHeight { get; set; }
}
}

View file

@ -0,0 +1,37 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Greenshot.Interop;
namespace GreenshotOfficePlugin.OfficeInterop.Powerpoint {
/// <summary>
/// See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.application_members.aspx
/// </summary>
[ComProgId("Powerpoint.Application")]
public interface IPowerpointApplication : ICommon {
IPresentation ActivePresentation { get; }
IPresentations Presentations { get; }
bool Visible { get; set; }
void Activate();
IPowerpointWindow ActiveWindow { get; }
string Version { get; }
}
}

View file

@ -0,0 +1,13 @@
using Greenshot.Interop;
using GreenshotOfficePlugin.OfficeInterop.Word;
namespace GreenshotOfficePlugin.OfficeInterop.Powerpoint
{
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.view_members.aspx
/// </summary>
public interface IPowerpointView : ICommon {
IZoom Zoom { get; }
void GotoSlide(int index);
}
}

Some files were not shown because too many files have changed in this diff Show more