Resurrect spelling project

This commit is contained in:
Bruce Bowyer-Smyth 2015-12-17 19:23:57 +10:00
parent 3494995b1f
commit d16b3e3af6
24 changed files with 429 additions and 318 deletions

View File

@ -11,7 +11,6 @@ using OpenLiveWriter.CoreServices;
using OpenLiveWriter.HtmlEditor.Controls;
using OpenLiveWriter.HtmlParser.Parser;
using OpenLiveWriter.Interop.Windows;
//using OpenLiveWriter.SpellChecker;
namespace OpenLiveWriter.HtmlEditor.Controls
{

View File

@ -29,7 +29,7 @@ using OpenLiveWriter.Interop.Windows;
using OpenLiveWriter.Localization;
using OpenLiveWriter.Mshtml;
using OpenLiveWriter.Mshtml.Mshtml_Interop;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
using IDataObject = System.Windows.Forms.IDataObject;
namespace OpenLiveWriter.HtmlEditor
@ -37,7 +37,7 @@ namespace OpenLiveWriter.HtmlEditor
public abstract class HtmlEditorControl : IHtmlEditor, IHtmlEditorCommandSource, IHtmlEditorComponentContext, IHtmlMarshallingTarget, IHTMLEditHostRaw, IElementBehaviorFactoryRaw, IServiceProviderRaw, IWordBasedEditor, IDisposable
{
#region Construction/Disposal
public HtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IInternetSecurityManager internetSecurityManager, CommandManager commandManager)
public HtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, ISpellingChecker spellingChecker, IInternetSecurityManager internetSecurityManager, CommandManager commandManager)
{
_commandManager = commandManager;
@ -45,8 +45,7 @@ namespace OpenLiveWriter.HtmlEditor
_mainFrameWindow = mainFrameWindow;
_statusBar = statusBar;
//ToDo: OLW Spell Checker
//_spellingChecker = spellingChecker;
_spellingChecker = spellingChecker;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
@ -1580,18 +1579,17 @@ namespace OpenLiveWriter.HtmlEditor
#region Spell Checking Helpers
//ToDo: OLW Spell Checker
/// <summary>
/// Get the spelling-checker (demand-create and cache/re-use)
/// </summary>
//protected ISpellingChecker SpellingChecker
//{
// get
// {
// return _spellingChecker;
// }
//}
//private ISpellingChecker _spellingChecker;
protected ISpellingChecker SpellingChecker
{
get
{
return _spellingChecker;
}
}
private ISpellingChecker _spellingChecker;
#endregion
@ -3478,11 +3476,10 @@ namespace OpenLiveWriter.HtmlEditor
// check spelling
bool fCompleted = false;
//ToDo: OLW Spell Checker
//using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), ignoreOnceSupported))
//{
using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), ignoreOnceSupported))
{
// center the spell-checking form over the document body
//spellCheckerForm.StartPosition = FormStartPosition.CenterParent;
spellCheckerForm.StartPosition = FormStartPosition.CenterParent;
// determine whether we are checking a selection or the whole document
// get selection
@ -3490,14 +3487,14 @@ namespace OpenLiveWriter.HtmlEditor
bool checkSelection = (selection != null) && (selection.type.ToLower(CultureInfo.InvariantCulture) == "text");
// get the word range to check
// MshtmlWordRange wordRange = new MshtmlWordRange(HTMLDocument, checkSelection, IgnoreRangeForSpellChecking, new DamageFunction(_damageServices.AddDamage));
MshtmlWordRange wordRange = new MshtmlWordRange(HTMLDocument, checkSelection, IgnoreRangeForSpellChecking, new DamageFunction(_damageServices.AddDamage));
//spellCheckerForm.WordIgnored += (sender, args) => OnSpellCheckWordIgnored(wordRange.CurrentWordRange);
spellCheckerForm.WordIgnored += (sender, args) => OnSpellCheckWordIgnored(wordRange.CurrentWordRange);
// check spelling
using (undoUnit)
{
//spellCheckerForm.CheckSpelling(wordRange, contextDictionaryPath);
spellCheckerForm.CheckSpelling(wordRange, contextDictionaryPath);
undoUnit.Commit();
}
@ -3511,24 +3508,24 @@ namespace OpenLiveWriter.HtmlEditor
}
// return completed status
fCompleted = true; // spellCheckerForm.Completed;
//}
fCompleted = spellCheckerForm.Completed;
}
if (fCompleted && (_mainFrameWindow != null)) // && (_mainFrameWindow is IWordRangeProvider))
if (fCompleted && _mainFrameWindow != null && _mainFrameWindow is IWordRangeProvider)
{
// Spell check the subject, it doesn't support the "ignore once" feature
//using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), false))
using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), false))
{
// center the spell-checking form over the document body
//spellCheckerForm.StartPosition = FormStartPosition.CenterParent;
spellCheckerForm.StartPosition = FormStartPosition.CenterParent;
//IWordRangeProvider wordRangeProvider = (IWordRangeProvider)_mainFrameWindow;
//IWordRange wordRangeSubject = wordRangeProvider.GetSubjectSpellcheckWordRange();
IWordRangeProvider wordRangeProvider = (IWordRangeProvider)_mainFrameWindow;
IWordRange wordRangeSubject = wordRangeProvider.GetSubjectSpellcheckWordRange();
//spellCheckerForm.CheckSpelling(wordRangeSubject, contextDictionaryPath);
spellCheckerForm.CheckSpelling(wordRangeSubject, contextDictionaryPath);
//wordRangeProvider.CloseSubjectSpellcheckWordRange();
fCompleted = true; // spellCheckerForm.Completed;
wordRangeProvider.CloseSubjectSpellcheckWordRange();
fCompleted = spellCheckerForm.Completed;
}
}

View File

@ -20,7 +20,7 @@ using OpenLiveWriter.HtmlParser.Parser;
using OpenLiveWriter.Interop.Windows;
using OpenLiveWriter.Localization;
using OpenLiveWriter.Mshtml;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
namespace OpenLiveWriter.HtmlEditor
{
public class HtmlSourceEditorControl : IHtmlEditor, IHtmlEditorCommandSource
@ -36,12 +36,10 @@ namespace OpenLiveWriter.HtmlEditor
}
}
//ToDo: OLW Spell Checker
//public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager)
public HtmlSourceEditorControl(CommandManager commandManager)
public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager)
{
_commandManager = commandManager;
//_spellingChecker = spellingChecker;
_spellingChecker = spellingChecker;
contextMenu.Entries.Add(CommandId.Cut, false, false);
contextMenu.Entries.Add(CommandId.CopyCommand, false, false);
@ -280,38 +278,36 @@ namespace OpenLiveWriter.HtmlEditor
public bool CheckSpelling(string contextDictionaryPath)
{
//ToDo: OLW Spell Checker
// check spelling
//using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), false))
//{
using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), false))
{
// center the spell-checking form over the document body
//spellCheckerForm.StartPosition = FormStartPosition.CenterParent;
spellCheckerForm.StartPosition = FormStartPosition.CenterParent;
// create word range
// TODO: smarter word range for html
//TextBoxWordRange wordRange = new TextBoxWordRange(_textBox, _textBox.SelectionLength > 0);
//HtmlTextBoxWordRange wordRange = new HtmlTextBoxWordRange(_textBox);
HtmlTextBoxWordRange wordRange = new HtmlTextBoxWordRange(_textBox);
// check spelling
//spellCheckerForm.CheckSpelling(wordRange, contextDictionaryPath);
spellCheckerForm.CheckSpelling(wordRange, contextDictionaryPath);
// return completed status
return true; // spellCheckerForm.Completed;
//}
return spellCheckerForm.Completed;
}
}
//ToDo: OLW Spell Checker
/// <summary>
/// Get the spelling-checker (demand-create and cache/re-use)
/// </summary>
//public ISpellingChecker SpellingChecker
//{
// get
// {
// return _spellingChecker;
// }
//}
//private ISpellingChecker _spellingChecker;
public ISpellingChecker SpellingChecker
{
get
{
return _spellingChecker;
}
}
private ISpellingChecker _spellingChecker;
#endregion

View File

@ -7,6 +7,10 @@
<ProjectGuid>{6A6872BC-67EF-4A42-A21A-30ECED376923}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OpenLiveWriter.SpellChecker\OpenLiveWriter.SpellChecker.csproj">
<Project>{2db3a424-0f1e-44ac-ae01-5454586ce769}</Project>
<Name>OpenLiveWriter.SpellChecker</Name>
</ProjectReference>
<Reference Include="Accessibility" />
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@ -7,7 +7,7 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using OpenLiveWriter.HtmlParser.Parser;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.CoreServices;
using OpenLiveWriter.CoreServices.HTML;
using OpenLiveWriter.Interop.Windows;
@ -139,9 +139,8 @@ namespace OpenLiveWriter.PostEditor
return null;
}
//ToDo: OLW Spell Checker
// NOTE: hardcode to sentry spelling engine -- need to unroll this if we switch engines
private static readonly string CONTEXT_DICTIONARY_FILE = "context.tlx";
private static readonly string CONTEXT_DICTIONARY_FILE = SentrySpellingChecker.ContextDictionaryFileName;
private DirectoryInfo _storageDirectory;
}

View File

@ -35,7 +35,7 @@ using OpenLiveWriter.PostEditor.Tables;
using OpenLiveWriter.PostEditor.ContentSources;
using OpenLiveWriter.PostEditor.PostHtmlEditing.Sidebar;
using OpenLiveWriter.PostEditor.Tagging;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.InternalWriterPlugin;
using Timer = System.Windows.Forms.Timer;
using OpenLiveWriter.PostEditor.WordCount;
@ -49,9 +49,7 @@ using OpenLiveWriter.PostEditor.Commands;
namespace OpenLiveWriter.PostEditor
{
//ToDo: OLW Spell Checker
//internal class ContentEditor : IBlogPostContentEditor, IContentSourceSite, IDisposable, IHtmlEditorCommandSource, IHtmlEditorHost, IBlogPostImageEditingContext, IBlogPostSidebarContext, IContentSourceSidebarContext, IBlogPostSpellCheckingContext, ICommandManagerHost, IEditingMode, IInternalSmartContentContextSource
internal class ContentEditor : IBlogPostContentEditor, IContentSourceSite, IDisposable, IHtmlEditorCommandSource, IHtmlEditorHost, IBlogPostImageEditingContext, IBlogPostSidebarContext, IContentSourceSidebarContext, ICommandManagerHost, IEditingMode, IInternalSmartContentContextSource
internal class ContentEditor : IBlogPostContentEditor, IContentSourceSite, IDisposable, IHtmlEditorCommandSource, IHtmlEditorHost, IBlogPostImageEditingContext, IBlogPostSidebarContext, IContentSourceSidebarContext, IBlogPostSpellCheckingContext, ICommandManagerHost, IEditingMode, IInternalSmartContentContextSource
{
public ContentEditor(IMainFrameWindow mainFrameWindow, Control editorContainer, IBlogPostEditingSite postEditingSite, IInternetSecurityManager internetSecurityManager, BlogPostHtmlEditorControl.TemplateStrategy templateStrategy, int dlControlFlags)
{
@ -146,7 +144,7 @@ namespace OpenLiveWriter.PostEditor
_mshtmlOptions.DocHostUIOptionKeyPath = GlobalEditorOptions.GetSetting<string>(ContentEditorSetting.MshtmlOptionKeyPath);
// create the editor
_normalHtmlContentEditor = new BlogPostHtmlEditorControl(_mainFrameWindow, StatusBar, _mshtmlOptions, this, this, this, new SmartContentResizedListener(ResizedListener), new SharedCanvasImageReferenceFixer(ReferenceFixer), internetSecurityManager, CommandManager, templateStrategy, this);
_normalHtmlContentEditor = new BlogPostHtmlEditorControl(_mainFrameWindow, StatusBar, _mshtmlOptions, this, this, this, new SmartContentResizedListener(ResizedListener), this, new SharedCanvasImageReferenceFixer(ReferenceFixer), internetSecurityManager, CommandManager, templateStrategy, this);
_normalHtmlContentEditor.PostBodyInlineStyle = GetPostBodyInlineStyleOverrides();
// hookup services and events
_normalHtmlContentEditor.HtmlGenerationService = new HtmlGenerator(this);
@ -209,8 +207,7 @@ namespace OpenLiveWriter.PostEditor
private void InitializeSourceEditor()
{
// create the source code editor control
//_codeHtmlContentEditor = new BlogPostHtmlSourceEditorControl(this, CommandManager, this);
_codeHtmlContentEditor = new BlogPostHtmlSourceEditorControl(CommandManager, this);
_codeHtmlContentEditor = new BlogPostHtmlSourceEditorControl(this, CommandManager, this);
_codeHtmlContentEditor.AccessibleName = "Source Editor";
@ -729,12 +726,11 @@ namespace OpenLiveWriter.PostEditor
ContentSourceManager.GlobalContentSourceListChanged -= new EventHandler(ContentSourceManager_GlobalContentSourceListChanged);
CommandManager.CommandStateChanged -= new EventHandler(CommandManager_CommandStateChanged);
//ToDo: OLW Spell Checker
//if (_spellingChecker != null)
//{
// _spellingChecker.Dispose();
// _spellingChecker = null;
//}
if (_spellingChecker != null)
{
_spellingChecker.Dispose();
_spellingChecker = null;
}
if (_insertImageDialogWin7 != null)
{
@ -2407,7 +2403,7 @@ namespace OpenLiveWriter.PostEditor
{
get
{
return true; // _spellingChecker.IsInitialized;
return _spellingChecker.IsInitialized;
}
}
@ -2421,12 +2417,11 @@ namespace OpenLiveWriter.PostEditor
get { return _autoCorrectLexiconFile; }
}
//ToDo: OLW Spell Checker
//public ISpellingChecker SpellingChecker
//{
// get { return _spellingChecker; }
//}
//private NlgSpellingChecker _spellingChecker = new NlgSpellingChecker();
public ISpellingChecker SpellingChecker
{
get { return _spellingChecker; }
}
private WinSpellingChecker _spellingChecker = new WinSpellingChecker();
public void SetSpellingOptions(string dllName, ushort lcid, string[] mainLexFiles, string userLexFile, uint sobitOptions, bool useAutoCorrect)
{
@ -2438,17 +2433,16 @@ namespace OpenLiveWriter.PostEditor
return;
}
//ToDo: OLW Spell Checker
//_spellingChecker.StopChecking();
//_spellingChecker.SetOptions(dllName, lcid, mainLexFiles, userLexFile, sobitOptions);
//_spellingChecker.StartChecking(_supportingFileStorage != null ? PostSpellingContextDirectory : null);
_spellingChecker.StopChecking();
_spellingChecker.SetOptions(dllName, lcid, mainLexFiles, userLexFile, sobitOptions);
_spellingChecker.StartChecking(_supportingFileStorage != null ? PostSpellingContextDirectory : null);
// Get autocorrect file if needed, mso.acl ships with Writer/Shared Canvas
_autoCorrectLexiconFile = null;
//if (useAutoCorrect && lcid == 1033 /* en-us */ && File.Exists(Path.Combine(SpellingSettings.DictionaryPath, "mso.acl")))
//{
// _autoCorrectLexiconFile = Path.Combine(SpellingSettings.DictionaryPath, "mso.acl");
//}
if (useAutoCorrect && lcid == 1033 /* en-us */ && File.Exists(Path.Combine(SpellingSettings.DictionaryPath, "mso.acl")))
{
_autoCorrectLexiconFile = Path.Combine(SpellingSettings.DictionaryPath, "mso.acl");
}
if (SpellingOptionsChanged != null)
{
@ -2458,8 +2452,8 @@ namespace OpenLiveWriter.PostEditor
public void DisableSpelling()
{
//_spellingChecker.StopChecking();
//_spellingChecker.SetOptions(null, 0, null, null, 0);
_spellingChecker.StopChecking();
_spellingChecker.SetOptions(null, 0, null, null, 0);
if (SpellingOptionsChanged != null)
SpellingOptionsChanged(this, EventArgs.Empty);
}

View File

@ -10,7 +10,7 @@ using OpenLiveWriter.HtmlEditor;
using OpenLiveWriter.HtmlEditor.Controls;
using OpenLiveWriter.Interop.Com.Ribbon;
using OpenLiveWriter.Interop.Windows;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
namespace OpenLiveWriter.PostEditor
{
@ -19,9 +19,7 @@ namespace OpenLiveWriter.PostEditor
/// IMainFrameWindow and IBlogPostEditingSite which are used by the ContentEditor. It's general functions
/// are to act as a middle man to the window that is holding the canvas.
/// </summary>
//ToDo: OLW Spell Checker
//internal class MainFrameWindowAdapter : IMainFrameWindow, IBlogPostEditingSite, IBlogContext, OpenLiveWriter.Interop.Com.IDropTarget, IDisposable, IETWProvider, IWordRangeProvider
internal class MainFrameWindowAdapter : IMainFrameWindow, IBlogPostEditingSite, IBlogContext, OpenLiveWriter.Interop.Com.IDropTarget, IDisposable, IETWProvider
internal class MainFrameWindowAdapter : IMainFrameWindow, IBlogPostEditingSite, IBlogContext, OpenLiveWriter.Interop.Com.IDropTarget, IDisposable, IETWProvider, IWordRangeProvider
{
private readonly IntPtr _parentWindowHandle;
private readonly Control _editorHostPanel;
@ -68,16 +66,15 @@ namespace OpenLiveWriter.PostEditor
#region IWordRangeProvider Members
//ToDo: OLW Spell Checker
//public IWordRange GetSubjectSpellcheckWordRange()
//{
// return ((IWordRangeProvider)_contentEditorSite).GetSubjectSpellcheckWordRange();
//}
public IWordRange GetSubjectSpellcheckWordRange()
{
return ((IWordRangeProvider)_contentEditorSite).GetSubjectSpellcheckWordRange();
}
//public void CloseSubjectSpellcheckWordRange()
//{
// ((IWordRangeProvider)_contentEditorSite).CloseSubjectSpellcheckWordRange();
//}
public void CloseSubjectSpellcheckWordRange()
{
((IWordRangeProvider)_contentEditorSite).CloseSubjectSpellcheckWordRange();
}
#endregion

View File

@ -13,7 +13,6 @@ using OpenLiveWriter.Localization;
using OpenLiveWriter.Localization.Bidi;
using OpenLiveWriter.PostEditor.Autoreplace;
using OpenLiveWriter.PostEditor.WordCount;
//using OpenLiveWriter.SpellChecker;
namespace OpenLiveWriter.PostEditor
{

View File

@ -14,7 +14,6 @@ using OpenLiveWriter.Localization;
using OpenLiveWriter.Localization.Bidi;
using OpenLiveWriter.PostEditor.ContentSources;
using OpenLiveWriter.PostEditor.LiveClipboard;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.ApplicationFramework.Preferences;

View File

@ -11,6 +11,10 @@
</NuGetPackageImportStamp>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OpenLiveWriter.SpellChecker\OpenLiveWriter.SpellChecker.csproj">
<Project>{2db3a424-0f1e-44ac-ae01-5454586ce769}</Project>
<Name>OpenLiveWriter.SpellChecker</Name>
</ProjectReference>
<Reference Include="Accessibility" />
<Reference Include="DeltaCompressionDotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll</HintPath>

View File

@ -14,7 +14,6 @@ using OpenLiveWriter.CoreServices.Layout;
using OpenLiveWriter.CoreServices.Marketization;
using OpenLiveWriter.Localization;
using OpenLiveWriter.Localization.Bidi;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.ApplicationFramework.Preferences;
using OpenLiveWriter.PostEditor.ContentSources;

View File

@ -44,7 +44,7 @@ using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.Controls;
using OpenLiveWriter.PostEditor.SupportingFiles;
using OpenLiveWriter.PostEditor.Updates;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
using Timer = System.Windows.Forms.Timer;
// @RIBBON TODO: Cleanly remove obsolete code
@ -888,13 +888,13 @@ namespace OpenLiveWriter.PostEditor
private bool CheckSpelling()
{
// do auto spell check
//if (SpellingSettings.CheckSpellingBeforePublish && _htmlEditor.CanSpellCheck)
//{
// if (!_htmlEditor.CheckSpelling(_editingManager.GetPostSpellingContextDirectory()))
// {
// return (DialogResult.Yes == DisplayMessage.Show(MessageId.SpellCheckCancelledStillPost, _mainFrameWindow));
// }
//}
if (SpellingSettings.CheckSpellingBeforePublish && _htmlEditor.CanSpellCheck)
{
if (!_htmlEditor.CheckSpelling(_editingManager.GetPostSpellingContextDirectory()))
{
return (DialogResult.Yes == DisplayMessage.Show(MessageId.SpellCheckCancelledStillPost, _mainFrameWindow));
}
}
return true;
}

View File

@ -13,7 +13,6 @@ using OpenLiveWriter.CoreServices;
using OpenLiveWriter.CoreServices.Layout;
using OpenLiveWriter.Localization;
using OpenLiveWriter.Localization.Bidi;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.ApplicationFramework.Preferences;
using OpenLiveWriter.PostEditor.WordCount;

View File

@ -23,8 +23,7 @@ using OpenLiveWriter.Controls;
using OpenLiveWriter.Mshtml;
using OpenLiveWriter.PostEditor.Commands;
using OpenLiveWriter.PostEditor.PostPropertyEditing;
//using OpenLiveWriter.SpellChecker;
//using OpenLiveWriter.SpellChecker.NLG;
using OpenLiveWriter.SpellChecker;
// @RIBBON TODO: Cleanly remove obsolete code
@ -69,8 +68,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
InitializePropertyEditors();
ApplySpellingSettings(null, EventArgs.Empty);
//ToDo: OLW Spell Checker
//SpellingSettings.SpellingSettingsChanged += ApplySpellingSettings;
SpellingSettings.SpellingSettingsChanged += ApplySpellingSettings;
EditorLoaded += new EventHandler(BlogPostHtmlEditor_EditorLoaded);
FixCommandEvent += new FixCommendsDelegate(BlogPostHtmlEditor_FixCommandEvent);
@ -78,15 +76,12 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
public override void Dispose()
{
//ToDo: OLW Spell Checker
//SpellingSettings.SpellingSettingsChanged -= ApplySpellingSettings;
SpellingSettings.SpellingSettingsChanged -= ApplySpellingSettings;
base.Dispose();
}
public override void OnEditorAccountChanged(IEditorAccount newEditorAccount)
{
//ToDo: OLW Spell Checker
// Crashes here: return value of CommandManager.Get(CommandId.IgnoreOnce) is null
Command cmd = CommandManager.Get(CommandId.IgnoreOnce);
if (cmd != null)
{
@ -103,37 +98,37 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
private void ApplySpellingSettings(object sender, EventArgs args)
{
//ToDo: OLW Spell Checker
//SpellingCheckerLanguage language = SpellingSettings.Language;
SpellingCheckerLanguage language = SpellingSettings.Language;
//if (language == SpellingCheckerLanguage.None)
//{
if (language == SpellingCheckerLanguage.None)
{
// No language selected. Disable the speller and return.
DisableSpelling();
return;
//ToDo: OLW Spell Checker
//ToDo: OLW Spell Checker
// SpellingLanguageEntry languageEntry = SpellingSettings.GetInstalledLanguage(language);
}
else
{
SpellingLanguageEntry languageEntry = SpellingSettings.GetInstalledLanguage(language);
//uint sobit = 0;
//if (SpellingSettings.IgnoreUppercase)
// sobit |= (uint)SpellerOptionBit.IgnoreAllCaps;
//if (SpellingSettings.IgnoreWordsWithNumbers)
// sobit |= (uint)SpellerOptionBit.IgnoreMixedDigits;
uint sobit = 0;
if (SpellingSettings.IgnoreUppercase)
sobit |= (uint)SpellerOptionBit.IgnoreAllCaps;
if (SpellingSettings.IgnoreWordsWithNumbers)
sobit |= (uint)SpellerOptionBit.IgnoreMixedDigits;
//sobit |= (uint)SpellerOptionBit.IgnoreSingleLetter;
sobit |= (uint)SpellerOptionBit.IgnoreSingleLetter;
//List<string> lexAbsPaths = new List<string>(languageEntry.CSAPILex.Length);
//foreach (string path in languageEntry.CSAPILex)
// lexAbsPaths.Add(Path.Combine(SpellingSettings.DictionaryPath, path));
//string engineDllAbsPath = Path.Combine(SpellingSettings.DictionaryPath, languageEntry.CSAPIEngine);
List<string> lexAbsPaths = new List<string>(languageEntry.CSAPILex.Length);
foreach (string path in languageEntry.CSAPILex)
lexAbsPaths.Add(Path.Combine(SpellingSettings.DictionaryPath, path));
string engineDllAbsPath = Path.Combine(SpellingSettings.DictionaryPath, languageEntry.CSAPIEngine);
//SetSpellingOptions(engineDllAbsPath,
// languageEntry.LCID,
// lexAbsPaths.ToArray(),
// SpellingSettings.UserDictionaryPath,
// sobit,
// SpellingSettings.EnableAutoCorrect);
SetSpellingOptions(engineDllAbsPath,
languageEntry.LCID,
lexAbsPaths.ToArray(),
SpellingSettings.UserDictionaryPath,
sobit,
SpellingSettings.EnableAutoCorrect);
}
}
void BlogPostHtmlEditor_FixCommandEvent(bool fullyEditableActive)

View File

@ -29,7 +29,7 @@ using OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors;
using OpenLiveWriter.PostEditor.PostHtmlEditing.Sidebar;
using OpenLiveWriter.PostEditor.Tables;
using OpenLiveWriter.PostEditor.Tagging;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.CoreServices.HTML;
using OpenLiveWriter.PostEditor.Emoticons;
using OpenLiveWriter.Api;
@ -39,20 +39,17 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
internal class BlogPostHtmlEditorControl : HtmlEditorControl, IBlogPostHtmlEditor, IHtmlEditorComponentContext
{
//ToDo: OLW Spell Checker
//public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IBlogPostSpellCheckingContext spellingContext, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext) : base(mainFrameWindow, statusBar, options, internetSecurityManager, commandManager)
public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext)
: base(mainFrameWindow, statusBar, options, internetSecurityManager, commandManager)
public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IBlogPostSpellCheckingContext spellingContext, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext)
: base(mainFrameWindow, statusBar, options, spellingContext.SpellingChecker, internetSecurityManager, commandManager)
{
_strategy = strategy;
_imageEditingContext = imageEditingContext;
_sidebarContext = sidebarContext;
_sourceContext = sourceContext;
_resizedListener = resizedListener;
//ToDo: OLW Spell Checker
//_spellingContext = spellingContext;
_spellingContext = spellingContext;
//_spellingManager = new SpellingManager(CommandManager);
_spellingManager = new SpellingManager(CommandManager);
_keyBoardHandler = new PostEditorKeyboardHandler(this, imageEditingContext, editingModeContext);
_referenceFixer = referenceFixer;
@ -107,12 +104,11 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
public override void Dispose()
{
//ToDo: OLW Spell Checker
//EditingContextChanged -= _spellingManager.UpdateSpellingContext;
//_spellingContext.SpellingOptionsChanged -= spellingSettings_SpellingSettingsChanged;
EditingContextChanged -= _spellingManager.UpdateSpellingContext;
_spellingContext.SpellingOptionsChanged -= spellingSettings_SpellingSettingsChanged;
//if (_spellingManager != null)
// _spellingManager.Dispose();
if (_spellingManager != null)
_spellingManager.Dispose();
if (_keyBoardHandler != null)
{
@ -132,7 +128,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
readonly IBlogPostSidebarContext _sidebarContext;
readonly IContentSourceSidebarContext _sourceContext;
readonly SmartContentResizedListener _resizedListener;
//readonly IBlogPostSpellCheckingContext _spellingContext;
readonly IBlogPostSpellCheckingContext _spellingContext;
private PostEditorKeyboardHandler _keyBoardHandler;
private IImageReferenceFixer _referenceFixer;
private TemplateStrategy _strategy;
@ -199,14 +195,12 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
TitleChanged(this, e);
}
//ToDo: OLW Spell Checker
//public event EventHandler EditingContextChanged;
public event EventHandler EditingContextChanged;
public void UpdateEditingContext()
{
//ToDo: OLW Spell Checker
//if (EditingContextChanged != null)
//EditingContextChanged(_spellingContext, null);
if (EditingContextChanged != null)
EditingContextChanged(_spellingContext, null);
}
public event EventHandler EditableRegionFocusChanged;
@ -332,8 +326,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
//post body element, so force the scroll back to the top of the document.
ScrollToTop();
//ToDo: OLW Spell Checker
//_spellingManager.ClearIgnoreOnce();
_spellingManager.ClearIgnoreOnce();
refreshSpellCheckingSettings();
// Work around for 38082...conditionalize this for writer so that it doesn't steal focus for mail's case.
@ -1286,8 +1279,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
private bool _templateContainsTitle;
public void LoadHtmlFragment(string title, string blogPostBody, string baseUrl, BlogEditingTemplate editingTemplate)
{
//ToDo: OLW Spell Checker
//_spellingManager.ClearIgnoreOnce();
_spellingManager.ClearIgnoreOnce();
_templateContainsTitle = editingTemplate.ContainsTitle;
//if any manually attached behaviors are attached, remove them.
@ -1729,8 +1721,8 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
{
MshtmlEditor.BeginInvoke(new ThreadStart(() =>
{
//_spellingManager.DamagedRange(newContentRange, false);
//_spellingManager.IgnoreOnce(newContentRange);
_spellingManager.DamagedRange(newContentRange, false);
_spellingManager.IgnoreOnce(newContentRange);
}), null);
}
}
@ -1865,8 +1857,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
public override bool IsSelectionMisspelled()
{
//ToDo: OLW Spell Checker
return false; // _spellingManager.FindMisspelling(SelectedMarkupRange.Start) != null || _spellingManager.IsInIgnoredWord(SelectedMarkupRange.Start);
return _spellingManager.FindMisspelling(SelectedMarkupRange.Start) != null || _spellingManager.IsInIgnoredWord(SelectedMarkupRange.Start);
}
private CommandContextMenuDefinition ContextMenuForElement(IHTMLElement element, Point screenPoint)
@ -1888,36 +1879,34 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
}
else
{
//MisspelledWordInfo wordInfo = _spellingManager.FindMisspelling(ScreenPointToMarkupPointer(screenPoint));
MisspelledWordInfo wordInfo = _spellingManager.FindMisspelling(ScreenPointToMarkupPointer(screenPoint));
CommandContextMenuDefinition minimalTextEditingCommands = new TextContextMenuDefinition(true);
bool anchorCommandsSupported = FullyEditableRegionActive &&
HTMLElementHelper.GetContainingAnchorElement(element) != null;
// Ignore once once work in an edit field because we replace the HTML of smart content to much
//_spellingManager.IsIgnoreOnceEnabled = !isEditField;
_spellingManager.IsIgnoreOnceEnabled = !isEditField;
if (anchorCommandsSupported)
{
//ToDo: OLW Spell Checker
//if (null != wordInfo)
//{
// return MergeContextMenuDefinitions(_spellingManager.CreateSpellCheckingContextMenu(wordInfo),
// MergeContextMenuDefinitions(new AnchorContextMenuDefinition(GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions)), minimalTextEditingCommands));
//}
//else
//{
return MergeContextMenuDefinitions(new AnchorContextMenuDefinition(GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions)), minimalTextEditingCommands);
//}
if (null != wordInfo)
{
return MergeContextMenuDefinitions(_spellingManager.CreateSpellCheckingContextMenu(wordInfo),
MergeContextMenuDefinitions(new AnchorContextMenuDefinition(GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions)), minimalTextEditingCommands));
}
else
{
return MergeContextMenuDefinitions(new AnchorContextMenuDefinition(GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ShowAllLinkOptions)), minimalTextEditingCommands);
}
}
else
{
if (null != wordInfo)
{
return MergeContextMenuDefinitions(_spellingManager.CreateSpellCheckingContextMenu(wordInfo), minimalTextEditingCommands);
}
else
{
//ToDo: OLW Spell Checker
//if (null != wordInfo)
//{
// return MergeContextMenuDefinitions(_spellingManager.CreateSpellCheckingContextMenu(wordInfo), minimalTextEditingCommands);
//}
//else
//{
if (_tableEditingManager.ShowTableContextMenuForElement(element))
{
return MergeContextMenuDefinitions(
@ -1927,7 +1916,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
{
return new TextContextMenuDefinition();
}
//}
}
}
}
@ -2096,22 +2085,21 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
private void InitializeSpellChecking()
{
IHTMLEditorDamageServices damageServices = ((IHtmlEditorComponentContext)this).DamageServices;
//ToDo: OLW Spell Checker
//if (_spellingManager == null)
if (_spellingManager == null)
return;
//_spellingManager.Initialize(SpellingChecker, MshtmlEditor.MshtmlControl, HTMLDocument,
// new ReplaceWord(InsertHtml), IgnoreRangeForSpellChecking, new DamageFunction(damageServices.AddDamage));
_spellingManager.Initialize(SpellingChecker, MshtmlEditor.MshtmlControl, HTMLDocument,
new ReplaceWord(InsertHtml), IgnoreRangeForSpellChecking, new DamageFunction(damageServices.AddDamage));
//EditingContextChanged += new EventHandler(_spellingManager.UpdateSpellingContext);
//_spellingContext.SpellingOptionsChanged += new EventHandler(spellingSettings_SpellingSettingsChanged);
//_spellingManager.InitializeSession(_spellingContext);
EditingContextChanged += new EventHandler(_spellingManager.UpdateSpellingContext);
_spellingContext.SpellingOptionsChanged += new EventHandler(spellingSettings_SpellingSettingsChanged);
_spellingManager.InitializeSession(_spellingContext);
}
protected override void OnSpellCheckWordIgnored(MarkupRange range)
{
//_spellingManager.IgnoreOnce(range);
_spellingManager.IgnoreOnce(range);
}
public override bool IgnoreRangeForSpellChecking(MarkupRange range)
@ -2125,8 +2113,8 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
if (range.Start.GetParentElement(IgnoreElementForSpellChecking) != null)
return true;
//ToDo: OLW Spell Checker
return true; // _spellingManager.IsWordIgnored(range);
return _spellingManager.IsWordIgnored(range);
}
private bool IgnoreElementForSpellChecking(IHTMLElement element)
@ -2149,8 +2137,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
return false;
}
//ToDo: OLW Spell Checker
// private SpellingManager _spellingManager;
private SpellingManager _spellingManager;
private void spellingSettings_SpellingSettingsChanged(object sender, EventArgs e)
{
@ -2173,7 +2160,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
if (spellCheckingCommand != null)
{
bool canSpellCheck = false; //ToDo: OLW Spell Checker // _spellingContext.CanSpellCheck;
bool canSpellCheck = _spellingContext.CanSpellCheck;
if (spellCheckingCommand.On != canSpellCheck)
{
CommandManager.BeginUpdate();
@ -2189,17 +2176,17 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
}
}
if (false) //ToDo: OLW Spell Checker //_spellingContext.CanSpellCheck && SpellingSettings.RealTimeSpellChecking && Editable)
if (_spellingContext.CanSpellCheck && SpellingSettings.RealTimeSpellChecking && Editable)
{
//(re)initialize spelling squiggles for the new document
//MshtmlEditor.BeginInvoke(new ThreadStart(() => StartRealTimeSpellChecking(true)));
MshtmlEditor.BeginInvoke(new ThreadStart(() => StartRealTimeSpellChecking(true)));
}
else
{
StopRealTimeSpellChecking();
}
//_keyBoardHandler.SetAutoCorrectFile(_spellingContext.AutoCorrectLexiconFilePath);
_keyBoardHandler.SetAutoCorrectFile(_spellingContext.AutoCorrectLexiconFilePath);
}
private bool _realTimeSpellCheckingStarted = false;
@ -2210,14 +2197,13 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
/// <param name="forceSpellingScan"></param>
private void StartRealTimeSpellChecking(bool forceSpellingScan)
{
//ToDo: OLW Spell Checker
//if (!_realTimeSpellCheckingStarted)
//{
// _realTimeSpellCheckingStarted = true;
//}
if (!_realTimeSpellCheckingStarted)
{
_realTimeSpellCheckingStarted = true;
}
//if (forceSpellingScan)
// _spellingManager.StartSession();
if (forceSpellingScan)
_spellingManager.StartSession();
}
/// <summary>
@ -2228,8 +2214,7 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
if (_realTimeSpellCheckingStarted)
{
_realTimeSpellCheckingStarted = false;
//ToDo: OLW Spell Checker
//_spellingManager.StopSession(false);
_spellingManager.StopSession(false);
}
}
@ -2240,27 +2225,25 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
public void ResumeSpellChecking()
{
//ToDo: OLW Spell Checker
//if (_spellingContext.CanSpellCheck)
//{
// StartRealTimeSpellChecking(true);
//}
if (_spellingContext.CanSpellCheck)
{
StartRealTimeSpellChecking(true);
}
}
protected void HandleSpellingDamage(object source, DamageEvent evt)
{
//ToDo: OLW Spell Checker
//if (_spellingContext.CanSpellCheck)
//{
// foreach (MarkupRange range in evt.DamageRegions)
// {
// if (!range.Positioned)
// continue;
if (_spellingContext.CanSpellCheck)
{
foreach (MarkupRange range in evt.DamageRegions)
{
if (!range.Positioned)
continue;
// foreach (MarkupRange targetRange in IntersectWithEditableElements(range))
// _spellingManager.DamagedRange(targetRange, _realTimeSpellCheckingStarted);
// }
//}
foreach (MarkupRange targetRange in IntersectWithEditableElements(range))
_spellingManager.DamagedRange(targetRange, _realTimeSpellCheckingStarted);
}
}
}
private MarkupPointer ScreenPointToMarkupPointer(Point screenPoint)

View File

@ -18,7 +18,7 @@ using OpenLiveWriter.HtmlEditor;
using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.HtmlParser.Parser;
using OpenLiveWriter.Localization;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
namespace OpenLiveWriter.PostEditor.PostHtmlEditing
{
@ -27,19 +27,16 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
private Panel panelSourceEditor;
private TextBox textBoxTitle;
private HtmlSourceEditorControl sourceControl;
//private readonly IBlogPostSpellCheckingContext spellingContext;
private readonly IBlogPostSpellCheckingContext spellingContext;
private IBlogPostImageEditingContext editingContext;
//ToDo: OLW Spell Checker
//public BlogPostHtmlSourceEditorControl(IBlogPostSpellCheckingContext spellingContext, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
public BlogPostHtmlSourceEditorControl(CommandManager commandManager, IBlogPostImageEditingContext editingContext)
public BlogPostHtmlSourceEditorControl(IBlogPostSpellCheckingContext spellingContext, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
{
//this.spellingContext = spellingContext;
this.spellingContext = spellingContext;
this.editingContext = editingContext;
InitializeComponent();
//sourceControl = new HtmlSourceEditorControl(spellingContext.SpellingChecker, commandManager, editingContext);
sourceControl = new HtmlSourceEditorControl(commandManager, editingContext);
sourceControl = new HtmlSourceEditorControl(spellingContext.SpellingChecker, commandManager, editingContext);
sourceControl.EditorControl.TextChanged += new EventHandler(EditorControl_TextChanged);
sourceControl.EditorControl.GotFocus += new EventHandler(EditorControl_GotFocus);
BorderControl borderControl = new BorderControl();
@ -152,9 +149,8 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
public void UpdateEditingContext()
{
//ToDo: OLW Spell Checker
//sourceControl.SpellingChecker.StopChecking();
//sourceControl.SpellingChecker.StartChecking(spellingContext.PostSpellingContextDirectory);
sourceControl.SpellingChecker.StopChecking();
sourceControl.SpellingChecker.StartChecking(spellingContext.PostSpellingContextDirectory);
}
private void textBoxTitle_TitleGotFocus(object sender, EventArgs e)
@ -389,11 +385,9 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
{
private ReplaceAbsoluteFilePathsOperation _replaceOperation = new ReplaceAbsoluteFilePathsOperation();
private IBlogPostImageEditingContext editingContext;
//ToDo: OLW Spell Checker
//public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
// : base(spellingChecker, commandManager)
public HtmlSourceEditorControl(CommandManager commandManager, IBlogPostImageEditingContext editingContext)
: base(commandManager)
public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
: base(spellingChecker, commandManager)
{
this.editingContext = editingContext;
}

View File

@ -12,7 +12,7 @@ using OpenLiveWriter.Localization;
using OpenLiveWriter.PostEditor.Autoreplace;
using OpenLiveWriter.PostEditor.LiveClipboard;
using OpenLiveWriter.PostEditor.Configuration.Accounts;
//using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.SpellChecker;
using OpenLiveWriter.CoreServices;
namespace OpenLiveWriter.PostEditor
@ -150,13 +150,12 @@ namespace OpenLiveWriter.PostEditor
preferencesPanelTypeTable["accounts"] = type;
types.Add(type);
//ToDo: OLW Spell Checker
//if (SpellingSettings.CanSpellCheck)
//{
// Spelling preferences.
// type = typeof(SpellingPreferencesPanel);
// preferencesPanelTypeTable["spelling"] = type;
// types.Add(type);
type = typeof(SpellingPreferencesPanel);
preferencesPanelTypeTable["spelling"] = type;
types.Add(type);
//}
//glossary management

View File

@ -0,0 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using System;
using System.Runtime.InteropServices;
namespace OpenLiveWriter.SpellChecker
{
[Guid("F4F06001-99F6-448F-9199-E863D771066B")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[ComVisible(true)]
public interface IWordRangeProvider
{
IWordRange GetSubjectSpellcheckWordRange();
void CloseSubjectSpellcheckWordRange();
}
}

View File

@ -60,26 +60,23 @@
<Compile Include="HighlightSegmentTracker.cs" />
<Compile Include="HtmlTextBoxWordRange.cs" />
<Compile Include="IBlogPostSpellCheckingContext.cs" />
<Compile Include="NlgSpellerException.cs" />
<Compile Include="SentrySpellingChecker.cs" />
<Compile Include="SortedMarkupRangeList.cs" />
<Compile Include="ISpellingChecker.cs" />
<Compile Include="IWordRange.cs" />
<Compile Include="IWordRangeProvider.cs" />
<Compile Include="MisspelledWordInfo.cs" />
<Compile Include="MshtmlWordRange.cs" />
<Compile Include="NlgSpellingChecker.cs" />
<Compile Include="NlgSpeller.cs" />
<Compile Include="NLG\ProofBase.cs" />
<Compile Include="NLG\SpellApiEx.cs" />
<Compile Include="SentrySpellingChecker.cs" />
<Compile Include="SpellCheckerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SpellCheckingContextMenuDefinition.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="SpellerOptionBit.cs" />
<Compile Include="SpellingConfigReader.cs" />
<Compile Include="SpellingHighlighter.cs" />
<Compile Include="SpellingLanguageEntry.cs" />
<Compile Include="SpellingManager.cs" />
<Compile Include="SpellingPreferences.cs" />
<Compile Include="SpellingPreferencesPanel.cs">
@ -89,8 +86,8 @@
<Compile Include="SpellingTimer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="SSCE.cs" />
<Compile Include="TextBoxWordRange.cs" />
<Compile Include="WinSpellingChecker.cs" />
<EmbeddedResource Include="Images\SpellingDictionaries.png" />
<EmbeddedResource Include="Images\SpellingGeneral.png" />
<EmbeddedResource Include="Images\SpellingPanelBitmap.png" />
@ -99,26 +96,11 @@
<DependentUpon>SpellCheckerForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SpellingConfig.xml" />
<EmbeddedResource Include="SpellingPreferencesPanel.resx">
<DependentUpon>SpellingPreferencesPanel.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<!-- COPY READ-ONLY REDISTRIBUTABLE DICTIONARIES TO OUTPUT DIRECTORY (ALLOWS THEIR USE
IN DEVELOPMENT CONFIGURATIONS) -->
<RobocopyCompiled Include="$(ProjectDir)Redistribute\Dictionaries\">
<DestinationFolder>$(FullTargetProjectPath)\Dictionaries</DestinationFolder>
</RobocopyCompiled>
<RobocopyCompiled Include="$(ProjectDir)\Dictionaries\">
<DestinationFolder>$(FullTargetProjectPath)\Dictionaries</DestinationFolder>
</RobocopyCompiled>
<!-- COPY REDISTRIBUTABLE SPELLING ENGINE DLL TO SYSTEM DIRECTORY -->
<RobocopyCompiled Include="$(ProjectDir)Redistribute\ssceonf1.dll">
<DestinationFolder>$(FullTargetProjectPath)</DestinationFolder>
</RobocopyCompiled>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(RepoRoot)\writer.build.targets" />
</Project>

View File

@ -0,0 +1,14 @@
namespace OpenLiveWriter.SpellChecker
{
public class SentrySpellingChecker
{
public static string ContextDictionaryFileName
{
get
{
// TODO
return string.Empty;
}
}
}
}

View File

@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
namespace OpenLiveWriter.SpellChecker
{
public enum SpellerOptionBit
{
IgnoreAllCaps = 2,
IgnoreMixedDigits = 4,
IgnoreSingleLetter = 131072
}
}

View File

@ -0,0 +1,37 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
namespace OpenLiveWriter.SpellChecker
{
public class SpellingLanguageEntry
{
public readonly SpellingCheckerLanguage Language;
public readonly ushort LCID;
public readonly string CSAPIEngine;
public readonly string TwoLetterIsoLanguageName;
public readonly string DisplayName;
public string[] CSAPILex { get; private set; }
public SpellingLanguageEntry(SpellingCheckerLanguage language, ushort lcid, string csapiEngine, string[] csapiLex, string twoLetterIsoLanguageName, string displayName)
{
// TODO
this.Language = language;
this.CSAPILex = csapiLex;
this.CSAPIEngine = csapiEngine;
this.LCID = lcid;
this.TwoLetterIsoLanguageName = twoLetterIsoLanguageName;
this.DisplayName = displayName;
}
public bool IsInstalled(string lexiconPath)
{
// TODO
return false;
}
public override string ToString()
{
return this.DisplayName;
}
}
}

View File

@ -0,0 +1,85 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using System;
using System.Collections.Generic;
namespace OpenLiveWriter.SpellChecker
{
public class WinSpellingChecker : ISpellingChecker, IDisposable
{
public bool IsInitialized
{
get
{
// TODO
return false;
}
}
public event EventHandler WordAdded;
public event EventHandler WordIgnored;
public void AddToUserDictionary(string word)
{
// TODO
if (WordAdded == null)
return;
WordAdded(word, EventArgs.Empty);
}
public SpellCheckResult CheckWord(string word, out string otherWord, out int offset, out int length)
{
// TODO
otherWord = null;
offset = 0;
length = word.Length;
return SpellCheckResult.Correct;
}
public void Dispose()
{
// TODO
}
public void IgnoreAll(string word)
{
// TODO
if (WordIgnored == null)
return;
WordIgnored(word, EventArgs.Empty);
}
public void ReplaceAll(string word, string replaceWith)
{
// TODO
}
public void Reset()
{
// TODO
}
public void StartChecking(string contextDictionaryLocation)
{
// TODO
}
public void StopChecking()
{
// TODO
}
public SpellingSuggestion[] Suggest(string word, short maxSuggestions, short depth)
{
// TODO
List<SpellingSuggestion> list = new List<SpellingSuggestion>();
return list.ToArray();
}
public void SetOptions(string engineDllPath, ushort lcid, string[] mainLexPaths, string userLexiconPath, uint sobitOptions)
{
// TODO
}
}
}

View File

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenLiveWriter.CoreServices", "OpenLiveWriter.CoreServices\OpenLiveWriter.CoreServices.csproj", "{9154B6B4-F2C3-4FB4-BE38-A26A6C9409EE}"
EndProject
@ -83,6 +83,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostBuild.CreateInstaller",
{A5C213F6-F0C6-4FD6-B496-61FE434621A6} = {A5C213F6-F0C6-4FD6-B496-61FE434621A6}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenLiveWriter.SpellChecker", "OpenLiveWriter.SpellChecker\OpenLiveWriter.SpellChecker.csproj", "{2DB3A424-0F1E-44AC-AE01-5454586CE769}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -193,6 +195,10 @@ Global
{4E445FF3-7F7B-46D1-9424-682E146F1F09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E445FF3-7F7B-46D1-9424-682E146F1F09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E445FF3-7F7B-46D1-9424-682E146F1F09}.Release|Any CPU.Build.0 = Release|Any CPU
{2DB3A424-0F1E-44AC-AE01-5454586CE769}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2DB3A424-0F1E-44AC-AE01-5454586CE769}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DB3A424-0F1E-44AC-AE01-5454586CE769}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DB3A424-0F1E-44AC-AE01-5454586CE769}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE