/** * For use when the user selects only UMLObjects from the * ListView but no diagrams to be copied */ void UMLDragData::setUMLDataClip1(UMLObjectList& objects) { QDomDocument domDoc; QDomElement xmiclip = domDoc.createElement(QLatin1String("xmiclip")); domDoc.appendChild(xmiclip); QDomElement objectsTag = domDoc.createElement(QLatin1String("umlobjects")); xmiclip.appendChild(objectsTag); UMLObjectListIt object_it(objects); UMLObject* obj = 0; while (object_it.hasNext()) { obj = object_it.next(); obj->saveToXMI(domDoc, objectsTag); } setData(QLatin1String("application/x-uml-clip1"), domDoc.toString().toUtf8()); }
/** * For use when the user selects UML Object and Diagrams * from the ListView to be copied */ void UMLDragData::setUMLDataClip2(UMLObjectList& objects, UMLViewList& diagrams) { QDomDocument domDoc; QDomElement xmiclip = domDoc.createElement(QLatin1String("xmiclip")); domDoc.appendChild(xmiclip); QDomElement objectsTag = domDoc.createElement(QLatin1String("umlobjects")); xmiclip.appendChild(objectsTag); UMLObjectListIt object_it(objects); UMLObject* obj = 0; while (object_it.hasNext()) { obj = object_it.next(); obj->saveToXMI(domDoc, objectsTag); } QDomElement viewsTag = domDoc.createElement(QLatin1String("umlviews")); xmiclip.appendChild(viewsTag); foreach(UMLView* view, diagrams) { view->umlScene()->saveToXMI(domDoc, viewsTag); }