From 8d8aa6888c49924e6fd721d9c22b62441944be35 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 13 Nov 2018 23:39:01 +0100 Subject: [PATCH] Reducing warnings --- .../Configuration/IOfficeConfiguration.cs | 1 + .../Configuration/IOfficeLanguage.cs | 1 + .../Impl/OfficeConfigurationImpl.cs | 1 + .../Configuration/Impl/OfficeLanguageImpl.cs | 1 + .../Destinations/ExcelDestination.cs | 19 ++++++ .../Destinations/OneNoteDestination.cs | 25 +++++++- .../Destinations/OutlookDestination.cs | 24 ++++++- .../Destinations/PowerpointDestination.cs | 23 ++++++- .../Destinations/WordDestination.cs | 29 +++++++-- .../OfficeAddonModule.cs | 4 ++ .../OfficeExport/Entities/OneNoteNotebook.cs | 46 ++++++++++++++ .../OfficeExport/Entities/OneNotePage.cs | 62 +++++++++++++++++++ .../OfficeExport/Entities/OneNoteSection.cs | 51 +++++++++++++++ .../OfficeExport/OneNoteExporter.cs | 50 +-------------- .../OfficeExport/OutlookEmailExporter.cs | 4 ++ .../OfficeExport/PowerpointExporter.cs | 7 +++ .../OfficeExport/WordExporter.cs | 23 +++++-- .../OfficeInterop/EmailFormat.cs | 6 ++ .../OfficeInterop/OfficeVersions.cs | 31 +++++++++- .../ViewModels/OfficeConfigViewModel.cs | 27 ++++++++ 20 files changed, 373 insertions(+), 62 deletions(-) create mode 100644 src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs create mode 100644 src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs create mode 100644 src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs diff --git a/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs b/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs index 1af7798cd..2ee48c1dc 100644 --- a/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs +++ b/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs @@ -35,6 +35,7 @@ namespace Greenshot.Addon.Office.Configuration /// /// Office configuration /// + #pragma warning disable CS1591 [IniSection("Office")] [Description("Greenshot Office configuration")] public interface IOfficeConfiguration : IIniSection diff --git a/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs b/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs index 951d8d3ef..406ea2301 100644 --- a/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs +++ b/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs @@ -22,6 +22,7 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Office.Configuration { + #pragma warning disable CS1591 [Language("Office")] public interface IOfficeLanguage : ILanguage, INotifyPropertyChanged { diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs index 02cc62f38..40de55c24 100644 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs +++ b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs @@ -4,6 +4,7 @@ using Microsoft.Office.Interop.PowerPoint; namespace Greenshot.Addon.Office.Configuration.Impl { + #pragma warning disable CS1591 public class OfficeConfigurationImpl : IniSectionBase, IOfficeConfiguration { #region Implementation of IOfficeConfiguration diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs index e48259ed4..25237ec1c 100644 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs +++ b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs @@ -25,6 +25,7 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Office.Configuration.Impl { + #pragma warning disable CS1591 public class OfficeLanguageImpl : LanguageBase, IOfficeLanguage { #region Implementation of IOfficeLanguage diff --git a/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs b/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs index 4ea0f7e83..cfc40cbab 100644 --- a/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs @@ -50,6 +50,12 @@ namespace Greenshot.Addon.Office.Destinations private readonly string _exePath; private readonly string _workbookName; + /// + /// Constructor used to wire dependencies + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification public ExcelDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -64,6 +70,13 @@ namespace Greenshot.Addon.Office.Destinations } } + /// + /// protected constructor to accept a workbook name too + /// + /// string + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification protected ExcelDestination(string workbookName, ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -73,17 +86,22 @@ namespace Greenshot.Addon.Office.Destinations _workbookName = workbookName; } + /// public override string Description => _workbookName ?? "Microsoft Excel"; + /// public override bool IsDynamic => true; + /// public override bool IsActive => base.IsActive && _exePath != null; + /// public override Bitmap GetDisplayIcon(double dpi) { return PluginUtils.GetCachedExeIcon(_exePath, !string.IsNullOrEmpty(_workbookName) ? IconWorkbook : IconApplication, dpi > 100); } + /// public override IEnumerable DynamicDestinations() { foreach (var workbookName in ExcelExporter.GetWorkbooks()) @@ -92,6 +110,7 @@ namespace Greenshot.Addon.Office.Destinations } } + /// protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); diff --git a/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs b/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs index b511fbed5..ca569839b 100644 --- a/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Runtime.InteropServices; using Dapplo.Log; using Greenshot.Addon.Office.OfficeExport; +using Greenshot.Addon.Office.OfficeExport.Entities; using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Core; @@ -40,6 +41,9 @@ using Greenshot.Addons.Interfaces; namespace Greenshot.Addon.Office.Destinations { + /// + /// This is the OneNote destination, taking care of exporting + /// [Destination("OneNote", DestinationOrder.OneNote)] public class OneNoteDestination : AbstractDestination { @@ -49,6 +53,12 @@ namespace Greenshot.Addon.Office.Destinations private readonly string _exePath; private readonly OneNotePage _page; + /// + /// Constructor used for dependency wiring + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification public OneNoteDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -63,7 +73,14 @@ namespace Greenshot.Addon.Office.Destinations } } - protected OneNoteDestination(OneNotePage page, + /// + /// Constructor used for dependency wiring, and being able to specify a page + /// + /// OneNotePage + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification + protected OneNoteDestination(OneNotePage page, ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, ExportNotification exportNotification @@ -72,6 +89,7 @@ namespace Greenshot.Addon.Office.Destinations _page = page; } + /// public override string Description { get @@ -84,15 +102,19 @@ namespace Greenshot.Addon.Office.Destinations } } + /// public override bool IsDynamic => true; + /// public override bool IsActive => base.IsActive && _exePath != null; + /// public override Bitmap GetDisplayIcon(double dpi) { return PluginUtils.GetCachedExeIcon(_exePath, IconApplication, dpi > 100); } + /// public override IEnumerable DynamicDestinations() { try @@ -114,6 +136,7 @@ namespace Greenshot.Addon.Office.Destinations return Enumerable.Empty(); } + /// protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); diff --git a/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs b/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs index e9ca28251..2feb71e9d 100644 --- a/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs @@ -63,6 +63,13 @@ namespace Greenshot.Addon.Office.Destinations private readonly OlObjectClass _outlookInspectorType; private readonly OutlookExporter _outlookExporter; + /// + /// Constructor used for dependency injection + /// + /// IOfficeConfiguration + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification public OutlookDestination( IOfficeConfiguration officeConfiguration, ICoreConfiguration coreConfiguration, @@ -88,7 +95,16 @@ namespace Greenshot.Addon.Office.Destinations } } - protected OutlookDestination( + /// + /// Constructor used for dependency injection + /// + /// OlObjectClass + /// OlObjectClass + /// IOfficeConfiguration + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification + protected OutlookDestination( string outlookInspectorCaption, OlObjectClass outlookInspectorType, IOfficeConfiguration officeConfiguration, @@ -101,14 +117,19 @@ namespace Greenshot.Addon.Office.Destinations _outlookInspectorType = outlookInspectorType; } + /// public override string Description => _outlookInspectorCaption ?? MapiClient; + /// public override bool IsActive => base.IsActive && _isActiveFlag; + /// public override bool IsDynamic => true; + /// public override Keys EditorShortcutKeys => Keys.Control | Keys.E; + /// public override Bitmap GetDisplayIcon(double dpi) { if (_outlookInspectorCaption == null) @@ -123,6 +144,7 @@ namespace Greenshot.Addon.Office.Destinations return MailIcon; } + /// public override IEnumerable DynamicDestinations() { var inspectorCaptions = _outlookExporter.RetrievePossibleTargets(); diff --git a/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs b/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs index 141ea71d1..a9675415e 100644 --- a/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs @@ -56,6 +56,13 @@ namespace Greenshot.Addon.Office.Destinations private const int IconApplication = 0; private const int IconPresentation = 1; + /// + /// Constructor used for dependency injection + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// IOfficeConfiguration + /// ExportNotification public PowerpointDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -73,7 +80,15 @@ namespace Greenshot.Addon.Office.Destinations } } - public PowerpointDestination(string presentationName, + /// + /// Constructor used for dependency injection + /// + /// string with the name of the presentation + /// ICoreConfiguration + /// IGreenshotLanguage + /// IOfficeConfiguration + /// ExportNotification + public PowerpointDestination(string presentationName, ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, IOfficeConfiguration officeConfiguration, @@ -82,6 +97,7 @@ namespace Greenshot.Addon.Office.Destinations _presentationName = presentationName; } + /// public override string Description { get @@ -94,10 +110,13 @@ namespace Greenshot.Addon.Office.Destinations } } + /// public override bool IsDynamic => true; + /// public override bool IsActive => base.IsActive && _exePath != null; + /// public override Bitmap GetDisplayIcon(double dpi) { if (!string.IsNullOrEmpty(_presentationName)) @@ -108,11 +127,13 @@ namespace Greenshot.Addon.Office.Destinations return PluginUtils.GetCachedExeIcon(_exePath, IconApplication, dpi > 100); } + /// public override IEnumerable DynamicDestinations() { return _powerpointExporter.GetPowerpointPresentations().Select(presentationName => new PowerpointDestination(presentationName, CoreConfiguration, GreenshotLanguage, _officeConfiguration, _exportNotification)); } + /// protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); diff --git a/src/Greenshot.Addon.Office/Destinations/WordDestination.cs b/src/Greenshot.Addon.Office/Destinations/WordDestination.cs index 1bea29698..4ad6f5255 100644 --- a/src/Greenshot.Addon.Office/Destinations/WordDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/WordDestination.cs @@ -57,6 +57,13 @@ namespace Greenshot.Addon.Office.Destinations private readonly string _documentCaption; private readonly WordExporter _wordExporter; + /// + /// Constructor used for dependency injection + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// IOfficeConfiguration + /// ExportNotification public WordDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -74,7 +81,15 @@ namespace Greenshot.Addon.Office.Destinations } } - protected WordDestination(string wordCaption, + /// + /// Constructor used for dependency injection + /// + /// string with the caption of the word document + /// ICoreConfiguration + /// IGreenshotLanguage + /// IOfficeConfiguration + /// ExportNotification + protected WordDestination(string wordCaption, ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, IOfficeConfiguration officeConfiguration, @@ -83,22 +98,28 @@ namespace Greenshot.Addon.Office.Destinations _documentCaption = wordCaption; } - public override string Description => _documentCaption ?? "Microsoft Word"; + /// + public override string Description => _documentCaption ?? "Microsoft Word"; + /// public override bool IsDynamic => true; + /// public override bool IsActive => base.IsActive && _exePath != null; + /// public override Bitmap GetDisplayIcon(double dpi) { return PluginUtils.GetCachedExeIcon(_exePath, !string.IsNullOrEmpty(_documentCaption) ? IconDocument : IconApplication, dpi > 100); - } + } - public override IEnumerable DynamicDestinations() + /// + public override IEnumerable DynamicDestinations() { return _wordExporter.GetWordDocuments().Select(wordCaption => new WordDestination(wordCaption, CoreConfiguration, GreenshotLanguage, _officeConfiguration, _exportNotification)); } + /// protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); diff --git a/src/Greenshot.Addon.Office/OfficeAddonModule.cs b/src/Greenshot.Addon.Office/OfficeAddonModule.cs index 9ccd20344..da83d0a9f 100644 --- a/src/Greenshot.Addon.Office/OfficeAddonModule.cs +++ b/src/Greenshot.Addon.Office/OfficeAddonModule.cs @@ -38,6 +38,10 @@ namespace Greenshot.Addon.Office /// public class OfficeAddonModule : AddonModule { + /// + /// Define the dependencies of this project + /// + /// ContainerBuilder protected override void Load(ContainerBuilder builder) { var hasDestination = false; diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs new file mode 100644 index 000000000..13c450d0b --- /dev/null +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs @@ -0,0 +1,46 @@ +#region Greenshot GNU General Public License + +// Greenshot - a free and open source screenshot tool +// Copyright (C) 2007-2018 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 . + +#endregion + +#region Usings + + +#endregion + +namespace Greenshot.Addon.Office.OfficeExport.Entities +{ + /// + /// Container for transporting notebook information + /// + public class OneNoteNotebook + { + /// + /// ID of the notebook + /// + public string Id { get; set; } + + /// + /// Name of the notebook + /// + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs new file mode 100644 index 000000000..7d0a8584e --- /dev/null +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs @@ -0,0 +1,62 @@ +#region Greenshot GNU General Public License + +// Greenshot - a free and open source screenshot tool +// Copyright (C) 2007-2018 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 . + +#endregion + +#region Usings + + +#endregion + +namespace Greenshot.Addon.Office.OfficeExport.Entities +{ + /// + /// Container for transporting Page information + /// + public class OneNotePage + { + /// + public string DisplayName + { + get + { + OneNoteNotebook notebook = Parent.Parent; + if (string.IsNullOrEmpty(notebook.Name)) + { + return string.Format("{0} / {1}", Parent.Name, Name); + } + return string.Format("{0} / {1} / {2}", Parent.Parent.Name, Parent.Name, Name); + } + } + + /// + public string Id { get; set; } + + /// + public bool IsCurrentlyViewed { get; set; } + + /// + public string Name { get; set; } + + /// + public OneNoteSection Parent { get; set; } + } +} \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs new file mode 100644 index 000000000..3c64cef73 --- /dev/null +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs @@ -0,0 +1,51 @@ +#region Greenshot GNU General Public License + +// Greenshot - a free and open source screenshot tool +// Copyright (C) 2007-2018 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 . + +#endregion + +#region Usings + + +#endregion + +namespace Greenshot.Addon.Office.OfficeExport.Entities +{ + /// + /// Container for transporting section information + /// + public class OneNoteSection + { + /// + /// ID of the section + /// + public string Id { get; set; } + + /// + /// Name of the section + /// + public string Name { get; set; } + + /// + /// Parent notebook + /// + public OneNoteNotebook Parent { get; set; } + } +} \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs index 645246ff0..5651201b5 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs @@ -30,6 +30,7 @@ using System.Runtime.InteropServices; using System.Xml; using Dapplo.Log; using Dapplo.Windows.Interop; +using Greenshot.Addon.Office.OfficeExport.Entities; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; @@ -323,53 +324,4 @@ namespace Greenshot.Addon.Office.OfficeExport return null; } } - - /// - /// Container for transporting Page information - /// - public class OneNotePage - { - public string DisplayName - { - get - { - OneNoteNotebook notebook = Parent.Parent; - if (string.IsNullOrEmpty(notebook.Name)) - { - return string.Format("{0} / {1}", Parent.Name, Name); - } - return string.Format("{0} / {1} / {2}", Parent.Parent.Name, Parent.Name, Name); - } - } - - public string Id { get; set; } - - public bool IsCurrentlyViewed { get; set; } - - public string Name { get; set; } - - public OneNoteSection Parent { get; set; } - } - - /// - /// Container for transporting section information - /// - public class OneNoteSection - { - public string Id { get; set; } - - public string Name { get; set; } - - public OneNoteNotebook Parent { get; set; } - } - - /// - /// Container for transporting notebook information - /// - public class OneNoteNotebook - { - public string Id { get; set; } - - public string Name { get; set; } - } } \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs index 9c3fc8408..31ca74bb5 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs @@ -65,6 +65,10 @@ namespace Greenshot.Addon.Office.OfficeExport private static string _currentUser; private readonly WordExporter _wordExporter; + /// + /// Constructor used for dependency injection + /// + /// public OutlookExporter(IOfficeConfiguration officeConfiguration) { _officeConfiguration = officeConfiguration; diff --git a/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs index 913995e90..b82a1e378 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs @@ -40,12 +40,19 @@ using Shape = Microsoft.Office.Interop.PowerPoint.Shape; namespace Greenshot.Addon.Office.OfficeExport { + /// + /// Export logic for powerpoint + /// public class PowerpointExporter { private static readonly LogSource Log = new LogSource(); private readonly IOfficeConfiguration _officeConfiguration; private Version _powerpointVersion; + /// + /// Constructor used for dependency injection + /// + /// public PowerpointExporter(IOfficeConfiguration officeConfiguration) { _officeConfiguration = officeConfiguration; diff --git a/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs index b91ba34cc..ea8d528e7 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs @@ -34,12 +34,19 @@ using Version = System.Version; namespace Greenshot.Addon.Office.OfficeExport { + /// + /// This makes it possible to export to word + /// public class WordExporter { private static readonly LogSource Log = new LogSource(); private static Version _wordVersion; private readonly IOfficeConfiguration _officeConfiguration; + /// + /// Constructor used for dependency injection + /// + /// public WordExporter(IOfficeConfiguration officeConfiguration) { _officeConfiguration = officeConfiguration; @@ -198,11 +205,11 @@ namespace Greenshot.Addon.Office.OfficeExport /// /// Internal method for the insert /// - /// - /// - /// - /// - /// tooltip of the image + /// IDisposableCom with Application + /// IDisposableCom with _Document + /// string + /// string + /// string with the tooltip of the image /// internal bool InsertIntoExistingDocument(IDisposableCom wordApplication, IDisposableCom<_Document> wordDocument, string tmpFile, string address, string tooltip) { @@ -294,6 +301,12 @@ namespace Greenshot.Addon.Office.OfficeExport } } + /// + /// Insert a capture into a new document + /// + /// string + /// string + /// string public void InsertIntoNewDocument(string tmpFile, string address, string tooltip) { using (var wordApplication = GetOrCreateWordApplication()) diff --git a/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs b/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs index b9b5510c2..a8a716d0b 100644 --- a/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs +++ b/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs @@ -28,7 +28,13 @@ namespace Greenshot.Addon.Office.OfficeInterop /// public enum EmailFormat { + /// + /// Use the plain text format + /// Text, + /// + /// Use HTML format + /// Html } } \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs b/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs index d28d8d31f..5f199efe2 100644 --- a/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs +++ b/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs @@ -28,12 +28,41 @@ namespace Greenshot.Addon.Office.OfficeInterop /// public enum OfficeVersions { + /// + /// Office 97 + /// Office97 = 8, + /// + /// Office 2000 + /// Office2000 = 9, + /// + /// Office 2002 + /// Office2002 = 10, + /// + /// Office 2003 + /// Office2003 = 11, + /// + /// Office 2007 + /// Office2007 = 12, + /// + /// Office 2010 + /// Office2010 = 14, - Office2013 = 15 + /// + /// Office 2013 + /// + Office2013 = 15, + /// + /// Office 2016 + /// + Office2016 = 16, + /// + /// Office 2019 + /// + Office2019 = 17 } } \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs b/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs index aec01b673..792dc6f19 100644 --- a/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs +++ b/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs @@ -33,6 +33,9 @@ using Microsoft.Office.Interop.PowerPoint; namespace Greenshot.Addon.Office.ViewModels { + /// + /// View model for the office configuration + /// public sealed class OfficeConfigViewModel : SimpleConfigScreen { /// @@ -40,10 +43,26 @@ namespace Greenshot.Addon.Office.ViewModels /// private CompositeDisposable _disposables; + /// + /// Used to modify the office configuration from the view + /// public IOfficeConfiguration OfficeConfiguration { get; } + /// + /// Used to supply translations to the view + /// public IOfficeLanguage OfficeLanguage { get; } + + /// + /// Used to supply translations to the view + /// public IGreenshotLanguage GreenshotLanguage { get; } + /// + /// Constructor used for dependency injection + /// + /// IOfficeConfiguration + /// IOfficeLanguage + /// IGreenshotLanguage public OfficeConfigViewModel( IOfficeConfiguration officeConfiguration, IOfficeLanguage officeLanguage, @@ -54,6 +73,7 @@ namespace Greenshot.Addon.Office.ViewModels GreenshotLanguage = greenshotLanguage; } + /// public override void Initialize(IConfig config) { // Prepare disposables @@ -75,12 +95,16 @@ namespace Greenshot.Addon.Office.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); base.OnDeactivate(close); } + /// + /// The selected slide layout + /// public PpSlideLayout SelectedSlideLayout { get => OfficeConfiguration.PowerpointSlideLayout; @@ -91,6 +115,9 @@ namespace Greenshot.Addon.Office.ViewModels } } + /// + /// The available slide layouts + /// public IDictionary SlideLayouts => GreenshotLanguage.TranslationValuesForEnum(); } }