Make some classes ICloneable; implement SettingsRepositoryViewModel.
This commit is contained in:
@ -36,5 +36,12 @@ namespace zaaReloaded2.Controller.Elements
|
||||
{
|
||||
formatter.WriteParagraph(Content);
|
||||
}
|
||||
|
||||
protected override ElementBase CreateInstance()
|
||||
{
|
||||
CustomText clone = new CustomText();
|
||||
clone.Content = Content;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace zaaReloaded2.Controller.Elements
|
||||
/// Base class for formatting elements.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public abstract class ElementBase
|
||||
public abstract class ElementBase : ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the label for this formatting element.
|
||||
@ -44,5 +44,16 @@ namespace zaaReloaded2.Controller.Elements
|
||||
/// Element belongs to. The Formatter object provides access
|
||||
/// to the current Word document etc.</param>
|
||||
abstract public void Run(zaaReloaded2.Formatter.Formatter formatter);
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return CreateInstance();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance that can be used for cloning.
|
||||
/// </summary>
|
||||
/// <returns>New instance of a derived class.</returns>
|
||||
protected abstract ElementBase CreateInstance();
|
||||
}
|
||||
}
|
||||
|
@ -43,5 +43,10 @@ namespace zaaReloaded2.Controller.Elements
|
||||
public SelectEachDay(IList<FormatElementBase> formatElements)
|
||||
: base(formatElements)
|
||||
{ }
|
||||
|
||||
protected override ElementBase CreateInstance()
|
||||
{
|
||||
return new SelectEachDay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,5 +47,10 @@ namespace zaaReloaded2.Controller.Elements
|
||||
public SelectFirstDay(IList<FormatElementBase> formatElements)
|
||||
: base(formatElements)
|
||||
{ }
|
||||
|
||||
protected override ElementBase CreateInstance()
|
||||
{
|
||||
return new SelectFirstDay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,5 +48,10 @@ namespace zaaReloaded2.Controller.Elements
|
||||
public SelectLastDay(IList<FormatElementBase> formatElements)
|
||||
: base(formatElements)
|
||||
{ }
|
||||
|
||||
protected override ElementBase CreateInstance()
|
||||
{
|
||||
return new SelectLastDay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user