Prevent running the formatter without appropriate selection.

- VERBESSERT: Formatieren läßt sich nicht mehr starten, ohne daß Labor-Text markiert ist.
This commit is contained in:
Daniel Kraus
2015-08-14 17:04:50 +02:00
parent 7a105d7aad
commit 863dfa071a
5 changed files with 74 additions and 7 deletions

View File

@ -26,6 +26,7 @@ using zaaReloaded2.Controller;
using System.Collections.ObjectModel;
using System.Runtime.Serialization.Formatters.Soap;
using System.IO;
using Microsoft.Office.Interop.Word;
namespace zaaReloaded2.ViewModels
{
@ -314,7 +315,12 @@ namespace zaaReloaded2.ViewModels
bool CanUseSettings()
{
return LastSelected != null && LastSelected.IsSelected;
Selection selection = Globals.ThisAddIn.Application.ActiveWindow.Selection;
return LastSelected != null && LastSelected.IsSelected &&
(
selection.Paragraphs.Count > 1
|| (selection.Text.Length > 1 && selection.Text.EndsWith("\r"))
);
}
void DoAddSettings()