############################################################################## ################## Serialization/Deserialization ########################### ############################################################################## ! Saves as XML. */
| 1234 | Saves as XML. |
| 1235 | */ |
| 1236 | void Spreadsheet::save(QXmlStreamWriter* writer) const { |
| 1237 | Q_D(const Spreadsheet); |
| 1238 | writer->writeStartElement(QStringLiteral("spreadsheet")); |
| 1239 | writeBasicAttributes(writer); |
| 1240 | writeCommentElement(writer); |
| 1241 | |
| 1242 | writer->writeStartElement(QLatin1String("general")); |
| 1243 | writer->writeAttribute(QStringLiteral("showComments"), QString::number(d->showComments)); |
| 1244 | writer->writeAttribute(QStringLiteral("showSparklines"), QString::number(d->showSparklines)); |
| 1245 | writer->writeEndElement(); |
| 1246 | |
| 1247 | writer->writeStartElement(QLatin1String("linking")); |
| 1248 | writer->writeAttribute(QStringLiteral("enabled"), QString::number(d->linking.linking)); |
| 1249 | writer->writeAttribute(QStringLiteral("spreadsheet"), d->linking.spreadsheetPath()); |
| 1250 | writer->writeEndElement(); |
| 1251 | |
| 1252 | // columns |
| 1253 | const auto& columns = children<Column>(ChildIndexFlag::IncludeHidden); |
| 1254 | for (auto* column : columns) |
| 1255 | column->save(writer); |
| 1256 | |
| 1257 | // statistics spreadsheet, if available |
| 1258 | if (d->statisticsSpreadsheet) |
| 1259 | d->statisticsSpreadsheet->save(writer); |
| 1260 | |
| 1261 | writer->writeEndElement(); // "spreadsheet" |
| 1262 | } |
| 1263 | |
| 1264 | /*! |
| 1265 | Loads from XML. |
nothing calls this directly
no test coverage detected