mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
Reducing warnings
This commit is contained in:
parent
68ee2a9789
commit
8d8aa6888c
20 changed files with 373 additions and 62 deletions
|
@ -35,6 +35,7 @@ namespace Greenshot.Addon.Office.Configuration
|
|||
/// <summary>
|
||||
/// Office configuration
|
||||
/// </summary>
|
||||
#pragma warning disable CS1591
|
||||
[IniSection("Office")]
|
||||
[Description("Greenshot Office configuration")]
|
||||
public interface IOfficeConfiguration : IIniSection
|
||||
|
|
|
@ -22,6 +22,7 @@ using Dapplo.Config.Language;
|
|||
|
||||
namespace Greenshot.Addon.Office.Configuration
|
||||
{
|
||||
#pragma warning disable CS1591
|
||||
[Language("Office")]
|
||||
public interface IOfficeLanguage : ILanguage, INotifyPropertyChanged
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ using Microsoft.Office.Interop.PowerPoint;
|
|||
|
||||
namespace Greenshot.Addon.Office.Configuration.Impl
|
||||
{
|
||||
#pragma warning disable CS1591
|
||||
public class OfficeConfigurationImpl : IniSectionBase<IOfficeConfiguration>, IOfficeConfiguration
|
||||
{
|
||||
#region Implementation of IOfficeConfiguration
|
||||
|
|
|
@ -25,6 +25,7 @@ using Dapplo.Config.Language;
|
|||
|
||||
namespace Greenshot.Addon.Office.Configuration.Impl
|
||||
{
|
||||
#pragma warning disable CS1591
|
||||
public class OfficeLanguageImpl : LanguageBase<IOfficeLanguage>, IOfficeLanguage
|
||||
{
|
||||
#region Implementation of IOfficeLanguage
|
||||
|
|
|
@ -50,6 +50,12 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly string _exePath;
|
||||
private readonly string _workbookName;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used to wire dependencies
|
||||
/// </summary>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
public ExcelDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
|
@ -64,6 +70,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// protected constructor to accept a workbook name too
|
||||
/// </summary>
|
||||
/// <param name="workbookName">string</param>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
protected ExcelDestination(string workbookName,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
|
@ -73,17 +86,22 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
_workbookName = workbookName;
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override string Description => _workbookName ?? "Microsoft Excel";
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsActive => base.IsActive && _exePath != null;
|
||||
|
||||
/// <inherit />
|
||||
public override Bitmap GetDisplayIcon(double dpi)
|
||||
{
|
||||
return PluginUtils.GetCachedExeIcon(_exePath, !string.IsNullOrEmpty(_workbookName) ? IconWorkbook : IconApplication, dpi > 100);
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
foreach (var workbookName in ExcelExporter.GetWorkbooks())
|
||||
|
@ -92,6 +110,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
{
|
||||
var exportInformation = new ExportInformation(Designation, Description);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the OneNote destination, taking care of exporting
|
||||
/// </summary>
|
||||
[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;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency wiring
|
||||
/// </summary>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
public OneNoteDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
|
@ -63,7 +73,14 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
protected OneNoteDestination(OneNotePage page,
|
||||
/// <summary>
|
||||
/// Constructor used for dependency wiring, and being able to specify a page
|
||||
/// </summary>
|
||||
/// <param name="page">OneNotePage</param>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
protected OneNoteDestination(OneNotePage page,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
ExportNotification exportNotification
|
||||
|
@ -72,6 +89,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
_page = page;
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
|
@ -84,15 +102,19 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsActive => base.IsActive && _exePath != null;
|
||||
|
||||
/// <inherit />
|
||||
public override Bitmap GetDisplayIcon(double dpi)
|
||||
{
|
||||
return PluginUtils.GetCachedExeIcon(_exePath, IconApplication, dpi > 100);
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
try
|
||||
|
@ -114,6 +136,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
return Enumerable.Empty<IDestination>();
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
{
|
||||
var exportInformation = new ExportInformation(Designation, Description);
|
||||
|
|
|
@ -63,6 +63,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly OlObjectClass _outlookInspectorType;
|
||||
private readonly OutlookExporter _outlookExporter;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
public OutlookDestination(
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
|
@ -88,7 +95,16 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
protected OutlookDestination(
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="outlookInspectorCaption">OlObjectClass</param>
|
||||
/// <param name="outlookInspectorType">OlObjectClass</param>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
protected OutlookDestination(
|
||||
string outlookInspectorCaption,
|
||||
OlObjectClass outlookInspectorType,
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
|
@ -101,14 +117,19 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
_outlookInspectorType = outlookInspectorType;
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override string Description => _outlookInspectorCaption ?? MapiClient;
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsActive => base.IsActive && _isActiveFlag;
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
/// <inherit />
|
||||
public override Keys EditorShortcutKeys => Keys.Control | Keys.E;
|
||||
|
||||
/// <inherit />
|
||||
public override Bitmap GetDisplayIcon(double dpi)
|
||||
{
|
||||
if (_outlookInspectorCaption == null)
|
||||
|
@ -123,6 +144,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
return MailIcon;
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
var inspectorCaptions = _outlookExporter.RetrievePossibleTargets();
|
||||
|
|
|
@ -56,6 +56,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private const int IconApplication = 0;
|
||||
private const int IconPresentation = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
public PowerpointDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
|
@ -73,7 +80,15 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
public PowerpointDestination(string presentationName,
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="presentationName">string with the name of the presentation</param>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
public PowerpointDestination(string presentationName,
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
|
@ -82,6 +97,7 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
_presentationName = presentationName;
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
|
@ -94,10 +110,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsActive => base.IsActive && _exePath != null;
|
||||
|
||||
/// <inherit />
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
return _powerpointExporter.GetPowerpointPresentations().Select(presentationName => new PowerpointDestination(presentationName, CoreConfiguration, GreenshotLanguage, _officeConfiguration, _exportNotification));
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
{
|
||||
var exportInformation = new ExportInformation(Designation, Description);
|
||||
|
|
|
@ -57,6 +57,13 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
private readonly string _documentCaption;
|
||||
private readonly WordExporter _wordExporter;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
public WordDestination(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
|
@ -74,7 +81,15 @@ namespace Greenshot.Addon.Office.Destinations
|
|||
}
|
||||
}
|
||||
|
||||
protected WordDestination(string wordCaption,
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="wordCaption">string with the caption of the word document</param>
|
||||
/// <param name="coreConfiguration">ICoreConfiguration</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="exportNotification">ExportNotification</param>
|
||||
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";
|
||||
/// <inherit />
|
||||
public override string Description => _documentCaption ?? "Microsoft Word";
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
/// <inherit />
|
||||
public override bool IsActive => base.IsActive && _exePath != null;
|
||||
|
||||
/// <inherit />
|
||||
public override Bitmap GetDisplayIcon(double dpi)
|
||||
{
|
||||
return PluginUtils.GetCachedExeIcon(_exePath, !string.IsNullOrEmpty(_documentCaption) ? IconDocument : IconApplication, dpi > 100);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
/// <inherit />
|
||||
public override IEnumerable<IDestination> DynamicDestinations()
|
||||
{
|
||||
return _wordExporter.GetWordDocuments().Select(wordCaption => new WordDestination(wordCaption, CoreConfiguration, GreenshotLanguage, _officeConfiguration, _exportNotification));
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
|
||||
{
|
||||
var exportInformation = new ExportInformation(Designation, Description);
|
||||
|
|
|
@ -38,6 +38,10 @@ namespace Greenshot.Addon.Office
|
|||
/// <inheritdoc />
|
||||
public class OfficeAddonModule : AddonModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Define the dependencies of this project
|
||||
/// </summary>
|
||||
/// <param name="builder">ContainerBuilder</param>
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
var hasDestination = false;
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.Office.OfficeExport.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Container for transporting notebook information
|
||||
/// </summary>
|
||||
public class OneNoteNotebook
|
||||
{
|
||||
/// <summary>
|
||||
/// ID of the notebook
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the notebook
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.Office.OfficeExport.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Container for transporting Page information
|
||||
/// </summary>
|
||||
public class OneNotePage
|
||||
{
|
||||
/// <inherit />
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <inherit />
|
||||
public bool IsCurrentlyViewed { get; set; }
|
||||
|
||||
/// <inherit />
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inherit />
|
||||
public OneNoteSection Parent { get; set; }
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
#region Usings
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.Office.OfficeExport.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Container for transporting section information
|
||||
/// </summary>
|
||||
public class OneNoteSection
|
||||
{
|
||||
/// <summary>
|
||||
/// ID of the section
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the section
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parent notebook
|
||||
/// </summary>
|
||||
public OneNoteNotebook Parent { get; set; }
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Container for transporting Page information
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Container for transporting section information
|
||||
/// </summary>
|
||||
public class OneNoteSection
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public OneNoteNotebook Parent { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Container for transporting notebook information
|
||||
/// </summary>
|
||||
public class OneNoteNotebook
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -65,6 +65,10 @@ namespace Greenshot.Addon.Office.OfficeExport
|
|||
private static string _currentUser;
|
||||
private readonly WordExporter _wordExporter;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="officeConfiguration"></param>
|
||||
public OutlookExporter(IOfficeConfiguration officeConfiguration)
|
||||
{
|
||||
_officeConfiguration = officeConfiguration;
|
||||
|
|
|
@ -40,12 +40,19 @@ using Shape = Microsoft.Office.Interop.PowerPoint.Shape;
|
|||
|
||||
namespace Greenshot.Addon.Office.OfficeExport
|
||||
{
|
||||
/// <summary>
|
||||
/// Export logic for powerpoint
|
||||
/// </summary>
|
||||
public class PowerpointExporter
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly IOfficeConfiguration _officeConfiguration;
|
||||
private Version _powerpointVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="officeConfiguration"></param>
|
||||
public PowerpointExporter(IOfficeConfiguration officeConfiguration)
|
||||
{
|
||||
_officeConfiguration = officeConfiguration;
|
||||
|
|
|
@ -34,12 +34,19 @@ using Version = System.Version;
|
|||
|
||||
namespace Greenshot.Addon.Office.OfficeExport
|
||||
{
|
||||
/// <summary>
|
||||
/// This makes it possible to export to word
|
||||
/// </summary>
|
||||
public class WordExporter
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private static Version _wordVersion;
|
||||
private readonly IOfficeConfiguration _officeConfiguration;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="officeConfiguration"></param>
|
||||
public WordExporter(IOfficeConfiguration officeConfiguration)
|
||||
{
|
||||
_officeConfiguration = officeConfiguration;
|
||||
|
@ -198,11 +205,11 @@ namespace Greenshot.Addon.Office.OfficeExport
|
|||
/// <summary>
|
||||
/// Internal method for the insert
|
||||
/// </summary>
|
||||
/// <param name="wordApplication"></param>
|
||||
/// <param name="wordDocument"></param>
|
||||
/// <param name="tmpFile"></param>
|
||||
/// <param name="address"></param>
|
||||
/// <param name="tooltip">tooltip of the image</param>
|
||||
/// <param name="wordApplication">IDisposableCom with Application</param>
|
||||
/// <param name="wordDocument">IDisposableCom with _Document</param>
|
||||
/// <param name="tmpFile">string</param>
|
||||
/// <param name="address">string</param>
|
||||
/// <param name="tooltip">string with the tooltip of the image</param>
|
||||
/// <returns></returns>
|
||||
internal bool InsertIntoExistingDocument(IDisposableCom<Application> wordApplication, IDisposableCom<_Document> wordDocument, string tmpFile, string address, string tooltip)
|
||||
{
|
||||
|
@ -294,6 +301,12 @@ namespace Greenshot.Addon.Office.OfficeExport
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert a capture into a new document
|
||||
/// </summary>
|
||||
/// <param name="tmpFile">string</param>
|
||||
/// <param name="address">string</param>
|
||||
/// <param name="tooltip">string</param>
|
||||
public void InsertIntoNewDocument(string tmpFile, string address, string tooltip)
|
||||
{
|
||||
using (var wordApplication = GetOrCreateWordApplication())
|
||||
|
|
|
@ -28,7 +28,13 @@ namespace Greenshot.Addon.Office.OfficeInterop
|
|||
/// </summary>
|
||||
public enum EmailFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Use the plain text format
|
||||
/// </summary>
|
||||
Text,
|
||||
/// <summary>
|
||||
/// Use HTML format
|
||||
/// </summary>
|
||||
Html
|
||||
}
|
||||
}
|
|
@ -28,12 +28,41 @@ namespace Greenshot.Addon.Office.OfficeInterop
|
|||
/// </summary>
|
||||
public enum OfficeVersions
|
||||
{
|
||||
/// <summary>
|
||||
/// Office 97
|
||||
/// </summary>
|
||||
Office97 = 8,
|
||||
/// <summary>
|
||||
/// Office 2000
|
||||
/// </summary>
|
||||
Office2000 = 9,
|
||||
/// <summary>
|
||||
/// Office 2002
|
||||
/// </summary>
|
||||
Office2002 = 10,
|
||||
/// <summary>
|
||||
/// Office 2003
|
||||
/// </summary>
|
||||
Office2003 = 11,
|
||||
/// <summary>
|
||||
/// Office 2007
|
||||
/// </summary>
|
||||
Office2007 = 12,
|
||||
/// <summary>
|
||||
/// Office 2010
|
||||
/// </summary>
|
||||
Office2010 = 14,
|
||||
Office2013 = 15
|
||||
/// <summary>
|
||||
/// Office 2013
|
||||
/// </summary>
|
||||
Office2013 = 15,
|
||||
/// <summary>
|
||||
/// Office 2016
|
||||
/// </summary>
|
||||
Office2016 = 16,
|
||||
/// <summary>
|
||||
/// Office 2019
|
||||
/// </summary>
|
||||
Office2019 = 17
|
||||
}
|
||||
}
|
|
@ -33,6 +33,9 @@ using Microsoft.Office.Interop.PowerPoint;
|
|||
|
||||
namespace Greenshot.Addon.Office.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// View model for the office configuration
|
||||
/// </summary>
|
||||
public sealed class OfficeConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -40,10 +43,26 @@ namespace Greenshot.Addon.Office.ViewModels
|
|||
/// </summary>
|
||||
private CompositeDisposable _disposables;
|
||||
|
||||
/// <summary>
|
||||
/// Used to modify the office configuration from the view
|
||||
/// </summary>
|
||||
public IOfficeConfiguration OfficeConfiguration { get; }
|
||||
/// <summary>
|
||||
/// Used to supply translations to the view
|
||||
/// </summary>
|
||||
public IOfficeLanguage OfficeLanguage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to supply translations to the view
|
||||
/// </summary>
|
||||
public IGreenshotLanguage GreenshotLanguage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="officeConfiguration">IOfficeConfiguration</param>
|
||||
/// <param name="officeLanguage">IOfficeLanguage</param>
|
||||
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
|
||||
public OfficeConfigViewModel(
|
||||
IOfficeConfiguration officeConfiguration,
|
||||
IOfficeLanguage officeLanguage,
|
||||
|
@ -54,6 +73,7 @@ namespace Greenshot.Addon.Office.ViewModels
|
|||
GreenshotLanguage = greenshotLanguage;
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
public override void Initialize(IConfig config)
|
||||
{
|
||||
// Prepare disposables
|
||||
|
@ -75,12 +95,16 @@ namespace Greenshot.Addon.Office.ViewModels
|
|||
base.Initialize(config);
|
||||
}
|
||||
|
||||
/// <inherit />
|
||||
protected override void OnDeactivate(bool close)
|
||||
{
|
||||
_disposables.Dispose();
|
||||
base.OnDeactivate(close);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected slide layout
|
||||
/// </summary>
|
||||
public PpSlideLayout SelectedSlideLayout
|
||||
{
|
||||
get => OfficeConfiguration.PowerpointSlideLayout;
|
||||
|
@ -91,6 +115,9 @@ namespace Greenshot.Addon.Office.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The available slide layouts
|
||||
/// </summary>
|
||||
public IDictionary<PpSlideLayout, string> SlideLayouts => GreenshotLanguage.TranslationValuesForEnum<PpSlideLayout>();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue