wxString IntCell::ToXML(bool all) { MathCell* tmp = m_base; wxString base = _T("<r>") + tmp->ToXML(true) + _T("</r>"); tmp = m_var; wxString var = ( tmp == NULL )? wxEmptyString : _T("<r>"); var += tmp->ToXML(true); var += ( var == wxEmptyString )? wxEmptyString : _T("</r>"); tmp = m_under; wxString from = _T("<r>") + tmp->ToXML(true) + _T("</r>"); tmp = m_over; wxString to = _T("<r>") + tmp->ToXML(true) + _T("</r>"); if (m_intStyle == INT_DEF) return wxT("<in>") + from + to + base + var + wxT("</in>") + MathCell::ToXML(all); else return wxT("<in def=\"false\">") + base + var + wxT("</in>") + MathCell::ToXML(all); }
// ToXML // writes a groupcell in the form of // <cell type="code" hide="true"> // --contents-- // </cell> wxString GroupCell::ToXML(bool all) { wxString str; str = wxT("\n<cell"); // start opening tag // write "type" according to m_groupType switch (m_groupType) { case GC_TYPE_CODE: str += wxT(" type=\"code\""); break; case GC_TYPE_IMAGE: str += wxT(" type=\"image\""); break; case GC_TYPE_TEXT: str += wxT(" type=\"text\""); break; case GC_TYPE_TITLE: str += wxT(" type=\"title\""); break; case GC_TYPE_SECTION: str += wxT(" type=\"section\""); break; case GC_TYPE_SUBSECTION: str += wxT(" type=\"subsection\""); break; case GC_TYPE_PAGEBREAK: { str += wxT(" type=\"pagebreak\"/>"); return str + MathCell::ToXML(all); } break; default: str += wxT(" type=\"unknown\""); break; } // write hidden status if (m_hide) str += wxT(" hide=\"true\""); str += wxT(">\n"); MathCell *input = GetInput(); MathCell *output = GetLabel(); // write contents switch (m_groupType) { case GC_TYPE_CODE: if (input != NULL) { str += wxT("<input>\n"); str += input->ToXML(false); str += wxT("</input>"); } if (output != NULL) { str += wxT("\n<output>\n"); str += wxT("<mth>") + output->ToXML(true) + wxT("</mth>"); str += wxT("\n</output>"); } break; case GC_TYPE_IMAGE: if (input != NULL) str += input->ToXML(false); if (output != NULL) str += output->ToXML(true); break; case GC_TYPE_TEXT: if (input) str += input->ToXML(false); break; case GC_TYPE_TITLE: case GC_TYPE_SECTION: case GC_TYPE_SUBSECTION: if (input) str += input->ToXML(false); if (m_hiddenTree) { str += wxT("<fold>"); GroupCell *tmp = m_hiddenTree; while (tmp) { str += tmp->ToXML(false); tmp = dynamic_cast<GroupCell*>(tmp->m_next); } str += wxT("</fold>"); } break; default: if (output != NULL) str += output->ToXML(false); break; } str += wxT("\n</cell>\n"); return str + MathCell::ToXML(all); }