public DocumentView()
        {
            InitializeComponent();
            Loaded              += DocumentViewLoaded;
            wb.Loaded           += WbLoaded;
            wb.OpenExternalLink += WebControl_LinkClicked;

            SizeChanged += new SizeChangedEventHandler(DocumentViewSizeChanged);

            Editor.TextArea.SelectionChanged += SelectionChanged;

            Editor.PreviewMouseLeftButtonUp += HandleMouseUp;

            hunspell = IoC.Get <ISpellingService>();

            spellCheckRenderer = new SpellCheckBackgroundRenderer();

            Editor.TextArea.TextView.BackgroundRenderers.Add(spellCheckRenderer);
            Editor.TextArea.TextView.VisualLinesChanged += TextView_VisualLinesChanged;

            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleBold, (x, y) => ToggleBold(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleItalic, (x, y) => ToggleItalic(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCode, (x, y) => ToggleCode(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCodeBlock, (x, y) => ToggleCodeBlock(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.SetHyperlink, (x, y) => SetHyperlink(), CanEditDocument));
        }
        public SpellCheckProvider(ISpellingService spellingService, DocumentView view)
        {
            _spellingService = spellingService;
            _spellCheckRenderer = new SpellCheckBackgroundRenderer();
            this.View = view;

            this.View.Editor.TextArea.TextView.BackgroundRenderers.Add(_spellCheckRenderer);
            this.View.Editor.TextArea.TextView.VisualLinesChanged += TextView_VisualLinesChanged;
        }