39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
namespace QWERTYkez.WordProcessor;
|
|
|
|
/// <summary> Определяет тип разрыва или смены ориентации страницы </summary>
|
|
public enum BreakType
|
|
{
|
|
/// <summary>Обычный разрыв страницы (новый лист).</summary>
|
|
PageBreak,
|
|
/// <summary>Начать новую секцию с альбомной ориентацией страницы.</summary>
|
|
NewLandscapeSection,
|
|
/// <summary>Начать новую секцию с книжной ориентацией страницы.</summary>
|
|
NewPortraitSection,
|
|
}
|
|
|
|
public class ReplaceItem
|
|
{
|
|
private ReplaceItem() { }
|
|
public ReplaceItem(string text) => _Text = text;
|
|
public ReplaceItem(BreakType item) => _BreakValue = item;
|
|
|
|
|
|
public static implicit operator ReplaceItem(string text) => new(text);
|
|
public static implicit operator ReplaceItem(BreakType item) => item switch
|
|
{
|
|
BreakType.PageBreak => PageBreak,
|
|
BreakType.NewLandscapeSection => NewLandscapeSection,
|
|
BreakType.NewPortraitSection => NewPortraitSection,
|
|
_ => throw new NotImplementedException()
|
|
};
|
|
|
|
public static ReplaceItem PageBreak { get; } = new() { _BreakValue = BreakType.PageBreak };
|
|
public static ReplaceItem NewLandscapeSection { get; } = new() { _BreakValue = BreakType.NewLandscapeSection };
|
|
public static ReplaceItem NewPortraitSection { get; } = new() { _BreakValue = BreakType.NewPortraitSection };
|
|
|
|
public string Text => _Text;
|
|
public string _Text = string.Empty;
|
|
|
|
public BreakType? BreakValue => _BreakValue;
|
|
public BreakType? _BreakValue;
|
|
} |