diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 9d954c9fd..6a50c7ea3 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -168,7 +168,7 @@ QRectF BorderTitleBlock::insideBorderRect() const Exports the title block current values to XML. @param xml_elmt the XML element attributes will be added to */ -void BorderTitleBlock::titleBlockToXml(QDomDocument& doc) { +void BorderTitleBlock::titleBlockToXml(QDomElement& doc) { exportTitleBlock().toXml(doc); } diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 9a892e931..325b67254 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -152,7 +152,7 @@ class BorderTitleBlock : public QObject void setPreviousFolioNum(const QString &previous); void setNextFolioNum(const QString &next); - void titleBlockToXml(QDomDocument &doc); + void titleBlockToXml(QDomElement &doc); void titleBlockFromXml(const QDomElement &); void borderToXml(QDomElement &); void borderFromXml(const QDomElement &); diff --git a/sources/diagram.cpp b/sources/diagram.cpp index ebadb836d..42df251c7 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -625,7 +625,7 @@ QDomDocument Diagram::toXml(bool whole_content) { // proprietes du schema if (whole_content) { // TODO: compare with old version - border_and_titleblock.titleBlockToXml(document); + border_and_titleblock.titleBlockToXml(dom_root); border_and_titleblock.borderToXml(dom_root); // Default conductor properties @@ -940,7 +940,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf } // Load border and titleblock - border_and_titleblock.titleBlockFromXml(root); + border_and_titleblock.titleBlockFromXml(root); border_and_titleblock.borderFromXml(root); // Find the element "defaultconductor". diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 73047a0c6..f0f0a5046 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -999,7 +999,7 @@ QDomElement Conductor::toXml(QDomDocument & doc) const { foreach(ConductorSegment *segment, segmentsList()) { current_segment = doc.createElement("segment"); - current_segment.appendChild(createXmlProperty(doc, "orientation", segment->isHorizontal())); + current_segment.appendChild(createXmlProperty(doc, "orientation", segment->isHorizontal() ? "horizontal": "vertical")); current_segment.appendChild(createXmlProperty(doc, "length", segment -> length())); dom_element.appendChild(current_segment); } diff --git a/sources/titleblockproperties.cpp b/sources/titleblockproperties.cpp index 876c18589..c27339e2b 100644 --- a/sources/titleblockproperties.cpp +++ b/sources/titleblockproperties.cpp @@ -69,36 +69,35 @@ 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 */ -QDomElement TitleBlockProperties::toXml(QDomDocument &xml_document) const { +void TitleBlockProperties::toXml(QDomElement &e) const { - QDomElement e = xml_document.createElement("inset"); + 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")); + if (!template_name.isEmpty()) + { + e.setAttribute("titleblocktemplate", template_name); + e.setAttribute("titleblocktemplateCollection", QET::qetCollectionToString(collection)); + } - 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())); - QString disp_at = display_at == Qt::BottomEdge? "bottom" : "right"; - e.appendChild(createXmlProperty(xml_document, "displayAt", disp_at)); + if (context.keys().count()) { + QDomElement properties = e.ownerDocument().createElement("properties"); + context.toXml(properties); + e.appendChild(properties); + } +} - if (!template_name.isEmpty()) - { - e.appendChild(createXmlProperty(xml_document, "titleblocktemplate", template_name)); - e.appendChild(createXmlProperty(xml_document, "titleblocktemplateCollection", QET::qetCollectionToString(collection))); - } - - if (context.keys().count()) { - QDomElement properties = e.ownerDocument().createElement("properties"); - context.toXml(properties); - e.appendChild(properties); - } - - return e; +QDomElement TitleBlockProperties::toXml(QDomDocument &d) const { + qDebug() << "NOT IMPLEMENTED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; + return QDomElement(); } /** RETURNS True diff --git a/sources/titleblockproperties.h b/sources/titleblockproperties.h index 3634df4dc..26daba62b 100644 --- a/sources/titleblockproperties.h +++ b/sources/titleblockproperties.h @@ -41,7 +41,8 @@ class TitleBlockProperties: public PropertiesInterface { bool operator==(const TitleBlockProperties &); bool operator!=(const TitleBlockProperties &); - QDomElement toXml(QDomDocument &xml_document) const override; + QDomElement toXml(QDomDocument &e) const override; + void toXml(QDomElement &e) const; bool fromXml(const QDomElement &) override; void toSettings(QSettings &, const QString & = QString()) const override; void fromSettings(const QSettings &, const QString & = QString()) override;