This commit is contained in:
Martin Marmsoler
2020-08-24 20:34:18 +02:00
parent 385d0ffd69
commit a10709157d
27 changed files with 276 additions and 167 deletions

View File

@@ -73,22 +73,26 @@ bool TitleBlockProperties::operator!=(const TitleBlockProperties &ip) {
Exporte le cartouche sous formes d'attributs XML ajoutes a l'element e.
@param e Element XML auquel seront ajoutes des attributs
*/
void TitleBlockProperties::toXml(QDomElement &e) const {
e.setAttribute("author", author);
e.setAttribute("title", title);
e.setAttribute("filename", filename);
e.setAttribute("plant", plant);
e.setAttribute("locmach", locmach);
e.setAttribute("indexrev",indexrev);
e.setAttribute("version", version);
e.setAttribute("folio", folio);
e.setAttribute("auto_page_num", auto_page_num);
e.setAttribute("date", exportDate());
e.setAttribute("displayAt", (display_at == Qt::BottomEdge? "bottom" : "right"));
QDomElement TitleBlockProperties::toXml(QDomDocument &xml_document) const {
QDomElement e = xml_document.createElement("inset");
e.appendChild(createXmlProperty(xml_document, "author", author));
e.appendChild(createXmlProperty(xml_document, "title", title));
e.appendChild(createXmlProperty(xml_document, "filename", filename));
e.appendChild(createXmlProperty(xml_document, "plant", plant));
e.appendChild(createXmlProperty(xml_document, "locmach", locmach));
e.appendChild(createXmlProperty(xml_document, "indexrev", indexrev));
e.appendChild(createXmlProperty(xml_document, "version", version));
e.appendChild(createXmlProperty(xml_document, "folio", folio));
e.appendChild(createXmlProperty(xml_document, "auto_page_num", auto_page_num));
e.appendChild(createXmlProperty(xml_document, "date", exportDate()));
e.appendChild(createXmlProperty(xml_document, "displayAt", display_at == Qt::BottomEdge? "bottom" : "right"));
if (!template_name.isEmpty())
{
e.setAttribute("titleblocktemplate", template_name);
e.setAttribute("titleblocktemplateCollection", QET::qetCollectionToString(collection));
e.appendChild(createXmlProperty(xml_document, "titleblocktemplate", template_name));
e.appendChild(createXmlProperty(xml_document, "titleblocktemplateCollection", QET::qetCollectionToString(collection)));
}
if (context.keys().count()) {
@@ -96,13 +100,15 @@ void TitleBlockProperties::toXml(QDomElement &e) const {
context.toXml(properties);
e.appendChild(properties);
}
return e;
}
/**
Importe le cartouche a partir des attributs XML de l'element e
@param e Element XML dont les attributs seront lus
*/
void TitleBlockProperties::fromXml(const QDomElement &e) {
bool TitleBlockProperties::fromXml(const QDomElement &e) {
// reads the historical fields
if (e.hasAttribute("author")) author = e.attribute("author");
if (e.hasAttribute("title")) title = e.attribute("title");