From 17015a3e643f93e61c7250fc2ba8f1704624f19e Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Fri, 25 Apr 2025 16:13:00 +0200 Subject: [PATCH] [feat:] pdf export options (working) --- CorrectionViewModel.cs | 81 +++++++++++++++++++++++ ExportOptions.axaml | 48 ++++++++++++++ ExportOptions.axaml.cs | 27 ++++++++ MainWindow.axaml.cs | 11 +++- PFDExporter.cs | 141 +++++++++++++++++++++++++++++++++-------- 5 files changed, 279 insertions(+), 29 deletions(-) create mode 100644 CorrectionViewModel.cs create mode 100644 ExportOptions.axaml create mode 100644 ExportOptions.axaml.cs diff --git a/CorrectionViewModel.cs b/CorrectionViewModel.cs new file mode 100644 index 0000000..888249c --- /dev/null +++ b/CorrectionViewModel.cs @@ -0,0 +1,81 @@ +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace PLG_Exam.ViewModels; + +public class ExportOptionsViewModel : INotifyPropertyChanged +{ + private bool hasCorrectionLines = false; + private int correctionMargin = 50; + private double lineSpacing= 1.5; + private string textPosition="left"; + + public event PropertyChangedEventHandler? PropertyChanged; + + protected void OnPropertyChanged([CallerMemberName] string? name = null) => + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + + // ToggleSwitch + public bool HasCorrectionLines + { + get => hasCorrectionLines; + set { hasCorrectionLines = value; OnPropertyChanged(); } + } + + // Korrekturrand – RadioButtons mapped auf int + public bool IsCorrectionMarginHalf + { + get => correctionMargin == 100; + set { if (value) { correctionMargin = 100; OnPropertyChanged(); } } + } + + public bool IsCorrectionMarginQuarter + { + get => correctionMargin == 50; + set { if (value) { correctionMargin = 50; OnPropertyChanged(); } } + } + + public bool IsCorrectionMarginNone + { + get => correctionMargin == 0; + set { if (value) { correctionMargin = 0; OnPropertyChanged(); } } + } + + // Zeilenabstand + public bool IsLineSpacing1 + { + get => lineSpacing == 1.0; + set { if (value) { lineSpacing = 1.0; OnPropertyChanged(); } } + } + + public bool IsLineSpacing15 + { + get => lineSpacing == 1.5; + set { if (value) { lineSpacing = 1.5; OnPropertyChanged(); } } + } + + public bool IsLineSpacing2 + { + get => lineSpacing == 2.0; + set { if (value) { lineSpacing = 2.0; OnPropertyChanged(); } } + } + + // Textposition + public bool IsTextLeft + { + get => textPosition == "left"; + set { if (value) { textPosition = "left"; OnPropertyChanged(); } } + } + + public bool IsTextRight + { + get => textPosition == "right"; + set { if (value) { textPosition = "right"; OnPropertyChanged(); } } + } + + // Optional: Getter für externe Verwendung + public int CorrectionMargin => correctionMargin; + public double LineSpacing => lineSpacing; + public string TextPosition => textPosition; +} \ No newline at end of file diff --git a/ExportOptions.axaml b/ExportOptions.axaml new file mode 100644 index 0000000..1ccec5f --- /dev/null +++ b/ExportOptions.axaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +