don't #include too much stuff in .h

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2984 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-11-08 12:06:56 +00:00
parent fcee90ebd5
commit 0daba49b1d
79 changed files with 642 additions and 434 deletions

View File

@ -45,6 +45,8 @@ libmathed_la_SOURCES = \
math_dotsinset.h \
math_exfuncinset.C \
math_exfuncinset.h \
math_exintinset.C \
math_exintinset.h \
math_factory.C \
math_factory.h \
math_fracinset.C \

View File

@ -6,15 +6,12 @@
#include "math_charinset.h"
#include "math_scriptinset.h"
#include "math_stringinset.h"
#include "math_mathmlstream.h"
#include "support.h"
#include "debug.h"
#include "array.h"
#include "mathed/support.h"
#include "support/LAssert.h"
using std::ostream;
using std::endl;
MathArray::MathArray()
{}
@ -133,24 +130,19 @@ MathAtom & MathArray::back()
}
void MathArray::dump2(ostream & os) const
void MathArray::dump2() const
{
NormalStream ns(lyxerr);
for (const_iterator it = begin(); it != end(); ++it)
os << it->nucleus() << ' ';
ns << it->nucleus() << ' ';
}
void MathArray::dump(ostream & os) const
void MathArray::dump() const
{
NormalStream ns(lyxerr);
for (const_iterator it = begin(); it != end(); ++it)
os << "<" << it->nucleus() << ">";
}
std::ostream & operator<<(std::ostream & os, MathArray const & ar)
{
ar.dump2(os);
return os;
ns << "<" << it->nucleus() << ">";
}
@ -231,7 +223,7 @@ void MathArray::write(MathWriteInfo & wi) const
}
void MathArray::writeNormal(ostream & os) const
void MathArray::writeNormal(NormalStream & os) const
{
MathArray ar = glueChars();
for (const_iterator it = ar.begin(); it != ar.end(); ++it) {
@ -281,7 +273,7 @@ void MathArray::mathmlize(MathMLStream & os) const
else if (ar.size() == 1)
os << ar.begin()->nucleus();
else {
os << "<mrow>";
os << MTag("mrow");
for (const_iterator it = ar.begin(); it != ar.end(); ++it) {
MathInset const * p = it->nucleus();
if (MathScriptInset const * q = ar.asScript(it)) {
@ -290,7 +282,7 @@ void MathArray::mathmlize(MathMLStream & os) const
} else
p->mathmlize(os);
}
os << "</mrow>";
os << ETag("mrow");
}
}

View File

@ -17,7 +17,6 @@
#define MATHEDARRAY_H
#include <vector>
#include <iosfwd>
#include "math_atom.h"
#include "LString.h"
@ -26,10 +25,12 @@ class MathScriptInset;
class MathMacro;
class MathWriteInfo;
class MathMetricsInfo;
class MathMLStream;
class MapleStream;
class OctaveStream;
class LaTeXFeatures;
class NormalStream;
class MapleStream;
class MathMLStream;
class OctaveStream;
#ifdef __GNUG__
#pragma interface
@ -93,9 +94,9 @@ public:
MathAtom & back();
///
void dump(std::ostream &) const;
void dump() const;
///
void dump2(std::ostream &) const;
void dump2() const;
///
void substitute(MathMacro const &);
@ -106,7 +107,7 @@ public:
/// glue chars if necessary
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void validate(LaTeXFeatures &) const;
///
@ -139,8 +140,4 @@ private:
buffer_type bf_;
};
std::ostream & operator<<(std::ostream & os, MathArray const & ar);
#endif

View File

@ -41,7 +41,8 @@
#include "Painter.h"
#include "lyxrc.h"
#include "math_matrixinset.h"
#include "mathed/support.h"
#include "support.h"
#include "math_mathmlstream.h"
using std::ostream;
using std::ifstream;
@ -86,6 +87,12 @@ namespace {
"subs(`\\,`=`\\cdot `,"
"eval(`latex/latex/*`)):\n";
// replace spurious \\noalign{\\medskip} in table output
header +=
"`latex/latex/matrix`:= "
"subs(`\\\\\\\\\\\\noalign{\\\\medskip}` = `\\\\\\\\`,"
"eval(`latex/latex/matrix`)):\n";
//"#`latex/latex/symbol` "
// " := subs((\\'_\\' = \\'`\\_`\\',eval(`latex/latex/symbol`)): ";
@ -217,8 +224,9 @@ namespace {
// create normalized expression
ostringstream os;
NormalStream ns(os);
os << "[" << extra << ' ';
ar.writeNormal(os);
ar.writeNormal(ns);
os << "]";
string data = os.str().c_str();
@ -305,10 +313,12 @@ int InsetFormula::linuxdoc(Buffer const * buf, ostream & os) const
int InsetFormula::docbook(Buffer const * buf, ostream & os) const
{
MathMLStream ms(os);
ms << "<equation><alt>";
ms << MTag("equation") << MTag("alt");
int res = ascii(buf, ms.os_, 0);
ms << "</alt>\n<math>" << par_.nucleus() << "<math></equation>";
return res + 1;
ms << ETag("alt") << MTag("math");
ms << par_.nucleus();
ms << ETag("math") << ETag("equation");
return ms.line_ + res;
}
@ -508,7 +518,7 @@ void InsetFormula::handleExtern(const string & arg)
MathArray ar;
if (selected) {
mathcursor->selGet(ar);
lyxerr << "use selection: " << ar << "\n";
//lyxerr << "use selection: " << ar << "\n";
} else {
mathcursor->end();
mathcursor->stripFromLastEqualSign();

View File

@ -21,7 +21,7 @@
#pragma interface
#endif
#include "mathed/formulabase.h"
#include "formulabase.h"
#include "math_defs.h"
#include "math_atom.h"

View File

@ -38,6 +38,7 @@
#include "lyxlex.h"
#include "lyxtext.h"
#include "lyxfont.h"
#include "math_mathmlstream.h"
using std::ostream;

View File

@ -6,6 +6,7 @@
#include "math_parser.h"
#include "support/LOstream.h"
#include "Lsstream.h"
#include "math_mathmlstream.h"
using std::vector;
@ -73,7 +74,7 @@ void MathArrayInset::write(MathWriteInfo & os) const
}
void MathArrayInset::writeNormal(std::ostream & os) const
void MathArrayInset::writeNormal(NormalStream & os) const
{
os << "[array ";
MathGridInset::writeNormal(os);

View File

@ -22,7 +22,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -6,6 +6,7 @@
#include "Painter.h"
#include "support/LOstream.h"
#include "support.h"
#include "math_mathmlstream.h"
MathBinaryOpInset::MathBinaryOpInset(char op)
@ -50,11 +51,7 @@ void MathBinaryOpInset::write(MathWriteInfo & os) const
}
void MathBinaryOpInset::writeNormal(std::ostream & os) const
void MathBinaryOpInset::writeNormal(NormalStream & os) const
{
os << "[binop " << op_ << ' ';
cell(0).writeNormal(os);
os << " ";
cell(1).writeNormal(os);
os << "]";
os << "[binop " << op_ << ' ' << cell(0) << ' ' << cell(1) << ']';
}

View File

@ -23,7 +23,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
private:

View File

@ -5,6 +5,7 @@
#include "math_binominset.h"
#include "support.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
MathBinomInset::MathBinomInset()
@ -56,7 +57,7 @@ void MathBinomInset::write(MathWriteInfo & os) const
}
void MathBinomInset::writeNormal(std::ostream & os) const
void MathBinomInset::writeNormal(NormalStream & os) const
{
os << "[binom ";
cell(0).writeNormal(os);

View File

@ -20,7 +20,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -9,6 +9,7 @@
#include "Painter.h"
#include "math_cursor.h"
#include "insets/insettext.h"
#include "math_mathmlstream.h"
MathBoxInset::MathBoxInset(string const & name)
@ -46,11 +47,11 @@ UpdatableInset * MathBoxInset::asHyperActiveInset() const
void MathBoxInset::write(MathWriteInfo & os) const
{
os << "\\" << name_ << "{" << cell(0) << "}";
os << "\\" << name_.c_str() << "{" << cell(0) << "}";
}
void MathBoxInset::writeNormal(std::ostream & os) const
void MathBoxInset::writeNormal(NormalStream & os) const
{
os << "[mbox ";
//text_->write(buffer(), os);

View File

@ -32,7 +32,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const &) const;
/// identifies BoxInsets

View File

@ -6,10 +6,8 @@
#include "math_braceinset.h"
#include "math_parser.h"
#include "mathed/support.h"
#include "support/LOstream.h"
using std::max;
#include "support.h"
#include "math_mathmlstream.h"
MathBraceInset::MathBraceInset()
@ -29,7 +27,7 @@ void MathBraceInset::write(MathWriteInfo & os) const
}
void MathBraceInset::writeNormal(std::ostream & os) const
void MathBraceInset::writeNormal(NormalStream & os) const
{
os << "[block ";
cell(0).writeNormal(os);

View File

@ -24,7 +24,7 @@ public:
///
void write(MathWriteInfo & os) const;
/// write normalized content
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;

View File

@ -8,9 +8,10 @@
#include "LColor.h"
#include "Painter.h"
#include "support/LOstream.h"
#include "mathed/support.h"
#include "support.h"
#include "math_parser.h"
#include "debug.h"
#include "math_mathmlstream.h"
MathCharInset::MathCharInset(char c)
@ -101,7 +102,7 @@ void MathCharInset::write(MathWriteInfo & os) const
}
void MathCharInset::writeNormal(std::ostream & os) const
void MathCharInset::writeNormal(NormalStream & os) const
{
os << "[char " << char_ << " " << "mathalpha" << "]";
}

View File

@ -35,7 +35,7 @@ public:
///
void writeRaw(std::ostream &) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
int ascent() const;
///

View File

@ -40,6 +40,7 @@
#include "math_scriptinset.h"
#include "math_spaceinset.h"
#include "math_specialcharinset.h"
#include "math_mathmlstream.h"
#define FILEDEBUG 0

View File

@ -3,12 +3,9 @@
#endif
#include "math_decorationinset.h"
#include "mathed/support.h"
#include "support.h"
#include "math_parser.h"
#include "support/LOstream.h"
using std::ostream;
#include "math_mathmlstream.h"
MathDecorationInset::MathDecorationInset(string const & name)
@ -98,13 +95,11 @@ void MathDecorationInset::write(MathWriteInfo & os) const
{
if (os.fragile && protect())
os << "\\protect";
os << '\\' << name_ << '{' << cell(0) << '}';
os << '\\' << name_.c_str() << '{' << cell(0) << '}';
}
void MathDecorationInset::writeNormal(ostream & os) const
void MathDecorationInset::writeNormal(NormalStream & os) const
{
os << "[" << name_ << " ";
cell(0).writeNormal(os);
os << "] ";
os << "[deco " << name_.c_str() << ' ' << cell(0) << ']';
}

View File

@ -26,7 +26,7 @@ public:
///
void metrics(MathMetricsInfo const & st) const;
///
void writeNormal(std::ostream & os) const;
void writeNormal(NormalStream & os) const;
///
bool isScriptable() const;

View File

@ -6,10 +6,9 @@
#include "math_deliminset.h"
#include "math_parser.h"
#include "mathed/support.h"
#include "support.h"
#include "support/LOstream.h"
using std::max;
#include "math_mathmlstream.h"
MathDelimInset::MathDelimInset(string const & l, string const & r)
@ -45,16 +44,15 @@ string MathDelimInset::latexName(string const & name)
void MathDelimInset::write(MathWriteInfo & os) const
{
os << "\\left" << latexName(left_) << cell(0)
<< "\\right" << latexName(right_);
os << "\\left" << latexName(left_).c_str() << cell(0)
<< "\\right" << latexName(right_).c_str();
}
void MathDelimInset::writeNormal(std::ostream & os) const
void MathDelimInset::writeNormal(NormalStream & os) const
{
os << "[delim " << latexName(left_) << ' ' << latexName(right_) << ' ';
cell(0).writeNormal(os);
os << "]";
os << "[delim " << latexName(left_).c_str() << ' '
<< latexName(right_).c_str() << ' ' << cell(0) << ']';
}
@ -77,8 +75,8 @@ void MathDelimInset::metrics(MathMetricsInfo const & mi) const
int h0 = (a + d) / 2;
int a0 = std::max(xcell(0).ascent(), a) - h0;
int d0 = std::max(xcell(0).descent(), d) + h0;
ascent_ = max(a0, d0) + h0;
descent_ = max(a0, d0) - h0;
ascent_ = std::max(a0, d0) + h0;
descent_ = std::max(a0, d0) - h0;
width_ = xcell(0).width() + 2 * dw() + 4;
}

View File

@ -24,7 +24,7 @@ public:
///
void write(MathWriteInfo & os) const;
/// write normalized content
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -3,10 +3,8 @@
#endif
#include "math_dotsinset.h"
#include "mathed/support.h"
#include "support/LOstream.h"
using std::ostream;
#include "math_mathmlstream.h"
#include "support.h"
MathDotsInset::MathDotsInset(string const & name)
@ -46,11 +44,11 @@ void MathDotsInset::metrics(MathMetricsInfo const & mi) const
void MathDotsInset::write(MathWriteInfo & os) const
{
os << '\\' << name_ << ' ';
os << '\\' << name_.c_str() << ' ';
}
void MathDotsInset::writeNormal(ostream & os) const
void MathDotsInset::writeNormal(NormalStream & os) const
{
os << "[" << name_ << "] ";
os << "[" << name_.c_str() << "] ";
}

View File

@ -21,7 +21,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
protected:

View File

@ -1,7 +1,6 @@
#include "math_exfuncinset.h"
#include "support.h"
#include "debug.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
using std::ostream;
@ -20,17 +19,13 @@ MathInset * MathExFuncInset::clone() const
void MathExFuncInset::write(MathWriteInfo & os) const
{
os << '\\' << name_ << '{';
cell(0).write(os);
os << '}';
os << '\\' << name_.c_str() << '{' << cell(0) << '}';
}
void MathExFuncInset::writeNormal(ostream & os) const
void MathExFuncInset::writeNormal(NormalStream & os) const
{
os << "[" << name_ << ' ';
cell(0).writeNormal(os);
os << "] ";
os << '[' << name_.c_str() << ' ' << cell(0) << ']';
}
@ -38,14 +33,12 @@ void MathExFuncInset::metrics(MathMetricsInfo const & mi) const
{
mi_ = mi;
mathed_string_dim(LM_TC_TEXTRM, mi_, name_, ascent_, descent_, width_);
lyxerr << "should not happen\n";
}
void MathExFuncInset::draw(Painter & pain, int x, int y) const
{
drawStr(pain, LM_TC_TEXTRM, mi_, x, y, name_);
lyxerr << "should not happen\n";
}

View File

@ -16,7 +16,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -0,0 +1,54 @@
#include "math_exintinset.h"
#include "support.h"
#include "debug.h"
#include "math_mathmlstream.h"
#include "math_symbolinset.h"
MathExIntInset::MathExIntInset(MathScriptInset const & scripts,
MathArray const & core, MathArray const & diff)
: int_(new MathSymbolInset("int")),
scripts_(scripts), core_(core), diff_(diff)
{}
MathInset * MathExIntInset::clone() const
{
return new MathExIntInset(*this);
}
void MathExIntInset::write(MathWriteInfo & os) const
{
scripts_.write(int_.nucleus(), os);
os << core_ << "d" << diff_;
}
void MathExIntInset::writeNormal(NormalStream & os) const
{
//os << "[int " << scripts_ << ' ' << core_ << ' ' << diff_ << ']'
}
void MathExIntInset::metrics(MathMetricsInfo const &) const
{
lyxerr << "should not happen\n";
}
void MathExIntInset::draw(Painter &, int, int) const
{
lyxerr << "should not happen\n";
}
void MathExIntInset::maplize(MapleStream & os) const
{
//os << name_.c_str() << '(' << cell(0) << ')';
}
void MathExIntInset::mathmlize(MathMLStream & os) const
{
//os << name_.c_str() << '(' << cell(0) << ')';
}

View File

@ -0,0 +1,38 @@
// -*- C++ -*-
#ifndef MATH_EXINTINSET_H
#define MATH_EXINTINSET_H
// /\int_l^u f(x) dxin one block (as opposed to 'f','(','x',')' or 'f','x')
// for interfacing external programs
#include "math_scriptinset.h"
class MathExIntInset : public MathInset {
public:
///
MathExIntInset(MathScriptInset const &, MathArray const &, MathArray const &);
///
MathInset * clone() const;
///
void metrics(MathMetricsInfo const & st) const;
///
void draw(Painter &, int x, int y) const;
///
void write(MathWriteInfo & os) const;
///
void writeNormal(NormalStream &) const;
///
void maplize(MapleStream &) const;
///
void mathmlize(MathMLStream &) const;
private:
///
MathAtom int_;
///
MathScriptInset scripts_;
///
MathArray core_;
///
MathArray diff_;
};
#endif

View File

@ -3,6 +3,7 @@
#endif
#include "math_fracbase.h"
#include "math_mathmlstream.h"
MathFracbaseInset::MathFracbaseInset()

View File

@ -3,9 +3,9 @@
#endif
#include "math_fracinset.h"
#include "mathed/support.h"
#include "support.h"
#include "Painter.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
MathFracInset::MathFracInset(bool atop)
@ -50,7 +50,7 @@ void MathFracInset::write(MathWriteInfo & os) const
}
void MathFracInset::writeNormal(std::ostream & os) const
void MathFracInset::writeNormal(NormalStream & os) const
{
if (atop_)
os << "[atop ";
@ -71,5 +71,5 @@ void MathFracInset::maplize(MapleStream & os) const
void MathFracInset::mathmlize(MathMLStream & os) const
{
os << "<mfrac>" << cell(0) << cell(1) << "</mfrac>";
os << MTag("mfrac") << cell(0) << cell(1) << ETag("mfrac");
}

View File

@ -20,7 +20,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -5,11 +5,10 @@
#include "math_funcinset.h"
#include "font.h"
#include "Painter.h"
#include "mathed/support.h"
#include "support/LOstream.h"
#include "support.h"
#include "math_mathmlstream.h"
using std::ostream;
extern LyXFont WhichFont(short type, int size);
@ -39,13 +38,13 @@ void MathFuncInset::setName(string const & n)
void MathFuncInset::write(MathWriteInfo & os) const
{
os << "\\" << name_ << ' ';
os << "\\" << name_.c_str() << ' ';
}
void MathFuncInset::writeNormal(std::ostream & os) const
void MathFuncInset::writeNormal(NormalStream & os) const
{
os << "[" << name_ << "] ";
os << "[func " << name_.c_str() << ']';
}
@ -70,7 +69,7 @@ void MathFuncInset::maplize(MapleStream & os) const
void MathFuncInset::mathmlize(MathMLStream & os) const
{
os << "<mi>" << name_.c_str() << "</mi>";
os << MTag("mi") << name_.c_str() << ETag("mi");
}

View File

@ -25,7 +25,7 @@ public:
///
void write(MathWriteInfo &) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
string const & name() const;
///

View File

@ -1,10 +1,8 @@
#include "math_funcliminset.h"
#include "math_mathmlstream.h"
#include "support.h"
#include "support/LOstream.h"
using std::ostream;
MathFuncLimInset::MathFuncLimInset(string const & name)
: name_(name)
{}
@ -24,13 +22,13 @@ bool MathFuncLimInset::isScriptable() const
void MathFuncLimInset::write(MathWriteInfo & os) const
{
os << '\\' << name_ << ' ';
os << '\\' << name_.c_str() << ' ';
}
void MathFuncLimInset::writeNormal(ostream & os) const
void MathFuncLimInset::writeNormal(NormalStream & os) const
{
os << "[" << name_ << "] ";
os << "[funclim " << name_.c_str() << ']';
}

View File

@ -16,7 +16,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -3,8 +3,8 @@
#endif
#include "math_gridinset.h"
#include "math_mathmlstream.h"
#include "lyxfont.h"
#include "support/LOstream.h"
#include "debug.h"
@ -266,25 +266,22 @@ void MathGridInset::write(MathWriteInfo & os) const
{
for (row_type row = 0; row < nrows(); ++row) {
for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col);
os << eolString(row);
os << cell(index(row, col)) << eocString(col).c_str();
os << eolString(row).c_str();
}
}
void MathGridInset::writeNormal(std::ostream & os) const
void MathGridInset::writeNormal(NormalStream & os) const
{
os << "[grid ";
for (row_type row = 0; row < nrows(); ++row) {
os << "[row ";
for (col_type col = 0; col < ncols(); ++col) {
os << "[cell ";
cell(index(row, col)).writeNormal(os);
os << "]";
}
os << "]";
for (col_type col = 0; col < ncols(); ++col)
os << "[cell " << cell(index(row, col)) << ']';
os << ']';
}
os << "]";
os << ']';
}
@ -607,14 +604,14 @@ void MathGridInset::maplize(MapleStream & os) const
void MathGridInset::mathmlize(MathMLStream & os) const
{
os << "<mtable>";
os << MTag("mtable");
for (row_type row = 0; row < nrows(); ++row) {
os << "<mtr>";
os << MTag("mtr");
for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col));
os << "</mtr>";
os << ETag("mtr");
}
os << "</mtable>";
os << ETag("mtable");
}

View File

@ -66,7 +66,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -24,6 +24,7 @@
#include "Lsstream.h"
#include "math_inset.h"
#include "math_scriptinset.h"
#include "math_mathmlstream.h"
#include "debug.h"
@ -160,10 +161,10 @@ void MathInset::idxDeleteRange(idx_type, idx_type)
{}
void MathInset::writeNormal(std::ostream & os) const
void MathInset::writeNormal(NormalStream & os) const
{
os << "[unknown ";
MathWriteInfo wi(0, os, false);
MathWriteInfo wi(0, os.os_, false);
write(wi);
os << "] ";
}
@ -219,17 +220,20 @@ void MathInset::write(MathWriteInfo &) const
void MathInset::octavize(OctaveStream & os) const
{
writeNormal(os.os_);
NormalStream ns(os.os_);
writeNormal(ns);
}
void MathInset::maplize(MapleStream & os) const
{
writeNormal(os.os_);
NormalStream ns(os.os_);
writeNormal(ns);
}
void MathInset::mathmlize(MathMLStream & os) const
{
writeNormal(os.os_);
NormalStream ns(os.os_);
writeNormal(ns);
}

View File

@ -30,7 +30,6 @@
#include "xarray.h"
#include "math_defs.h"
#include "math_mathmlstream.h"
/** Abstract base class for all math objects.
A math insets is for use of the math editor only, it isn't a
@ -50,44 +49,8 @@ class MathSpaceInset;
class MathMacroTemplate;
class LaTeXFeatures;
class Buffer;
class BufferView;
class UpdatableInset;
class MathOctaveInfo;
struct MathWriteInfo {
///
MathWriteInfo(Buffer const * buffer_, std::ostream & os_, bool fragile_)
: buffer(buffer_), os(os_), fragile(fragile_)
{}
///
explicit MathWriteInfo(std::ostream & os_)
: buffer(0), os(os_), fragile(false)
{}
///
template <class T>
MathWriteInfo & operator<<(T const & t)
{
os << t;
return *this;
}
///
MathWriteInfo & operator<<(MathArray const & ar)
{
ar.write(*this);
return *this;
}
///
Buffer const * buffer;
///
std::ostream & os;
///
bool fragile;
};
class MathInset {
@ -112,8 +75,6 @@ public:
virtual void draw(Painter &, int x, int y) const;
/// write LaTeX and Lyx code
virtual void write(MathWriteInfo & os) const;
/// write normalized content
virtual void writeNormal(std::ostream &) const;
/// reproduce itself
virtual MathInset * clone() const = 0;
///substitutes macro arguments if necessary
@ -254,12 +215,14 @@ public:
///
virtual void handleFont(MathTextCodes) {}
///
virtual void octavize(OctaveStream &) const;
/// write normalized content
virtual void writeNormal(NormalStream &) const;
///
virtual void maplize(MapleStream &) const;
///
virtual void mathmlize(MathMLStream &) const;
///
virtual void octavize(OctaveStream &) const;
};
std::ostream & operator<<(std::ostream &, MathInset const &);

View File

@ -3,8 +3,8 @@
#endif
#include "math_kerninset.h"
#include "math_mathmlstream.h"
#include "support.h"
#include "support/LOstream.h"
MathKernInset::MathKernInset()
@ -31,18 +31,6 @@ void MathKernInset::draw(Painter &, int, int) const
{}
void MathKernInset::write(MathWriteInfo & os) const
{
os << "\\kern" << wid_.asLatexString() << " ";
}
void MathKernInset::writeNormal(std::ostream & os) const
{
os << "[kern " << wid_.asLatexString() << "]";
}
void MathKernInset::metrics(MathMetricsInfo const &) const
{
ascent_ = 0;
@ -54,3 +42,16 @@ void MathKernInset::metrics(MathMetricsInfo const &) const
width_ = static_cast<int>(wid_.value());
//cerr << "handling kern of width " << wid_.value() << "\n";
}
void MathKernInset::write(MathWriteInfo & os) const
{
os << "\\kern" << wid_.asLatexString().c_str() << " ";
}
void MathKernInset::writeNormal(NormalStream & os) const
{
os << "[kern " << wid_.asLatexString().c_str() << "]";
}

View File

@ -27,7 +27,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
private:

View File

@ -3,10 +3,10 @@
#endif
#include "math_lefteqninset.h"
#include "support/LOstream.h"
#include "LColor.h"
#include "Painter.h"
#include "math_cursor.h"
#include "math_mathmlstream.h"
MathLefteqnInset::MathLefteqnInset()
@ -20,6 +20,15 @@ MathInset * MathLefteqnInset::clone() const
}
void MathLefteqnInset::metrics(MathMetricsInfo const & mi) const
{
MathNestInset::metrics(mi);
ascent_ = xcell(0).ascent() + 2;
descent_ = xcell(0).descent() + 2;
width_ = 4;
}
void MathLefteqnInset::draw(Painter & pain, int x, int y) const
{
xcell(0).draw(pain, x + 2, y);
@ -36,19 +45,10 @@ void MathLefteqnInset::write(MathWriteInfo & os) const
}
void MathLefteqnInset::writeNormal(std::ostream & os) const
void MathLefteqnInset::writeNormal(NormalStream & os) const
{
os << "[lefteqn ";
MathWriteInfo wi(os);
MathWriteInfo wi(os.os_);
cell(0).write(wi);
os << "] ";
}
void MathLefteqnInset::metrics(MathMetricsInfo const & mi) const
{
MathNestInset::metrics(mi);
ascent_ = xcell(0).ascent() + 2;
descent_ = xcell(0).descent() + 2;
width_ = 4;
os << "]";
}

View File

@ -21,7 +21,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
};

View File

@ -27,6 +27,7 @@
#include "math_cursor.h"
#include "math_macrotable.h"
#include "math_macrotemplate.h"
#include "math_mathmlstream.h"
#include "Painter.h"
#include "LaTeXFeatures.h"
@ -171,7 +172,7 @@ void MathMacro::write(MathWriteInfo & os) const
}
void MathMacro::writeNormal(std::ostream & os) const
void MathMacro::writeNormal(NormalStream & os) const
{
os << "[macro " << name() << " ";
for (idx_type i = 0; i < nargs(); ++i) {

View File

@ -50,7 +50,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void dump() const;

View File

@ -5,7 +5,8 @@
#include "math_macroarg.h"
#include "math_macro.h"
#include "math_defs.h"
#include "mathed/support.h"
#include "math_mathmlstream.h"
#include "support.h"
#include "debug.h"
@ -57,7 +58,7 @@ void MathMacroArgument::draw(Painter & pain, int x, int y) const
}
void MathMacroArgument::writeNormal(std::ostream & os) const
void MathMacroArgument::writeNormal(NormalStream & os) const
{
os << "[macroarg " << number_ << "] ";
}

View File

@ -24,7 +24,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void substitute(MathMacro const & macro);
///

View File

@ -10,6 +10,7 @@
#include "math_macro.h"
#include "math_macrotemplate.h"
#include "math_parser.h"
#include "math_mathmlstream.h"
#include "debug.h"
#include "support.h" // math_font_available
@ -19,6 +20,7 @@ MathMacroTable::table_type MathMacroTable::macro_table;
void MathMacroTable::dump()
{
/*
lyxerr << "\n------------------------------------------\n";
table_type::const_iterator it;
for (it = macro_table.begin(); it != macro_table.end(); ++it)
@ -26,6 +28,7 @@ void MathMacroTable::dump()
<< " [" << it->second->asMacroTemplate()->nargs() << "] : "
<< it->second->cell(0) << "\n";
lyxerr << "------------------------------------------\n";
*/
}

View File

@ -3,6 +3,7 @@
#endif
#include "math_macrotemplate.h"
#include "math_mathmlstream.h"
#include "Painter.h"
#include "debug.h"
@ -47,15 +48,6 @@ string const & MathMacroTemplate::name() const
}
void MathMacroTemplate::write(MathWriteInfo & os) const
{
os << "\n\\newcommand{\\" << name_ << '}';
if (numargs_ > 0)
os << '[' << numargs_ << ']';
os << '{' << cell(0) << "}\n";
}
void MathMacroTemplate::metrics(MathMetricsInfo const & mi) const
{
xcell(0).metrics(mi);
@ -70,3 +62,12 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y) const
xcell(0).draw(pain, x + 2, y + 1);
pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);
}
void MathMacroTemplate::write(MathWriteInfo & os) const
{
os << "\n\\newcommand{\\" << name_.c_str() << '}';
if (numargs_ > 0)
os << '[' << ('0' + numargs_) << ']';
os << '{' << cell(0) << "}\n";
}

View File

@ -1,9 +1,13 @@
#include "support/LOstream.h"
#include "math_inset.h"
#include "math_mathmlstream.h"
MathMLStream::MathMLStream(std::ostream & os)
: os_(os), tab_(0), line_(0)
{}
MathMLStream & MathMLStream::operator<<(MathInset const * p)
{
p->mathmlize(*this);
@ -32,6 +36,35 @@ MathMLStream & MathMLStream::operator<<(char c)
}
MathMLStream & MathMLStream::operator<<(MTag const & t)
{
++tab_;
cr();
os_ << '<' << t.tag_ << '>';
return *this;
}
MathMLStream & MathMLStream::operator<<(ETag const & t)
{
cr();
if (tab_ > 0)
--tab_;
os_ << "</" << t.tag_ << '>';
return *this;
}
void MathMLStream::cr()
{
os_ << '\n';
for (int i = 0; i < tab_; ++i)
os_ << ' ';
}
//////////////////////////////////////////////////////////////////////
MapleStream & MapleStream::operator<<(MathInset const * p)
@ -63,6 +96,8 @@ MapleStream & MapleStream::operator<<(char c)
//////////////////////////////////////////////////////////////////////
OctaveStream & OctaveStream::operator<<(MathInset const * p)
{
@ -91,3 +126,78 @@ OctaveStream & OctaveStream::operator<<(char c)
return *this;
}
//////////////////////////////////////////////////////////////////////
NormalStream & NormalStream::operator<<(MathInset const * p)
{
p->writeNormal(*this);
return *this;
}
NormalStream & NormalStream::operator<<(MathArray const & ar)
{
ar.writeNormal(*this);
return *this;
}
NormalStream & NormalStream::operator<<(char const * s)
{
os_ << s;
return *this;
}
NormalStream & NormalStream::operator<<(char c)
{
os_ << c;
return *this;
}
//////////////////////////////////////////////////////////////////////
MathWriteInfo::MathWriteInfo
(Buffer const * buffer_, std::ostream & os_, bool fragile_)
: buffer(buffer_), os(os_), fragile(fragile_)
{}
MathWriteInfo::MathWriteInfo(std::ostream & os_)
: buffer(0), os(os_), fragile(false)
{}
MathWriteInfo & MathWriteInfo::operator<<(MathInset const * p)
{
p->write(*this);
return *this;
}
MathWriteInfo & MathWriteInfo::operator<<(MathArray const & ar)
{
ar.write(*this);
return *this;
}
MathWriteInfo & MathWriteInfo::operator<<(char const * s)
{
os << s;
return *this;
}
MathWriteInfo & MathWriteInfo::operator<<(char c)
{
os << c;
return *this;
}

View File

@ -1,14 +1,30 @@
#ifndef MATH_MATH_MLSTREAM
#define MATH_MATH_MLSTREAM
#ifndef MATH_MATHMLSTREAM_H
#define MATH_MATHMLSTREAM_H
#include <iosfwd>
#include "support/LOstream.h"
struct MathArray;
struct MathInset;
struct Buffer;
struct MTag {
///
MTag(char const * const tag) : tag_(tag) {}
///
char const * const tag_;
};
struct ETag {
///
ETag(char const * const tag) : tag_(tag) {}
///
char const * const tag_;
};
struct MathMLStream {
///
explicit MathMLStream(std::ostream & os) : os_(os) {}
///
std::ostream & os_;
explicit MathMLStream(std::ostream & os);
///
MathMLStream & operator<<(MathInset const *);
///
@ -17,6 +33,35 @@ struct MathMLStream {
MathMLStream & operator<<(char const *);
///
MathMLStream & operator<<(char);
///
MathMLStream & operator<<(MTag const &);
///
MathMLStream & operator<<(ETag const &);
///
void cr();
///
std::ostream & os_;
///
int tab_;
///
int line_;
};
struct NormalStream {
///
explicit NormalStream(std::ostream & os) : os_(os) {}
///
std::ostream & os_;
///
NormalStream & operator<<(MathInset const *);
///
NormalStream & operator<<(MathArray const &);
///
NormalStream & operator<<(char const *);
///
NormalStream & operator<<(char);
};
@ -51,4 +96,29 @@ struct OctaveStream {
OctaveStream & operator<<(char);
};
struct MathWriteInfo {
///
MathWriteInfo(Buffer const * buffer_, std::ostream & os_, bool fragile_);
///
explicit MathWriteInfo(std::ostream & os_);
///
MathWriteInfo & operator<<(MathInset const *);
///
MathWriteInfo & operator<<(MathArray const &);
///
MathWriteInfo & operator<<(char const *);
///
MathWriteInfo & operator<<(char);
///
Buffer const * buffer;
///
std::ostream & os;
///
bool fragile;
};
#endif

View File

@ -7,9 +7,9 @@
#include "math_matrixinset.h"
#include "support.h"
#include "debug.h"
#include "support/LOstream.h"
#include "Painter.h"
#include "LaTeXFeatures.h"
#include "math_mathmlstream.h"
namespace {
@ -185,36 +185,6 @@ void MathMatrixInset::draw(Painter & pain, int x, int y) const
}
void MathMatrixInset::write(MathWriteInfo & os) const
{
header_write(os.os);
bool n = numberedType();
for (row_type row = 0; row < nrows(); ++row) {
for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col);
if (n) {
if (!label_[row].empty())
os << "\\label{" << label_[row] << "}";
if (nonum_[row])
os << "\\nonumber ";
}
os << eolString(row);
}
footer_write(os.os);
}
void MathMatrixInset::writeNormal(std::ostream & os) const
{
os << "[formula " << normalName(getType()) << " ";
MathGridInset::writeNormal(os);
os << "] ";
}
void MathMatrixInset::mathmlize(MathMLStream & os) const
{
MathGridInset::mathmlize(os);
@ -673,3 +643,35 @@ void MathMatrixInset::mutate(MathInsetTypes newtype)
<< "' to '" << newtype << "' not implemented\n";
}
}
void MathMatrixInset::write(MathWriteInfo & os) const
{
header_write(os.os);
bool n = numberedType();
for (row_type row = 0; row < nrows(); ++row) {
for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col).c_str();
if (n) {
if (!label_[row].empty())
os << "\\label{" << label_[row].c_str() << "}";
if (nonum_[row])
os << "\\nonumber ";
}
os << eolString(row).c_str();
}
footer_write(os.os);
}
void MathMatrixInset::writeNormal(NormalStream & os) const
{
os << "[formula " << normalName(getType()).c_str() << " ";
MathGridInset::writeNormal(os);
os << "] ";
}

View File

@ -29,7 +29,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -3,10 +3,9 @@
#endif
#include "math_nestinset.h"
#include "math_mathmlstream.h"
#include "debug.h"
using std::max;
using std::min;
MathNestInset::MathNestInset(idx_type nargs)
: MathDimInset(), cells_(nargs)
@ -172,10 +171,10 @@ bool MathNestInset::covers(int x, int y) const
int x1 = xcell(0).xo() + xcell(0).width();
int y1 = xcell(0).yo() + xcell(0).descent();
for (idx_type i = 1; i < nargs(); ++i) {
x0 = min(x0, xcell(i).xo());
y0 = min(y0, xcell(i).yo() - xcell(i).ascent());
x1 = max(x1, xcell(i).xo() + xcell(i).width());
y1 = max(y1, xcell(i).yo() + xcell(i).descent());
x0 = std::min(x0, xcell(i).xo());
y0 = std::min(y0, xcell(i).yo() - xcell(i).ascent());
x1 = std::max(x1, xcell(i).xo() + xcell(i).width());
y1 = std::max(y1, xcell(i).yo() + xcell(i).descent());
}
return x >= x0 && x <= x1 && y >= y0 && y <= y1;
}

View File

@ -1,11 +1,9 @@
#include "math_notinset.h"
#include "math_parser.h"
#include "math_mathmlstream.h"
#include "support.h"
#include "support/LOstream.h"
using std::ostream;
MathNotInset::MathNotInset()
{}
@ -22,7 +20,7 @@ void MathNotInset::write(MathWriteInfo & os) const
}
void MathNotInset::writeNormal(ostream & os) const
void MathNotInset::writeNormal(NormalStream & os) const
{
os << "[not] ";
}

View File

@ -15,7 +15,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -741,12 +741,14 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
else if (t.cat() == catEnd) {
if (flags & FLAG_BRACE_LAST)
return;
lyxerr << "found '}' unexpectedly, array: '" << array << "'\n";
//lyxerr << "found '}' unexpectedly, array: '" << array << "'\n";
lyxerr << "found '}' unexpectedly\n";
add(array, '}', LM_TC_TEX);
}
else if (t.cat() == catAlign) {
lyxerr << "found tab unexpectedly, array: '" << array << "'\n";
//lyxerr << "found tab unexpectedly, array: '" << array << "'\n";
lyxerr << "found tab unexpectedly\n";
add(array, '&', LM_TC_TEX);
}
@ -789,7 +791,8 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
else if (t.cs() == "\\") {
curr_skip_ = getArg('[', ']');
lyxerr << "found newline unexpectedly, array: '" << array << "'\n";
//lyxerr << "found newline unexpectedly, array: '" << array << "'\n";
lyxerr << "found newline unexpectedly\n";
array.push_back(createMathInset("\\"));
}
@ -830,7 +833,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
else if (t.cs() == "right") {
if (!(flags & FLAG_RIGHT)) {
lyxerr << "got so far: '" << array << "'\n";
//lyxerr << "got so far: '" << array << "'\n";
error("Unmatched right delimiter");
}
return;

View File

@ -16,7 +16,7 @@
#endif
#include "math_rootinset.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
#include "Painter.h"
@ -64,7 +64,7 @@ void MathRootInset::write(MathWriteInfo & os) const
}
void MathRootInset::writeNormal(std::ostream & os) const
void MathRootInset::writeNormal(NormalStream & os) const
{
os << "[root ";
cell(1).writeNormal(os);

View File

@ -36,7 +36,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -1,20 +1,12 @@
#include <config.h>
#include "Lsstream.h"
#include "debug.h"
#include "support.h"
#include "support/LOstream.h"
#include "support/LAssert.h"
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_scriptinset.h"
using std::ostream;
using std::ostringstream;
#include "debug.h"
#include "support.h"
#include "math_mathmlstream.h"
#include "support/LAssert.h"
MathScriptInset::MathScriptInset()
@ -227,72 +219,6 @@ void MathScriptInset::draw(MathInset const * nuc, Painter & pain,
}
void MathScriptInset::write(MathWriteInfo & os) const
{
//lyxerr << "unexpected call to MathScriptInset::write()\n";
write(0, os);
}
void MathScriptInset::write(MathInset const * nuc, MathWriteInfo & os) const
{
if (nuc) {
nuc->write(os);
if (nuc->takesLimits()) {
if (limits_ == -1)
os << "\\nolimits ";
if (limits_ == 1)
os << "\\limits ";
}
}
else
os << "{}";
if (hasDown() && down().data_.size())
os << "_{" << down().data_ << '}';
if (hasUp() && up().data_.size())
os << "^{" << up().data_ << '}';
}
void MathScriptInset::writeNormal(ostream & os) const
{
//lyxerr << "unexpected call to MathScriptInset::writeNormal()\n";
writeNormal(0, os);
}
void MathScriptInset::writeNormal(MathInset const * nuc, ostream & os) const
{
bool d = hasDown() && down().data_.size();
bool u = hasUp() && up().data_.size();
ostringstream osb;
if (nuc)
nuc->writeNormal(osb);
else
osb << "[par]";
string base = osb.str();
if (u && d) {
os << "[sup [sub " << osb.str() << " ";
down().data_.writeNormal(os);
os << "] ";
up().data_.writeNormal(os);
os << ']';
} else if (u) {
os << "[sup " << osb.str() << " ";
up().data_.writeNormal(os);
os << ']';
} else if (d) {
os << "[sub " << osb.str() << " ";
down().data_.writeNormal(os);
os << ']';
}
}
bool MathScriptInset::hasLimits(MathInset const * nuc) const
{
return limits_ == 1 || (limits_ == 0 && nuc && nuc->isScriptable());
@ -346,18 +272,65 @@ bool MathScriptInset::idxLeft(MathInset::idx_type &,
}
void MathScriptInset::maplize(MathInset const * nuc, MapleStream & os) const
{
if (nuc)
os << nuc;
if (hasDown() && down().data_.size())
os << '[' << down().data_ << ']';
if (hasUp() && up().data_.size())
os << "^(" << up().data_ << ')';
void MathScriptInset::write(MathWriteInfo & os) const
{
//lyxerr << "unexpected call to MathScriptInset::write()\n";
write(0, os);
}
void MathScriptInset::octavize(MathInset const * nuc, OctaveStream & os) const
void MathScriptInset::write(MathInset const * nuc, MathWriteInfo & os) const
{
if (nuc) {
os << nuc;
if (nuc->takesLimits()) {
if (limits_ == -1)
os << "\\nolimits ";
if (limits_ == 1)
os << "\\limits ";
}
}
else
os << "{}";
if (hasDown() && down().data_.size())
os << "_{" << down().data_ << '}';
if (hasUp() && up().data_.size())
os << "^{" << up().data_ << '}';
}
void MathScriptInset::writeNormal(NormalStream & os) const
{
//lyxerr << "unexpected call to MathScriptInset::writeNormal()\n";
writeNormal(0, os);
}
void MathScriptInset::writeNormal(MathInset const * nuc, NormalStream & os) const
{
bool d = hasDown() && down().data_.size();
bool u = hasUp() && up().data_.size();
if (u)
os << "[sup ";
if (d)
os << "[sub ";
if (nuc)
os << nuc << ' ';
else
os << "[par]";
if (d)
os << down().data_ << ']';
if (u)
os << up().data_ << ']';
}
void MathScriptInset::maplize(MathInset const * nuc, MapleStream & os) const
{
if (nuc)
os << nuc;
@ -373,20 +346,35 @@ void MathScriptInset::mathmlize(MathInset const * nuc, MathMLStream & os) const
bool d = hasDown() && down().data_.size();
bool u = hasUp() && up().data_.size();
if (u)
os << "<sup>";
if (d)
os << "<sub>";
if (u && d)
os << MTag("msubsup");
else if (u)
os << MTag("msup");
else if (d)
os << MTag("msub");
if (nuc)
os << nuc;
else
os << "<mrow/>";
if (d)
os << down().data_ << "</sub>";
if (u)
os << up().data_ << "</sup>";
if (u && d)
os << down().data_ << up().data_ << ETag("msubsup");
else if (u)
os << up().data_ << ETag("msup");
else if (d)
os << down().data_ << ETag("msub");
}
void MathScriptInset::octavize(MathInset const * nuc, OctaveStream & os) const
{
if (nuc)
os << nuc;
if (hasDown() && down().data_.size())
os << '[' << down().data_ << ']';
if (hasUp() && up().data_.size())
os << "^(" << up().data_ << ')';
}

View File

@ -23,26 +23,22 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream & os) const;
void writeNormal(NormalStream & os) const;
///
void metrics(MathMetricsInfo const & st) const;
///
void draw(Painter &, int x, int y) const;
///
void write(MathInset const *, MathWriteInfo & os) const;
void metrics(MathInset const * nuc, MathMetricsInfo const & st) const;
///
void writeNormal(MathInset const *, std::ostream & os) const;
void draw(MathInset const * nuc, Painter &, int x, int y) const;
///
void metrics(MathInset const * nucleus, MathMetricsInfo const & st) const;
int ascent(MathInset const * nuc) const;
///
void draw(MathInset const * nucleus, Painter &, int x, int y) const;
int descent(MathInset const * nuc) const;
///
int ascent(MathInset const * nucleus) const;
///
int descent(MathInset const * nucleus) const;
///
int width(MathInset const * nucleus) const;
int width(MathInset const * nuc) const;
///
bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
@ -59,7 +55,7 @@ public:
///
int limits() const { return limits_; }
///
bool hasLimits(MathInset const * nucleus) const;
bool hasLimits(MathInset const * nuc) const;
/// true if we have an "inner" position
MathXArray const & up() const;
/// returns subscript
@ -81,6 +77,10 @@ public:
///
void ensure(bool up);
///
void write(MathInset const * nuc, MathWriteInfo & os) const;
///
void writeNormal(MathInset const * nuc, NormalStream & os) const;
///
void octavize(MathInset const * nuc, OctaveStream & os) const;
///

View File

@ -4,7 +4,7 @@
#include "math_sizeinset.h"
#include "math_parser.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
MathSizeInset::MathSizeInset(latexkeys const * l)
@ -37,13 +37,11 @@ void MathSizeInset::metrics(MathMetricsInfo const & mi) const
void MathSizeInset::write(MathWriteInfo & os) const
{
os << "{\\" << key_->name << ' ' << cell(0) << '}';
os << "{\\" << key_->name.c_str() << ' ' << cell(0) << '}';
}
void MathSizeInset::writeNormal(std::ostream & os) const
void MathSizeInset::writeNormal(NormalStream & os) const
{
os << "[" << key_->name << " ";
cell(0).writeNormal(os);
os << "]";
os << "[" << key_->name.c_str() << ' ' << cell(0) << ']';
}

View File

@ -28,7 +28,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
private:
///

View File

@ -6,7 +6,7 @@
#include "support.h"
#include "LColor.h"
#include "Painter.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
@ -28,7 +28,7 @@ void MathSpaceInset::write(MathWriteInfo & os) const
}
void MathSpaceInset::writeNormal(std::ostream & os) const
void MathSpaceInset::writeNormal(NormalStream & os) const
{
os << "[space " << space_ << "] ";
}

View File

@ -21,7 +21,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -3,7 +3,7 @@
#endif
#include "math_specialcharinset.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
#include "support.h"
@ -54,7 +54,7 @@ void MathSpecialCharInset::write(MathWriteInfo & os) const
}
void MathSpecialCharInset::writeNormal(std::ostream & os) const
void MathSpecialCharInset::writeNormal(NormalStream & os) const
{
os << "\\" << char_;
}

View File

@ -26,7 +26,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
int ascent() const;
///

View File

@ -3,7 +3,7 @@
#endif
#include "math_splitinset.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
MathSplitInset::MathSplitInset(int n)

View File

@ -3,9 +3,9 @@
#endif
#include "math_sqrtinset.h"
#include "math_mathmlstream.h"
#include "LColor.h"
#include "Painter.h"
#include "support/LOstream.h"
MathSqrtInset::MathSqrtInset()
@ -49,7 +49,7 @@ void MathSqrtInset::write(MathWriteInfo & os) const
}
void MathSqrtInset::writeNormal(std::ostream & os) const
void MathSqrtInset::writeNormal(NormalStream & os) const
{
os << "[sqrt ";
cell(0).writeNormal(os);

View File

@ -22,7 +22,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -3,8 +3,8 @@
#endif
#include "math_stackrelinset.h"
#include "mathed/support.h"
#include "support/LOstream.h"
#include "math_mathmlstream.h"
#include "support.h"
MathStackrelInset::MathStackrelInset()
@ -43,7 +43,7 @@ void MathStackrelInset::write(MathWriteInfo & os) const
}
void MathStackrelInset::writeNormal(std::ostream & os) const
void MathStackrelInset::writeNormal(NormalStream & os) const
{
os << "[stackrel ";
cell(0).writeNormal(os);

View File

@ -20,7 +20,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -5,9 +5,9 @@
#include <cctype>
#include "math_stringinset.h"
#include "math_mathmlstream.h"
#include "LColor.h"
#include "Painter.h"
#include "support/LOstream.h"
#include "support.h"
#include "math_parser.h"
#include "debug.h"
@ -58,15 +58,15 @@ void MathStringInset::draw(Painter & pain, int x, int y) const
void MathStringInset::write(MathWriteInfo & os) const
{
if (math_font_name(code_))
os << '\\' << math_font_name(code_) << '{' << str_ << '}';
os << '\\' << math_font_name(code_) << '{' << str_.c_str() << '}';
else
os << str_;
os << str_.c_str();
}
void MathStringInset::writeNormal(std::ostream & os) const
void MathStringInset::writeNormal(NormalStream & os) const
{
os << "[string " << str_ << " " << "mathalpha" << "]";
os << "[string " << str_.c_str() << ' ' << "mathalpha" << "]";
}

View File

@ -25,7 +25,7 @@ public:
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
int ascent() const;
///

View File

@ -1,12 +1,10 @@
#include "math_symbolinset.h"
#include "math_parser.h"
#include "math_mathmlstream.h"
#include "debug.h"
#include "support.h"
#include "support/LOstream.h"
using std::ostream;
MathSymbolInset::MathSymbolInset(const latexkeys * l)
: sym_(l), h_(0)
{}
@ -20,13 +18,13 @@ MathInset * MathSymbolInset::clone() const
void MathSymbolInset::write(MathWriteInfo & os) const
{
os << '\\' << sym_->name << ' ';
os << '\\' << sym_->name.c_str() << ' ';
}
void MathSymbolInset::writeNormal(ostream & os) const
void MathSymbolInset::writeNormal(NormalStream & os) const
{
os << "[symbol " << sym_->name << "]";
os << "[symbol " << sym_->name.c_str() << "]";
}

View File

@ -14,11 +14,13 @@ public:
///
explicit MathSymbolInset(latexkeys const *);
///
explicit MathSymbolInset(char const *);
///
MathInset * clone() const;
///
void write(MathWriteInfo & os) const;
///
void writeNormal(std::ostream &) const;
void writeNormal(NormalStream &) const;
///
void metrics(MathMetricsInfo const & st) const;
///

View File

@ -2,7 +2,7 @@
#include <map>
#include "mathed/support.h"
#include "support.h"
#include "lyxfont.h"
#include "FontLoader.h"
#include "font.h"

View File

@ -7,7 +7,7 @@
#include "xarray.h"
#include "math_inset.h"
#include "math_scriptinset.h"
#include "mathed/support.h"
#include "support.h"
#include "math_defs.h"
#include "Painter.h"
#include "debug.h"
@ -116,10 +116,3 @@ MathArray::size_type MathXArray::x2pos(int targetx) const
--it;
return it - begin();
}
std::ostream & operator<<(std::ostream & os, MathXArray const & ar)
{
os << ar.data_;
return os;
}