Add AbnormalStyle.Underline; use toggle buttons.

This commit is contained in:
Daniel Kraus 2015-08-25 06:12:53 +02:00
parent cde32f0a7e
commit 36e10d05fd
4 changed files with 45 additions and 4 deletions

View File

@ -36,7 +36,10 @@ namespace zaaReloaded2.Formatter
Bold = 0x01, Bold = 0x01,
[Description("Kursiv")] [Description("Kursiv")]
Italics = 0x02 Italics = 0x02,
[Description("Unterstrichen")]
Underline = 0x04
} }
public static class AbnormalStyleExtensions public static class AbnormalStyleExtensions
@ -56,6 +59,8 @@ namespace zaaReloaded2.Formatter
markup += String.Format("<{0}b>", dash); markup += String.Format("<{0}b>", dash);
if (style.HasFlag(AbnormalStyle.Italics)) if (style.HasFlag(AbnormalStyle.Italics))
markup += String.Format("<{0}i>", dash); markup += String.Format("<{0}i>", dash);
if (style.HasFlag(AbnormalStyle.Underline))
markup += String.Format("<{0}u>", dash);
return markup; return markup;
} }
} }

View File

@ -208,6 +208,12 @@ namespace zaaReloaded2.Formatter
case "</i>": case "</i>":
sel.Font.Italic = 0; sel.Font.Italic = 0;
break; break;
case "<u>":
sel.Font.Underline = WdUnderline.wdUnderlineSingle;
break;
case "</u>":
sel.Font.Underline = WdUnderline.wdUnderlineNone;
break;
case "</style>": case "</style>":
sel.ClearCharacterStyle(); sel.ClearCharacterStyle();
break; break;

View File

@ -162,6 +162,29 @@ namespace zaaReloaded2.ViewModels
} }
} }
/// <summary>
/// Gets or sets whether abnormal values shall be underlined.
/// </summary>
public bool AbnormalUnderline
{
get
{
return _settings.AbnormalStyle.HasFlag(AbnormalStyle.Underline);
}
set
{
if (value)
{
_settings.AbnormalStyle |= AbnormalStyle.Underline;
}
else
{
_settings.AbnormalStyle &= ~AbnormalStyle.Underline;
}
OnPropertyChanged("AbnormalUnderline");
}
}
#endregion #endregion
#region Constructors #region Constructors

View File

@ -60,12 +60,19 @@
SelectedItem="{Binding ReferenceStyle.SelectedItem}" SelectedItem="{Binding ReferenceStyle.SelectedItem}"
x:Name="ReferenceStyleChooser" HorizontalAlignment="Stretch" /> x:Name="ReferenceStyleChooser" HorizontalAlignment="Stretch" />
</DockPanel> </DockPanel>
<DockPanel DockPanel.Dock="Top"> <DockPanel DockPanel.Dock="Top" Margin="0 10 0 0">
<Label DockPanel.Dock="Left" Content="Auszeichnung pathologischer Werte:" Margin="0 0 10 0" <Label DockPanel.Dock="Left" Content="Auszeichnung pathologischer Werte:" Margin="0 0 10 0"
Target="{Binding ElementName=AbnormalStyleChooser}" /> Target="{Binding ElementName=AbnormalStyleChooser}" />
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<CheckBox IsChecked="{Binding AbnormalBold}" Content="Fett" /> <ToggleButton IsChecked="{Binding AbnormalBold}" Height="25" Width="25">
<CheckBox IsChecked="{Binding AbnormalItalics}" Content="Kursiv" Margin="10 0 0 0" /> <TextBlock FontWeight="Black">F</TextBlock>
</ToggleButton>
<ToggleButton IsChecked="{Binding AbnormalItalics}" Height="25" Width="25">
<TextBlock FontStyle="Italic">K</TextBlock>
</ToggleButton>
<ToggleButton IsChecked="{Binding AbnormalUnderline}" Height="25" Width="25">
<TextBlock TextDecorations="Underline">U</TextBlock>
</ToggleButton>
</StackPanel> </StackPanel>
</DockPanel> </DockPanel>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">