31 lines
857 B
C#
31 lines
857 B
C#
namespace QWERTYkez.WordProcessor;
|
|||
|
|
|
||
|
|
internal static class Extension
|
||
|
|
{
|
||
|
|
public static void SwapBottomRight(this PageMargin margin)
|
||
|
|
{
|
||
|
|
if (margin.Right is { } r)
|
||
|
|
{
|
||
|
|
margin.Right = margin.Bottom is not null ? new((uint)margin.Bottom.Value) : null;
|
||
|
|
margin.Bottom = new((int)r.Value);
|
||
|
|
}
|
||
|
|
else if(margin.Bottom is { } b)
|
||
|
|
{
|
||
|
|
margin.Bottom = null;
|
||
|
|
margin.Right = new((uint)b.Value);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
public static void SwapValues(this PageSize size)
|
||
|
|
{
|
||
|
|
if (size.Width is { } w)
|
||
|
|
{
|
||
|
|
size.Width = size.Height is not null ? new(size.Height.Value) : null;
|
||
|
|
size.Height = new(w.Value);
|
||
|
|
}
|
||
|
|
else if (size.Height is { } h)
|
||
|
|
{
|
||
|
|
size.Height = null;
|
||
|
|
size.Width = new(h.Value);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|