169 lines
4.9 KiB
C#
169 lines
4.9 KiB
C#
using System.Collections.Generic;
|
|
using Consulenza.ReportWriter.Business.Entity;
|
|
|
|
namespace Consulenza.ReportWriter.Business.OBJ_PDF
|
|
{
|
|
/// <summary>
|
|
/// Tipologia di elenco puntato.
|
|
/// </summary>
|
|
public enum BulletType
|
|
{
|
|
Pallino,
|
|
Trattino
|
|
}
|
|
|
|
/// <summary>
|
|
/// Rappresenta un elenco puntato.
|
|
/// Gli Items rappresentano la lista di stringhe che saranno disegnate.
|
|
/// Per scrivere un elenco punatto in Bold, Oblique o BoldOblique, impostare la proprietà _font con il relativo valore.
|
|
/// La larghezza di default della TextArea è 520, pari all'area scrivibile del documento.
|
|
/// Di default il _bullettype è settato per disegnare pallini.
|
|
/// Settando la proprietà Margin (default=5) è possibile aumentare lo spazio, sia in alto che in basso tra gli Items.
|
|
/// Utilizza la classe primitiva ceTe.DynamicPDF.PageElements.UnorderedList.
|
|
/// </summary>
|
|
public class UnorderedListPDF : ObjectPDF
|
|
{
|
|
#region Fields
|
|
|
|
private float _fontsize = 8;
|
|
private float _width = 520;
|
|
private List<string> _items = new List<string>();
|
|
private BulletType _bullettype = BulletType.Pallino;
|
|
private float _margin = 5;
|
|
private ceTe.DynamicPDF.TextAlign _textalign = ceTe.DynamicPDF.TextAlign.Justify;
|
|
|
|
|
|
/// <summary>
|
|
/// Imposta o ottiene l'elemento base (PageElement)
|
|
/// </summary>
|
|
public ceTe.DynamicPDF.PageElements.UnorderedList BaseElement { get; set; }
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera la X del documento su cui disegnare l'elenco puntato.
|
|
/// </summary>
|
|
public float X { get; set; }
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera la Y del documento su cui disegnare l'elenco puntato.
|
|
/// </summary>
|
|
public float Y { get; set; }
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera la grandezza del carattere dell'elenco puntato.
|
|
/// Di default=8.
|
|
/// </summary>
|
|
public float FontSize
|
|
{
|
|
get { return _fontsize; }
|
|
set { _fontsize = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera l'altezza.
|
|
/// Se impostata a 0, l'altezza viene recuperata automaticamente.
|
|
/// Di default=0.
|
|
/// </summary>
|
|
public float Height { get; set; }
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera la larghezza.
|
|
/// Di default=520.(Corrisponde alla larghezza totale della pagina scrivibile)
|
|
/// </summary>
|
|
public float Width
|
|
{
|
|
get { return _width; }
|
|
set { _width = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera la lista dei testi da scrivere.
|
|
/// </summary>
|
|
public List<string> Items
|
|
{
|
|
get { return _items; }
|
|
set { _items = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il tipo di bullet.
|
|
/// Di default=Pallino.
|
|
/// </summary>
|
|
public BulletType BulletType
|
|
{
|
|
get { return _bullettype; }
|
|
set { _bullettype = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o ottiene il margine alto e basso tra gli items.
|
|
/// Di default=5.
|
|
/// </summary>
|
|
public float Margin
|
|
{
|
|
get { return _margin; }
|
|
set { _margin = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o ottiene l'allineamento del testo.
|
|
/// Di default=Justify.
|
|
/// </summary>
|
|
public ceTe.DynamicPDF.TextAlign TextAlign
|
|
{
|
|
get { return _textalign; }
|
|
set { _textalign = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Costruttori
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
public UnorderedListPDF()
|
|
{
|
|
ObjectType = ObjectTypePdf.UNORDEREDLIST;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
/// <param name="x">X</param>
|
|
/// <param name="items">Lista di stringhe da scrivere</param>
|
|
public UnorderedListPDF(float x, List<string> items)
|
|
: this()
|
|
{
|
|
X = x;
|
|
_items = items;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
/// <param name="x">X</param>
|
|
/// <param name="items">Lista di stringhe da scrivere</param>
|
|
/// <param name="bullettype">Tipo di bullet. Se non specificato viene usato il pallino.</param>
|
|
public UnorderedListPDF(float x, List<string> items, BulletType bullettype)
|
|
: this(x, items)
|
|
{
|
|
_bullettype = bullettype;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Metodi
|
|
|
|
/// <summary>
|
|
/// Ritorna l'oggetto che sarà stampato sulla pagina del documento.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public override ceTe.DynamicPDF.PageElement ToElement()
|
|
{
|
|
return BaseElement;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|