diff --git a/src/App/Document.cpp b/src/App/Document.cpp
index 7f267da34f..abea1441bf 100644
--- a/src/App/Document.cpp
+++ b/src/App/Document.cpp
@@ -579,34 +579,7 @@ void Document::Save (Base::Writer &writer) const
PropertyContainer::Save(writer);
// writing the features types
- writer.incInd(); // indention for 'Objects count'
- writer.Stream() << writer.ind() << "objectArray.size() <<"\">" << endl;
-
- writer.incInd(); // indention for 'Object type'
- std::vector::const_iterator it;
- for (it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {
- writer.Stream() << writer.ind() << "" << endl;
-
- // writing the features itself
- writer.Stream() << writer.ind() << "objectArray.size() <<"\">" << endl;
-
- writer.incInd(); // indention for 'Object name'
- for (it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {
- writer.Stream() << writer.ind() << "" << endl;
- }
-
- writer.decInd(); // indention for 'Object name'
- writer.Stream() << writer.ind() << "" << endl;
- writer.decInd(); // indention for 'Objects count'
+ writeObjects(d->objectArray, writer);
writer.Stream() << "" << endl;
}
@@ -685,37 +658,7 @@ void Document::Restore(Base::XMLReader &reader)
} // SchemeVersion "3" or higher
else if ( scheme >= 3 ) {
// read the feature types
- reader.readElement("Objects");
- Cnt = reader.getAttributeAsInteger("Count");
- for (i=0 ;iStatusBits.set(4);
- pObj->Restore(reader);
- pObj->StatusBits.reset(4);
- }
- reader.readEndElement("Object");
- }
- reader.readEndElement("ObjectData");
+ readObjects(reader);
}
reader.readEndElement("Document");
@@ -732,6 +675,20 @@ void Document::exportObjects(const std::vector& obj,
writer.Stream() << "" << endl;
writer.Stream() << "" << endl;
+ // writing the object types
+ writeObjects(obj, writer);
+ writer.Stream() << "" << endl;
+
+ // Hook for others to add further data.
+ signalExportObjects(obj, writer);
+
+ // write additional files
+ writer.writeFiles();
+}
+
+void Document::writeObjects(const std::vector& obj,
+ Base::Writer &writer) const
+{
// writing the features types
writer.incInd(); // indention for 'Objects count'
writer.Stream() << writer.ind() << "" << endl;
@@ -741,7 +698,7 @@ void Document::exportObjects(const std::vector& obj,
for (it = obj.begin(); it != obj.end(); ++it) {
writer.Stream() << writer.ind() << "