14 alignment = Qt::AlignCenter | Qt::AlignVCenter;
37 return(
alignment & Qt::AlignHorizontal_Mask);
44 return(
alignment & Qt::AlignVertical_Mask);
54 int new_type = attr_value.toInt();
72 }
else if (
attribute ==
"horizontal_adjust") {
89 return(qVariantFromValue(
label));
93 return(qVariantFromValue(
value));
98 }
else if (
attribute ==
"horizontal_adjust") {
110 return(
QObject::tr(
"type",
"title block cell property human name"));
112 return(
QObject::tr(
"nom",
"title block cell property human name"));
114 return(
QObject::tr(
"logo",
"title block cell property human name"));
116 return(
QObject::tr(
"label",
"title block cell property human name"));
117 }
else if (
attribute ==
"displaylabel") {
118 return(
QObject::tr(
"affichage du label",
"title block cell property human name"));
120 return(
QObject::tr(
"valeur affichée",
"title block cell property human name"));
122 return(
QObject::tr(
"alignement du texte",
"title block cell property human name"));
124 return(
QObject::tr(
"taille du texte",
"title block cell property human name"));
125 }
else if (
attribute ==
"horizontal_adjust") {
126 return(
QObject::tr(
"ajustement horizontal",
"title block cell property human name"));
159 if (cell_element.hasAttribute(
"name") && !cell_element.attribute(
"name").isEmpty()) {
164 if (cell_element.tagName() ==
"logo") {
165 if (cell_element.hasAttribute(
"resource") && !cell_element.attribute(
"resource").isEmpty()) {
169 }
else if (cell_element.tagName() ==
"field") {
172 QHash<QString, QString> names_options;
173 names_options[
"TagName"] =
"translation";
175 names_options[
"ParentTagName"] =
"value";
177 value_nameslist.
fromXml(cell_element, names_options);
178 if (!value_nameslist.
name().isEmpty()) {
179 value = value_nameslist;
182 names_options[
"ParentTagName"] =
"label";
184 label_nameslist.
fromXml(cell_element, names_options);
185 if (!label_nameslist.
name().isEmpty()) {
186 label = label_nameslist;
189 if (cell_element.hasAttribute(
"displaylabel")) {
190 if (cell_element.attribute(
"displaylabel").compare(
"false", Qt::CaseInsensitive) == 0) {
204 QString halignment = cell_element.attribute(
"align",
"left");
205 if (halignment ==
"right")
alignment |= Qt::AlignRight;
206 else if (halignment ==
"center")
alignment |= Qt::AlignHCenter;
209 QString valignment = cell_element.attribute(
"valign",
"center");
210 if (valignment ==
"bottom")
alignment |= Qt::AlignBottom;
211 else if (valignment ==
"top")
alignment |= Qt::AlignTop;
215 hadjust = cell_element.attribute(
"hadjust",
"true") ==
"true";
226 cell_elmt.setTagName(
"empty");
228 cell_elmt.setTagName(
"logo");
231 cell_elmt.setTagName(
"field");
233 QDomDocument parent_document = cell_elmt.ownerDocument();
235 QHash<QString, QString> names_options;
236 names_options[
"TagName"] =
"translation";
237 names_options[
"ParentTagName"] =
"value";
238 cell_elmt.appendChild(
value.
toXml(parent_document, names_options));
239 names_options[
"ParentTagName"] =
"label";
240 cell_elmt.appendChild(
label.
toXml(parent_document, names_options));
242 cell_elmt.setAttribute(
"displaylabel",
display_label ?
"true" :
"false");
244 cell_elmt.setAttribute(
"fontsize",
font_size);
248 cell_elmt.setAttribute(
"align",
"right");
249 }
else if (
alignment & Qt::AlignHCenter) {
250 cell_elmt.setAttribute(
"align",
"center");
252 cell_elmt.setAttribute(
"align",
"left");
256 cell_elmt.setAttribute(
"valign",
"bottom");
258 cell_elmt.setAttribute(
"valign",
"top");
260 cell_elmt.setAttribute(
"valign",
"center");
263 if (
hadjust) cell_elmt.setAttribute(
"hadjust",
"true");
bool attributeIsAnInteger(const QDomElement &, const QString &, int *=nullptr)
NamesList value
Text displayed by the cell.
int applied_row_span
Actually applied row span.
virtual ~TitleBlockCell()
void setAttribute(const QString &, const QVariant &)
void fromXml(const QDomElement &, const QHash< QString, QString > &=QHash< QString, QString >())
int num_col
x coordinate of the cell within its parent title block template grid
int alignment
Where the label+text should be displayed within the visual cell.
QString name(const QString &=QString()) const
QDomElement toXml(QDomDocument &, const QHash< QString, QString > &=QHash< QString, QString >()) const
void loadContentFromCell(const TitleBlockCell &)
int row_span
number of extra rows spanned by this cell
bool display_label
Whether to display the label or not.
the cell span parameters should be applied without restriction
int font_size
Font size the text should be rendered with.
TemplateCellType cell_type
Cell type: empty, text, logo?
int verticalAlign() const
static QFont fontForCell(const TitleBlockCell &)
NamesList label
Label displayed by the cell.
bool hadjust
Whether to reduce the font size if the text does not fit in the cell.
static QString attributeName(const QString &)
QVariant attribute(const QString &)
TitleBlockCell * spanner_cell
Cell spanning this cell, if any.
QString logo_reference
Logo displayed by this cell, it it is a logo cell.
int horizontalAlign() const
void loadContentFromXml(const QDomElement &)
int span_state
how should row_span and col_span be applied given other cells in the parent template ...
TemplateCellType type() const
void saveContentToXml(QDomElement &)
int col_span
number of extra columns spanned by this cell
QString value_name
name of the cell; not displayed when the title block template is rendered
int num_row
y coordinate of the cell within its parent title block template grid
int applied_col_span
Actually applied column span.