#include cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21459 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-05 23:46:17 +00:00
parent 7bf4f48a4a
commit 9daf07588f
28 changed files with 126 additions and 78 deletions

View File

@ -17,6 +17,7 @@
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
#include "support/docstream.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/textutils.h" #include "support/textutils.h"

View File

@ -10,12 +10,13 @@
#include <config.h> #include <config.h>
#include "LaTeXFeatures.h"
#include "InsetMathAMSArray.h" #include "InsetMathAMSArray.h"
#include "LaTeXFeatures.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "FuncStatus.h" #include "FuncStatus.h"

View File

@ -10,11 +10,13 @@
#include <config.h> #include <config.h>
#include "LaTeXFeatures.h"
#include "InsetMathArray.h" #include "InsetMathArray.h"
#include "LaTeXFeatures.h"
#include "MathData.h" #include "MathData.h"
#include "MathParser.h" #include "MathParser.h"
#include "MathStream.h" #include "MathStream.h"
#include "MetricsInfo.h"
#include "support/lstrings.h" #include "support/lstrings.h"

View File

@ -11,9 +11,10 @@
#include <config.h> #include <config.h>
#include "InsetMathBig.h" #include "InsetMathBig.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathStream.h" #include "MetricsInfo.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"

View File

@ -11,10 +11,12 @@
#include <config.h> #include <config.h>
#include "InsetMathBox.h" #include "InsetMathBox.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathStream.h" #include "MetricsInfo.h"
#include "support/std_ostream.h"
#include <ostream>
namespace lyx { namespace lyx {

View File

@ -11,13 +11,16 @@
#include <config.h> #include <config.h>
#include "InsetMathBoxed.h" #include "InsetMathBoxed.h"
#include "LaTeXFeatures.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "LaTeXFeatures.h" #include "MetricsInfo.h"
#include "support/std_ostream.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include <ostream>
namespace lyx { namespace lyx {

View File

@ -11,14 +11,17 @@
#include <config.h> #include <config.h>
#include "InsetMathBrace.h" #include "InsetMathBrace.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include "support/std_ostream.h" #include <ostream>
namespace lyx { namespace lyx {

View File

@ -11,18 +11,21 @@
#include <config.h> #include <config.h>
#include "InsetMathCases.h" #include "InsetMathCases.h"
#include "Cursor.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "FuncStatus.h" #include "MetricsInfo.h"
#include "LaTeXFeatures.h"
#include "support/std_ostream.h"
#include "Cursor.h"
#include "FuncRequest.h"
#include "gettext.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include <ostream>
namespace lyx { namespace lyx {

View File

@ -12,8 +12,10 @@
#include <config.h> #include <config.h>
#include "InsetMathChar.h" #include "InsetMathChar.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MathStream.h" #include "MathStream.h"
#include "MetricsInfo.h"
#include "debug.h" #include "debug.h"
#include "Dimension.h" #include "Dimension.h"
@ -28,21 +30,18 @@ namespace lyx {
extern bool has_math_fonts; extern bool has_math_fonts;
namespace {
bool isBinaryOp(char_type c) static bool isBinaryOp(char_type c)
{ {
return support::contains("+-<>=/*", static_cast<char>(c)); return support::contains("+-<>=/*", static_cast<char>(c));
} }
bool slanted(char_type c) static bool slanted(char_type c)
{ {
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
} }
}
InsetMathChar::InsetMathChar(char_type c) InsetMathChar::InsetMathChar(char_type c)
: char_(c), kerning_(0) : char_(c), kerning_(0)

View File

@ -11,13 +11,15 @@
#include <config.h> #include <config.h>
#include "Color.h" #include "Color.h"
#include "InsetMathColor.h" #include "InsetMathColor.h"
#include "LaTeXFeatures.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "LaTeXFeatures.h" #include "MetricsInfo.h"
#include "support/std_ostream.h" #include <ostream>
namespace lyx { namespace lyx {

View File

@ -12,15 +12,17 @@
#include <config.h> #include <config.h>
#include "InsetMathDecoration.h" #include "InsetMathDecoration.h"
#include "MathData.h" #include "MathData.h"
#include "MathParser.h" #include "MathParser.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MathStream.h" #include "MathStream.h"
#include "MetricsInfo.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "debug.h" #include "debug.h"
#include "support/std_ostream.h" #include <ostream>
namespace lyx { namespace lyx {

View File

@ -12,9 +12,11 @@
#include <config.h> #include <config.h>
#include "InsetMathDelim.h" #include "InsetMathDelim.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"

View File

@ -12,9 +12,11 @@
#include <config.h> #include <config.h>
#include "InsetMathDots.h" #include "InsetMathDots.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MathParser.h" #include "MathParser.h"
#include "MetricsInfo.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"

View File

@ -11,10 +11,13 @@
#include <config.h> #include <config.h>
#include "InsetMathExFunc.h" #include "InsetMathExFunc.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "support/docstream.h"
namespace lyx { namespace lyx {
@ -124,7 +127,9 @@ void InsetMathExFunc::mathematica(MathematicaStream & os) const
void InsetMathExFunc::mathmlize(MathStream & os) const void InsetMathExFunc::mathmlize(MathStream & os) const
{ {
os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str()); ++os.tab(); os.cr(); os.os() << '<' << name_ << '>';
os << cell(0);
os.cr(); --os.tab(); os.os() << "</" << name_ << '>';
} }

View File

@ -11,12 +11,15 @@
#include <config.h> #include <config.h>
#include "InsetMathFBox.h" #include "InsetMathFBox.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MetricsInfo.h"
#include "support/std_ostream.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include <ostream>
namespace lyx { namespace lyx {

View File

@ -11,11 +11,14 @@
#include <config.h> #include <config.h>
#include "InsetMathFont.h" #include "InsetMathFont.h"
#include "LaTeXFeatures.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathParser.h" #include "MathParser.h"
#include "LaTeXFeatures.h" #include "MetricsInfo.h"
#include "support/std_ostream.h"
#include <ostream>
namespace lyx { namespace lyx {

View File

@ -11,11 +11,13 @@
#include <config.h> #include <config.h>
#include "InsetMathFontOld.h" #include "InsetMathFontOld.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathParser.h" #include "MathParser.h"
#include "MathStream.h" #include "MetricsInfo.h"
#include "support/std_ostream.h"
#include <ostream>
namespace lyx { namespace lyx {

View File

@ -18,6 +18,7 @@
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "TextPainter.h" #include "TextPainter.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"

View File

@ -11,9 +11,12 @@
#include <config.h> #include <config.h>
#include "InsetMathFrameBox.h" #include "InsetMathFrameBox.h"
#include "MathData.h" #include "MathData.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"

View File

@ -11,9 +11,11 @@
#include <config.h> #include <config.h>
#include "InsetMathGrid.h" #include "InsetMathGrid.h"
#include "MathData.h" #include "MathData.h"
#include "MathParser.h" #include "MathParser.h"
#include "MathStream.h" #include "MathStream.h"
#include "MetricsInfo.h"
#include "BufferView.h" #include "BufferView.h"
#include "CutAndPaste.h" #include "CutAndPaste.h"
@ -27,6 +29,7 @@
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/docstream.h"
#include <sstream> #include <sstream>

View File

@ -1468,28 +1468,29 @@ int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
docstring bname = name; docstring bname = name;
if (!label(0).empty()) if (!label(0).empty())
bname += " id='" + sgml::cleanID(buf, runparams, label(0)) + "'"; bname += " id='" + sgml::cleanID(buf, runparams, label(0)) + "'";
ms << MTag(bname);
++ms.tab(); ms.cr(); ms.os() << '<' << bname << '>';
odocstringstream ls; odocstringstream ls;
if (runparams.flavor == OutputParams::XML) { if (runparams.flavor == OutputParams::XML) {
ms << MTag(from_ascii("alt role='tex' ")); ms << MTag("alt role='tex' ");
// Workaround for db2latex: db2latex always includes equations with // Workaround for db2latex: db2latex always includes equations with
// \ensuremath{} or \begin{display}\end{display} // \ensuremath{} or \begin{display}\end{display}
// so we strip LyX' math environment // so we strip LyX' math environment
WriteStream wi(ls, false, false); WriteStream wi(ls, false, false);
InsetMathGrid::write(wi); InsetMathGrid::write(wi);
ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;")); ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;"));
ms << ETag(from_ascii("alt")); ms << ETag("alt");
ms << MTag(from_ascii("math")); ms << MTag("math");
ms << ETag(from_ascii("alt")); ms << ETag("alt");
ms << MTag(from_ascii("math")); ms << MTag("math");
InsetMathGrid::mathmlize(ms); InsetMathGrid::mathmlize(ms);
ms << ETag(from_ascii("math")); ms << ETag("math");
} else { } else {
ms << MTag(from_ascii("alt role='tex'")); ms << MTag("alt role='tex'");
res = latex(buf, ls, runparams); res = latex(buf, ls, runparams);
ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;")); ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;"));
ms << ETag(from_ascii("alt")); ms << ETag("alt");
} }
ms << from_ascii("<graphic fileref=\"eqn/"); ms << from_ascii("<graphic fileref=\"eqn/");
@ -1503,7 +1504,8 @@ int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
else else
ms << from_ascii("\">"); ms << from_ascii("\">");
ms << ETag(name); ms.cr(); --ms.tab(); ms.os() << "</" << name << '>';
return ms.line() + res; return ms.line() + res;
} }

View File

@ -49,6 +49,7 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/textutils.h" #include "support/textutils.h"
#include "support/docstream.h"
#include "frontends/Clipboard.h" #include "frontends/Clipboard.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"

View File

@ -12,6 +12,7 @@
#include <config.h> #include <config.h>
#include "MathData.h" #include "MathData.h"
#include "InsetMathBrace.h" #include "InsetMathBrace.h"
#include "InsetMathFont.h" #include "InsetMathFont.h"
#include "InsetMathScript.h" #include "InsetMathScript.h"
@ -19,6 +20,7 @@
#include "MathMacro.h" #include "MathMacro.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h" #include "MathSupport.h"
#include "MetricsInfo.h"
#include "ReplaceData.h" #include "ReplaceData.h"
#include "Buffer.h" #include "Buffer.h"
@ -27,6 +29,8 @@
#include "Cursor.h" #include "Cursor.h"
#include "debug.h" #include "debug.h"
#include "support/docstream.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"

View File

@ -15,10 +15,11 @@
#include <config.h> #include <config.h>
#include "MathExtern.h" #include "MathExtern.h"
#include "debug.h"
#include "InsetMathArray.h" #include "InsetMathArray.h"
#include "InsetMathChar.h" #include "InsetMathChar.h"
#include "InsetMathDelim.h" #include "InsetMathDelim.h"
#include "MathData.h"
#include "InsetMathDiff.h" #include "InsetMathDiff.h"
#include "InsetMathExFunc.h" #include "InsetMathExFunc.h"
#include "InsetMathExInt.h" #include "InsetMathExInt.h"
@ -26,13 +27,15 @@
#include "InsetMathFrac.h" #include "InsetMathFrac.h"
#include "InsetMathLim.h" #include "InsetMathLim.h"
#include "InsetMathMatrix.h" #include "InsetMathMatrix.h"
#include "MathStream.h"
#include "InsetMathNumber.h" #include "InsetMathNumber.h"
#include "InsetMathScript.h" #include "InsetMathScript.h"
#include "InsetMathString.h" #include "InsetMathString.h"
#include "InsetMathSymbol.h" #include "InsetMathSymbol.h"
#include "MathData.h"
#include "MathParser.h" #include "MathParser.h"
#include "debug.h" #include "MathStream.h"
#include "support/docstream.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/lyxlib.h" #include "support/lyxlib.h"

View File

@ -1,5 +1,5 @@
/** /**
* \file math_macrotemplate.C * \file MathMacroTemplate.cpp
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -10,13 +10,14 @@
#include <config.h> #include <config.h>
#include "MathMacroTemplate.h"
#include "DocIterator.h" #include "DocIterator.h"
#include "InsetMathBrace.h" #include "InsetMathBrace.h"
#include "InsetMathChar.h" #include "InsetMathChar.h"
#include "InsetMathSqrt.h" #include "InsetMathSqrt.h"
#include "MathMacro.h" #include "MathMacro.h"
#include "MathMacroArgument.h" #include "MathMacroArgument.h"
#include "MathMacroTemplate.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathParser.h" #include "MathParser.h"
#include "MathSupport.h" #include "MathSupport.h"
@ -37,14 +38,11 @@
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include "support/convert.h" #include "support/convert.h"
#include "support/docstream.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "debug.h" #include "debug.h"
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <sstream> #include <sstream>
@ -100,8 +98,8 @@ MathMacroTemplate::MathMacroTemplate()
} }
MathMacroTemplate::MathMacroTemplate(docstring const & name, int numargs, int optionals, MathMacroTemplate::MathMacroTemplate(docstring const & name, int numargs,
docstring const & type, int optionals, docstring const & type,
std::vector<MathData> const & optionalValues, std::vector<MathData> const & optionalValues,
MathData const & def, MathData const & display) MathData const & def, MathData const & display)
: InsetMathNest(optionals + 3), numargs_(numargs), : InsetMathNest(optionals + 3), numargs_(numargs),
@ -586,7 +584,7 @@ void MathMacroTemplate::doDispatch(Cursor & cur, FuncRequest & cmd)
} }
bool MathMacroTemplate::getStatus(Cursor & cur, FuncRequest const & cmd, bool MathMacroTemplate::getStatus(Cursor & /*cur*/, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {
bool ret = true; bool ret = true;

View File

@ -10,14 +10,17 @@
#include <config.h> #include <config.h>
#include "MathStream.h"
#include "InsetMath.h" #include "InsetMath.h"
#include "MathData.h" #include "MathData.h"
#include "MathExtern.h" #include "MathExtern.h"
#include "MathStream.h"
#include "support/textutils.h" #include "support/textutils.h"
#include <algorithm> #include <algorithm>
#include <ostream>
namespace lyx { namespace lyx {
@ -225,7 +228,7 @@ MathStream & operator<<(MathStream & ms, MTag const & t)
{ {
++ms.tab(); ++ms.tab();
ms.cr(); ms.cr();
ms.os() << '<' << t.tag_ << '>'; ms.os() << '<' << from_ascii(t.tag_) << '>';
return ms; return ms;
} }
@ -235,7 +238,7 @@ MathStream & operator<<(MathStream & ms, ETag const & t)
ms.cr(); ms.cr();
if (ms.tab() > 0) if (ms.tab() > 0)
--ms.tab(); --ms.tab();
ms.os() << "</" << t.tag_ << '>'; ms.os() << "</" << from_ascii(t.tag_) << '>';
return ms; return ms;
} }

View File

@ -12,14 +12,10 @@
#ifndef MATH_MATHMLSTREAM_H #ifndef MATH_MATHMLSTREAM_H
#define MATH_MATHMLSTREAM_H #define MATH_MATHMLSTREAM_H
#include "support/strfwd.h"
// Please keep all four streams in one file until the interface has // FIXME: Move to individual insets
// settled.
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "support/docstream.h"
#include "support/docstring.h"
namespace lyx { namespace lyx {
@ -95,21 +91,17 @@ WriteStream & operator<<(WriteStream &, unsigned int);
class MTag { class MTag {
public: public:
/// ///
MTag(docstring const tag) : tag_(tag) {} MTag(char const * const tag) : tag_(tag) {}
/// ///
MTag(char const * const tag) : tag_(from_ascii(tag)) {} char const * const tag_;
///
docstring const tag_;
}; };
class ETag { class ETag {
public: public:
/// ///
ETag(docstring const tag) : tag_(tag) {} ETag(char const * const tag) : tag_(tag) {}
/// ///
ETag(char const * const tag) : tag_(from_ascii(tag)) {} char const * const tag_;
///
docstring const tag_;
}; };
class MathStream { class MathStream {

View File

@ -11,14 +11,17 @@
#include <config.h> #include <config.h>
#include "MathSupport.h"
#include "InsetMath.h" #include "InsetMath.h"
#include "MathData.h" #include "MathData.h"
#include "MathParser.h" #include "MathParser.h"
#include "MathStream.h" #include "MathStream.h"
#include "MathSupport.h"
#include "debug.h" #include "debug.h"
#include "support/docstream.h"
#include "frontends/FontLoader.h" #include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
@ -33,7 +36,6 @@ using frontend::Painter;
using std::max; using std::max;
using std::endl; using std::endl;
using std::vector;
/// ///