Example #1
0
void ColDiagramView::save(QTextStream & st, QString & warning,
                          bool copy) const
{
    DiagramItemList items(canvas()->allItems());

    if (!copy)
        // sort is useless for a copy
        items.sort();

    st << "format " << api_format() << "\n";

    // save first the packages fragment, classes instances, notes, icons and text

    foreach (DiagramItem *di, items) {
        switch (di->type()) {
        case UmlPackage:
        case UmlFragment:
        case UmlClass:
        case UmlClassInstance:
        case UmlNote:
        case UmlText:
        case UmlImage:
        case UmlIcon:
            if (!copy || di->copyable())
                di->save(st, FALSE, warning);

            // no break
        default:
            break;
        }
    }

    // then save links selflink and dirs (without messages)

    foreach (DiagramItem *di, items) {
        switch (di->type()) {
        case UmlLink:	// saves associated dirs
        case UmlSelfLink:
            if (!copy || di->copyable())
                di->save(st, FALSE, warning);

        default:	// to avoid warning
            break;
        }
    }

    // then save messages
    ColMsg::save(st, msgs, copy, warning,
                 window()->browser_diagram()->full_name());

    // then save anchors

    foreach (DiagramItem *di, items)
        if ((!copy || di->copyable()) && (di->type() == UmlAnchor))
            di->save(st, FALSE, warning);

    if (!copy && (preferred_zoom != 0)) {
        nl_indent(st);
        st << "preferred_whz " << preferred_size.width() << " "
           << preferred_size.height() << " " << preferred_zoom;
    }

    nl_indent(st);
    st << "end\n";
}
Example #2
0
void ActivityDiagramView::save(QTextStream & st, QString & warning,
                               bool copy) const
{
    DiagramItemList items(canvas()->allItems());
    DiagramItem * di;

    if (!copy)
        // sort is useless for a copy
        items.sort();

    st << "format " << api_format() << "\n";

    // save first activity, activity nodes, actions, objects, packages, fragments, notes and icons

    for (di = items.first(); di != 0; di = items.next()) {
        switch (di->type()) {
        case UmlActivity:
        case UmlInterruptibleActivityRegion:
        case UmlExpansionRegion:
        case UmlActivityPartition:
        case InitialAN:
        case ActivityFinalAN:
        case FlowFinalAN:
        case DecisionAN:
        case MergeAN:
        case ForkAN:
        case JoinAN:
        case UmlActivityAction:
        case UmlActivityObject:
        case UmlNote:
        case UmlText:
        case UmlImage:
        case UmlPackage:
        case UmlFragment:
        case UmlIcon:
            if (!copy || di->copyable())
                di->save(st, FALSE, warning);

            // no break
        default:
            // Parameters, parameter sets and pins are saved by their parents
            // pre & post conditions are saved by activity action
            break;
        }
    }

    // then saves relations

    for (di = items.first(); di != 0; di = items.next()) {
        switch (di->type()) {
        case UmlFlow:
        case UmlDependOn:
            if (!copy || di->copyable())
                di->save(st, FALSE, warning);

        default:
            break;
        }
    }

    // then saves anchors

    for (di = items.first(); di != 0; di = items.next())
        if ((!copy || di->copyable()) && (di->type() == UmlAnchor))
            di->save(st, FALSE, warning);

    if (!copy && (preferred_zoom != 0)) {
        nl_indent(st);
        st << "preferred_whz " << preferred_size.width() << " "
           << preferred_size.height() << " " << preferred_zoom;
    }

    nl_indent(st);
    st << "end\n";
}
void SeqDiagramView::save(QTextStream & st, QString & warning,
                          bool copy) const
{
    DiagramItemList items(canvas()->items());

    if (!copy)
        // sort is useless for a copy
        items.sort();

    st << "format " << api_format() << "\n";

    // save first the fragments, continuation, actors, classes instances, notes, icons and text

    foreach (DiagramItem *di, items) {
        switch (di->typeUmlCode()) {
        case UmlFragment:
        case UmlContinuation:
        case UmlClass:
        case UmlClassInstance:
        case UmlNote:
        case UmlText:
        case UmlImage:
        case UmlIcon:
            if (!copy || di->copyable())
                di->save(st, FALSE, warning);

            // no break
        default:
            break;
        }
    }

    // then save durations

    foreach (DiagramItem *di, items)
        if ((!copy || di->copyable()) &&
                (di->typeUmlCode() == UmlActivityDuration))
            di->save(st, FALSE, warning);

    // then save lost/found start/end

    foreach (DiagramItem *di, items)
        if ((!copy || di->copyable()) &&
                (di->typeUmlCode() == UmlLostFoundMsgSupport))
            di->save(st, FALSE, warning);

    // then save messages

    foreach (DiagramItem *di, items) {
        switch (di->typeUmlCode()) {
        case UmlSyncMsg:
        case UmlAsyncMsg:
        case UmlFoundSyncMsg:
        case UmlFoundAsyncMsg:
        case UmlLostSyncMsg:
        case UmlLostAsyncMsg:
        case UmlSyncSelfMsg:
        case UmlAsyncSelfMsg:
        case UmlReturnMsg:
        case UmlSelfReturnMsg:
            if (!copy || di->copyable())
                di->save(st, FALSE, warning);

        default:
            break;
        }
    }

    // then save anchors

    foreach (DiagramItem *di, items)
        if ((!copy || di->copyable()) && (di->typeUmlCode() == UmlAnchor))
            di->save(st, FALSE, warning);

    if (!copy && (preferred_zoom != 0)) {
        nl_indent(st);
        st << "preferred_whz " << preferred_size.width() << " "
           << preferred_size.height() << " " << preferred_zoom;
    }

    nl_indent(st);
    st << "end\n";
}