| 1341 | } |
| 1342 | |
| 1343 | void Document::exportObjects(const std::vector<DocumentObject*>& obj, std::ostream& out) |
| 1344 | { |
| 1345 | |
| 1346 | DocumentExporting exporting(obj); |
| 1347 | d->hashers.clear(); |
| 1348 | |
| 1349 | if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) { |
| 1350 | for (auto o : obj) { |
| 1351 | if (o && o->isAttachedToDocument()) { |
| 1352 | FC_LOG("exporting " << o->getFullName()); |
| 1353 | if (!o->getPropertyByName("_ObjectUUID")) { |
| 1354 | auto prop = static_cast<PropertyUUID*>( |
| 1355 | o->addDynamicProperty("App::PropertyUUID", |
| 1356 | "_ObjectUUID", |
| 1357 | nullptr, |
| 1358 | nullptr, |
| 1359 | Prop_Output | Prop_Hidden)); |
| 1360 | prop->setValue(Base::Uuid::createUuid()); |
| 1361 | } |
| 1362 | } |
| 1363 | } |
| 1364 | } |
| 1365 | |
| 1366 | Base::ZipWriter writer(out); |
| 1367 | writer.putNextEntry("Document.xml"); |
| 1368 | writer.Stream() << "<?xml version='1.0' encoding='utf-8'?>" << '\n'; |
| 1369 | writer.Stream() << R"(<Document SchemaVersion="4" ProgramVersion=")" |
| 1370 | << Application::Config()["BuildVersionMajor"] << "." |
| 1371 | << Application::Config()["BuildVersionMinor"] << "R" |
| 1372 | << Application::Config()["BuildRevision"] << R"(" FileVersion="1">)" |
| 1373 | << '\n'; |
| 1374 | // Add this block to have the same layout as for normal documents |
| 1375 | writer.Stream() << "<Properties Count=\"0\">" << '\n'; |
| 1376 | writer.Stream() << "</Properties>" << '\n'; |
| 1377 | |
| 1378 | // writing the object types |
| 1379 | writeObjects(obj, writer); |
| 1380 | writer.Stream() << "</Document>" << '\n'; |
| 1381 | |
| 1382 | // Hook for others to add further data. |
| 1383 | signalExportObjects(obj, writer); |
| 1384 | |
| 1385 | // write additional files |
| 1386 | writer.writeFiles(); |
| 1387 | d->hashers.clear(); |
| 1388 | } |
| 1389 | |
| 1390 | constexpr auto fcAttrDependencies {"Dependencies"}; |
| 1391 | constexpr auto fcElementObjectDeps {"ObjectDeps"}; |
nothing calls this directly
no test coverage detected