+ if (isDone) { // also try to copy the not-activated sub-documents
+ // they are not in mySubs but as ResultParts
+ int aPartsNum = size(ModelAPI_ResultPart::group());
+ for(int aPart = 0; aPart < aPartsNum; aPart++) {
+ ResultPartPtr aPartRes = std::dynamic_pointer_cast<ModelAPI_ResultPart>
+ (object(ModelAPI_ResultPart::group(), aPart));
+ if (aPartRes) {
+ std::string aDocName = aPartRes->data()->name();
+ if (!aDocName.empty() && mySubs.find(aDocName) == mySubs.end()) {
+ // just copy file
+ TCollection_AsciiString aSubPath(DocFileName(anApp->loadPath().c_str(), aDocName));
+ OSD_Path aPath(aSubPath);
+ OSD_File aFile(aPath);
+ if (aFile.Exists()) {
+ TCollection_AsciiString aDestinationDir(DocFileName(theFileName, aDocName));
+ OSD_Path aDestination(aDestinationDir);
+ aFile.Copy(aDestination);
+ } else {
+ Events_Error::send(
+ std::string("Can not open file ") + aSubPath.ToCString() + " for saving");
+ }
+ }
+ }
+ }
+ }