Purely mechanical: move fragile into LatexRunParams.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7016 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-05-22 22:44:30 +00:00
parent 4564bd55c4
commit e1940902fe
85 changed files with 259 additions and 172 deletions

View File

@ -1,3 +1,23 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* latexrunparams.h: add fragile and use_babel variables.
* bufferparams.[Ch] (writeLaTeX): return use_babel.
* buffer.C (makeLaTeXFile): store this returned value in
runparams.use_babel, thus passing it to the inset::latex methods.
* paragraph.C (simpleTeXOnePar): no need to pass 'moving_arg' to
simpleTeXSpecialChars as it is now stored in runparams.fragile.
* paragraph_funcs.[Ch] (TeXOnePar, latexParagraphs): TeXOnePar no
longer has a fragile arg, as it is stored in runparams.fragile.
* paragraph_pimpl.[Ch] (simpleTeXSpecialChars): no longer has a
moving_arg parameter as the data is stored in runparams.fragile.
* tabular.[Ch] (TeXLongtableHeaderFooter, TeXRow): no longer have
a fragile parameter as the data is stored in runparams.fragile.
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph.C (Paragraph): initialize next_par_ and prev_par_

View File

@ -1030,7 +1030,7 @@ void Buffer::makeLaTeXFile(ostream & os,
}
// Write the preamble
params.writeLaTeX(os, features, texrow);
runparams.use_babel = params.writeLaTeX(os, features, texrow);
if (only_preamble)
return;

View File

@ -459,7 +459,7 @@ void BufferParams::writeFile(ostream & os) const
}
void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
TexRow & texrow) const
{
os << "\\documentclass";
@ -846,6 +846,7 @@ void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
}
os << lyxpreamble;
return use_babel;
}
void BufferParams::setPaperStuff()

View File

@ -116,8 +116,11 @@ public:
///
void writeFile(std::ostream &) const;
///
void writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
/** \returns true if the babel package is used (interogates
the BufferParams and a LyXRC variable).
This returned value can then be passed to the insets...
*/
bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
///
void setPaperStuff();

View File

@ -1,3 +1,8 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C (dumpPreamble): no longer pass a fragile arg to
the inset::latex method.
2003-05-22 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C (dumpPreamble): the 'nice' param passed to

View File

@ -567,6 +567,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
runparams.nice = true;
runparams.fragile = true;
tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, false, true);
// FIXME! This is a HACK! The proper fix is to control the 'true'
@ -588,7 +589,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
for (; it != end; ++it)
if (it->lyxCode() == Inset::MATHMACRO_CODE)
it->latex(&buffer_, os, runparams, true, true);
it->latex(&buffer_, os, runparams, true);
// All equation lables appear as "(#)" + preview.sty's rendering of
// the label name

View File

@ -1,3 +1,11 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* inset*.[Ch] (latex): no longer has a fragile arg. Data is now passed
through the LatexRunParams arg.
* insetquotes.C (latex): accesses use_babel through the LatexRunParams
arg rather than through a global var.
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetspecialchar.C (dimension): use a string.

View File

@ -189,14 +189,11 @@ public:
///
virtual void read(Buffer const *, LyXLex & lex) = 0;
/** returns the number of rows (\n's) of generated tex code.
fragile == true means, that the inset should take care about
fragile commands by adding a \protect before.
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
virtual int latex(Buffer const *, std::ostream &,
LatexRunParams const &,
bool fragile,
bool free_spc) const = 0;
///
virtual int ascii(Buffer const *,

View File

@ -85,7 +85,7 @@ string const InsetBibtex::getScreenLabel(Buffer const *) const
int InsetBibtex::latex(Buffer const * buffer, ostream & os,
LatexRunParams const & runparams,
bool /*fragile*/, bool/*fs*/) const
bool/*fs*/) const
{
// changing the sequence of the commands
// 1. \bibliographystyle{style}

View File

@ -40,7 +40,7 @@ public:
Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool freespace) const;
bool freespace) const;
///
void fillWithBibKeys(Buffer const *,
std::vector<std::pair<string,string> > &) const;

View File

@ -105,8 +105,9 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
}
int InsetCaption::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool free_spc) const
int InsetCaption::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool free_spc) const
{
// This is a bit too simplistic to take advantage of
// caption options we must add more later. (Lgb)
@ -114,7 +115,7 @@ int InsetCaption::latex(Buffer const * buf, ostream & os, LatexRunParams const &
// \caption{...}, later we will make it take advantage
// of the one of the caption packages. (Lgb)
ostringstream ost;
int const l = InsetText::latex(buf, ost, runparams, fragile, free_spc);
int const l = InsetText::latex(buf, ost, runparams, free_spc);
os << "\\caption{" << ost.str() << "}\n";
return l + 1;
}

View File

@ -37,8 +37,9 @@ public:
virtual void draw(BufferView * bv, LyXFont const & f,
int baseline, float & x) const;
///
virtual int latex(Buffer const * buf, std::ostream & os, LatexRunParams const &,
bool fragile, bool free_spc) const;
virtual int latex(Buffer const * buf, std::ostream & os,
LatexRunParams const &,
bool free_spc) const;
///
int ascii(Buffer const * buf, std::ostream & os, int linelen) const;
///

View File

@ -353,8 +353,9 @@ int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) const
// the \cite command is valid. Eg, the user has natbib enabled, inputs some
// citations and then changes his mind, turning natbib support off. The output
// should revert to \cite[]{}
int InsetCitation::latex(Buffer const * buffer, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
int InsetCitation::latex(Buffer const * buffer, ostream & os,
LatexRunParams const &,
bool/*fs*/) const
{
os << "\\";
if (buffer->params.use_natbib)

View File

@ -37,7 +37,8 @@ public:
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool, bool) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool) const;
///
dispatch_result localDispatch(FuncRequest const & cmd);
///

View File

@ -273,9 +273,9 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
int InsetCollapsable::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fragile, bool free_spc) const
bool free_spc) const
{
return inset.latex(buf, os, runparams, fragile, free_spc);
return inset.latex(buf, os, runparams, free_spc);
}

View File

@ -80,7 +80,7 @@ public:
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int) const;
///

View File

@ -40,7 +40,7 @@ void InsetCommand::setParams(InsetCommandParams const & p)
int InsetCommand::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
bool/*fs*/) const
{
os << getCommand();
return 0;

View File

@ -41,8 +41,9 @@ public:
/// Can remove one InsetBibKey is modified
void scanCommand(string const & c) { p_.scanCommand(c); };
///
virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
virtual int latex(Buffer const *, std::ostream &,
LatexRunParams const &,
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -67,12 +67,12 @@ string const InsetEnvironment::editMessage() const
int InsetEnvironment::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fragile, bool) const
bool) const
{
os << layout_->latexheader;
TexRow texrow;
latexParagraphs(buf, paragraphs, os, texrow, runparams, fragile,
layout_->latexparagraph);
latexParagraphs(buf, paragraphs, os, texrow, runparams,
layout_->latexparagraph);
os << layout_->latexfooter;
return texrow.rows();
}

View File

@ -31,7 +31,7 @@ public:
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
string const editMessage() const;
///

View File

@ -39,7 +39,7 @@ public:
void read(Buffer const *, LyXLex &) {}
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const { return 0; }
bool) const { return 0; }
///
int ascii(Buffer const *, std::ostream &, int) const { return 0; }
///

View File

@ -324,7 +324,7 @@ void InsetERT::lfunMouseMotion(FuncRequest const & cmd)
int InsetERT::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*free_spc*/) const
bool /*free_spc*/) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();

View File

@ -64,7 +64,7 @@ public:
///
EDITABLE editable() const;
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool fragile,
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool free_spc) const;
///
int ascii(Buffer const *,

View File

@ -166,8 +166,9 @@ int InsetExternal::write(string const & format,
}
int InsetExternal::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
bool, bool) const
int InsetExternal::latex(Buffer const * buf, ostream & os,
LatexRunParams const &,
bool) const
{
return write("LaTeX", buf, os);
}

View File

@ -53,8 +53,9 @@ public:
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
virtual int latex(Buffer const *, std::ostream &,
LatexRunParams const &,
bool free_spc) const;
/// write ASCII output to the ostream
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
/// write LinuxDoc output to the ostream

View File

@ -271,8 +271,9 @@ string const InsetFloat::editMessage() const
}
int InsetFloat::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
int InsetFloat::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fp) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
@ -303,7 +304,7 @@ int InsetFloat::latex(Buffer const * buf, ostream & os, LatexRunParams const & r
}
os << '\n';
int const i = inset.latex(buf, os, runparams, fragile, fp);
int const i = inset.latex(buf, os, runparams, fp);
// The \n is used to force \end{<floatname>} to appear in a new line.
// In this case, we do not case if the current output line is empty.

View File

@ -58,7 +58,7 @@ public:
Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///

View File

@ -107,8 +107,9 @@ dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
}
int InsetFloatList::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
bool, bool) const
int InsetFloatList::latex(Buffer const * buf, ostream & os,
LatexRunParams const &,
bool) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()];

View File

@ -45,7 +45,7 @@ public:
void read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const;
bool) const;
///
int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///

View File

@ -15,6 +15,7 @@
#include "gettext.h"
#include "lyxfont.h"
#include "BufferView.h"
#include "latexrunparams.h"
#include "lyxtext.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
@ -57,17 +58,19 @@ string const InsetFoot::editMessage() const
}
int InsetFoot::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
int InsetFoot::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams_in,
bool fp) const
{
LatexRunParams runparams = runparams_in;
if (buf && parOwner()) {
LyXLayout_ptr const & layout = parOwner()->layout();
fragile |= layout->intitle;
runparams.fragile |= layout->intitle;
}
os << "%\n\\footnote{";
int const i = inset.latex(buf, os, runparams, fragile, fp);
int const i = inset.latex(buf, os, runparams, fp);
os << "%\n}";
return i + 2;

View File

@ -32,7 +32,7 @@ public:
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///

View File

@ -674,7 +674,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf,
int InsetGraphics::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool /*fragile*/, bool/*fs*/) const
bool/*fs*/) const
{
// If there is no file specified or not existing,
// just output a message about it in the latex output.

View File

@ -50,7 +50,7 @@ public:
fragile commands by adding a #\protect# before.
*/
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -22,7 +22,7 @@ InsetHFill::InsetHFill()
int InsetHFill::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*fs*/) const
bool /*fs*/) const
{
os << getCommand();
return 0;

View File

@ -29,7 +29,7 @@ public:
Inset::Code lyxCode() const { return Inset::HFILL_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -287,7 +287,7 @@ bool InsetInclude::loadIfNeeded() const
int InsetInclude::latex(Buffer const * buffer, ostream & os,
LatexRunParams const & runparams,
bool /*fragile*/, bool /*fs*/) const
bool /*fs*/) const
{
string incfile(params_.cparams.getContents());
@ -575,7 +575,7 @@ string const InsetInclude::PreviewImpl::latexString() const
ostringstream os;
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
parent().latex(view()->buffer(), os, runparams, false, false);
parent().latex(view()->buffer(), os, runparams, false);
return STRCONV(os.str());
}

View File

@ -92,7 +92,7 @@ public:
void read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -83,7 +83,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
int InsetLabel::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*fs*/) const
bool /*fs*/) const
{
os << escape(getCommand());
return 0;

View File

@ -37,7 +37,7 @@ public:
std::vector<string> const getLabelList() const;
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -621,8 +621,9 @@ void InsetLatexAccent::read(Buffer const *, LyXLex & lex)
}
int InsetLatexAccent::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool/*fs*/) const
int InsetLatexAccent::latex(Buffer const *, ostream & os,
LatexRunParams const &,
bool/*fs*/) const
{
os << contents;
return 0;

View File

@ -50,7 +50,7 @@ public:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -62,12 +62,12 @@ string const InsetList::editMessage() const
}
int InsetList::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetList::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams, bool fp) const
{
os << "\\footnote{%\n";
int i = inset.latex(buf, os, fragile, fp);
int i = inset.latex(buf, os, runparams, fp);
os << "}%\n";
return i + 2;

View File

@ -28,7 +28,7 @@ public:
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
string const editMessage() const;
};

View File

@ -53,12 +53,13 @@ string const InsetMarginal::editMessage() const
}
int InsetMarginal::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
int InsetMarginal::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fp) const
{
os << "%\n\\marginpar{";
int const i = inset.latex(buf, os, runparams, fragile, fp);
int const i = inset.latex(buf, os, runparams, fp);
os << "%\n}";
return i + 2;

View File

@ -31,7 +31,7 @@ public:
Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
string const editMessage() const;
};

View File

@ -250,8 +250,9 @@ string const InsetMinipage::editMessage() const
}
int InsetMinipage::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
int InsetMinipage::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fp) const
{
string s_pos;
switch (params_.pos) {
@ -268,7 +269,7 @@ int InsetMinipage::latex(Buffer const * buf, ostream & os, LatexRunParams const
os << "\\begin{minipage}[" << s_pos << "]{"
<< params_.width.asLatexString() << "}%\n";
int i = inset.latex(buf, os, runparams, fragile, fp);
int i = inset.latex(buf, os, runparams, fp);
os << "\\end{minipage}%\n";
return i + 2;

View File

@ -73,7 +73,7 @@ public:
Inset::Code lyxCode() const { return Inset::MINIPAGE_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
string const editMessage() const;
///

View File

@ -47,7 +47,7 @@ void InsetNewline::dimension(BufferView *, LyXFont const & font,
int InsetNewline::latex(Buffer const *, ostream &, LatexRunParams const &,
bool, bool) const
bool) const
{
lyxerr << "Eek, calling InsetNewline::latex !" << endl;
return 0;

View File

@ -31,8 +31,9 @@ public:
virtual void draw(BufferView *, LyXFont const &,
int baseline, float & x) const;
virtual int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
virtual int latex(Buffer const *, std::ostream &,
LatexRunParams const &,
bool free_spc) const;
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;

View File

@ -34,7 +34,7 @@ public:
void write(Buffer const *, std::ostream &) const;
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const
bool) const
{ return 0; }
///
int linuxdoc(Buffer const *, std::ostream &) const

View File

@ -67,17 +67,17 @@ void InsetOptArg::write(Buffer const * buf, ostream & os) const
int InsetOptArg::latex(Buffer const *, ostream &, LatexRunParams const &,
bool, bool) const
bool) const
{
return 0;
}
int InsetOptArg::latexOptional(Buffer const * buf, ostream & os,
LatexRunParams const & runparams, bool, bool fp) const
LatexRunParams const & runparams, bool fp) const
{
os << '[';
int const i = inset.latex(buf, os, runparams, false, fp);
int const i = inset.latex(buf, os, runparams, fp);
os << ']';
return i + 2;
}

View File

@ -39,10 +39,11 @@ public:
/// Standard LaTeX output -- short-circuited
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
/// Outputting the optional parameter of a LaTeX command
int latexOptional(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
int latexOptional(Buffer const *, std::ostream &,
LatexRunParams const &,
bool fp) const;
/// Write out tothe .lyx file
void write(Buffer const * buf, std::ostream & os) const;
};

View File

@ -54,10 +54,11 @@ dispatch_result InsetParent::localDispatch(FuncRequest const & cmd)
// LaTeX must just ignore this command
int InsetParent::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool free_spc) const
int InsetParent::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool free_spc) const
{
os << "%%#{lyx}";
InsetCommand::latex(buf, os, runparams, fragile, free_spc);
InsetCommand::latex(buf, os, runparams, free_spc);
return 0;
}

View File

@ -40,7 +40,7 @@ public:
Inset::Code lyxCode() const { return Inset::PARENT_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
void setParent(string const & fn) { setContents(fn); }
};

View File

@ -12,18 +12,19 @@
#include "insetquotes.h"
#include "BufferView.h"
#include "LaTeXFeatures.h"
#include "frontends/Painter.h"
#include "buffer.h"
#include "BufferView.h"
#include "debug.h"
#include "dimension.h"
#include "frontends/font_metrics.h"
#include "language.h"
#include "LaTeXFeatures.h"
#include "latexrunparams.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "paragraph.h"
#include "lyxlex.h"
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
@ -237,10 +238,9 @@ void InsetQuotes::read(Buffer const *, LyXLex & lex)
}
extern bool use_babel;
int InsetQuotes::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /* free_spc */) const
int InsetQuotes::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool /* free_spc */) const
{
// How do we get the local language here??
lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this);
@ -276,7 +276,7 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
#ifdef DO_USE_DEFAULT_LANGUAGE
} else if (doclang == "default") {
#else
} else if (!use_babel) {
} else if (!runparams.use_babel) {
#endif
qstr = latex_quote_ot1[times_][quoteind];
} else {
@ -323,6 +323,8 @@ int InsetQuotes::docbook(Buffer const *, ostream & os, bool) const
}
extern bool use_babel;
void InsetQuotes::validate(LaTeXFeatures & features) const
{
char type = quote_char[quote_index[side_][language_]];

View File

@ -84,7 +84,7 @@ public:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -72,7 +72,7 @@ string const InsetRef::getScreenLabel(Buffer const *) const
int InsetRef::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool /*fs*/) const
bool /*fs*/) const
{
if (getOptions().empty())
os << escape(getCommand());

View File

@ -55,7 +55,7 @@ public:
bool display() const { return false; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -157,7 +157,7 @@ void InsetSpace::read(Buffer const *, LyXLex & lex)
int InsetSpace::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool free_space) const
bool free_space) const
{
switch (kind_) {
case NORMAL:

View File

@ -62,7 +62,7 @@ public:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -160,8 +160,9 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
}
int InsetSpecialChar::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool /*fragile*/, bool free_space) const
int InsetSpecialChar::latex(Buffer const *, ostream & os,
LatexRunParams const &,
bool free_space) const
{
switch (kind_) {
case HYPHENATION:

View File

@ -55,7 +55,7 @@ public:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -1192,10 +1192,11 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
}
int InsetTabular::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
int InsetTabular::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fp) const
{
return tabular->latex(buf, os, runparams, fragile, fp);
return tabular->latex(buf, os, runparams, fp);
}

View File

@ -126,7 +126,7 @@ public:
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool, bool) const;
bool) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -1447,11 +1447,12 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd)
}
int InsetText::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool) const
int InsetText::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool) const
{
TexRow texrow;
latexParagraphs(buf, paragraphs, os, texrow, runparams, fragile);
latexParagraphs(buf, paragraphs, os, texrow, runparams);
return texrow.rows();
}

View File

@ -113,7 +113,7 @@ public:
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -71,12 +71,12 @@ string const InsetTheorem::editMessage() const
}
int InsetTheorem::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
int InsetTheorem::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams, bool fp) const
{
os << "\\begin{theorem}%\n";
int i = inset.latex(buf, os, fragile, fp);
int i = inset.latex(buf, os, runparams, fp);
os << "\\end{theorem}%\n";
return i + 2;

View File

@ -32,7 +32,7 @@ public:
bool display() const { return true; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
string const editMessage() const;
};

View File

@ -14,6 +14,7 @@
#include "funcrequest.h"
#include "BufferView.h"
#include "LaTeXFeatures.h"
#include "latexrunparams.h"
#include "frontends/LyXView.h"
#include "debug.h"
#include "frontends/Dialogs.h"
@ -70,12 +71,13 @@ string const InsetUrl::getScreenLabel(Buffer const *) const
}
int InsetUrl::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool fragile, bool /*free_spc*/) const
int InsetUrl::latex(Buffer const *, ostream & os,
LatexRunParams const & runparams,
bool /*free_spc*/) const
{
if (!getOptions().empty())
os << getOptions() + ' ';
if (fragile)
if (runparams.fragile)
os << "\\protect";
os << "\\url{" << getContents() << '}';
return 0;

View File

@ -44,7 +44,7 @@ public:
bool display() const { return false; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -192,8 +192,9 @@ string const InsetWrap::editMessage() const
}
int InsetWrap::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
bool fragile, bool fp) const
int InsetWrap::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams,
bool fp) const
{
os << "\\begin{floating" << params_.type << '}';
if (!params_.placement.empty()) {
@ -201,7 +202,7 @@ int InsetWrap::latex(Buffer const * buf, ostream & os, LatexRunParams const & ru
}
os << '{' << params_.width.asLatexString() << "}%\n";
int const i = inset.latex(buf, os, runparams, fragile, fp);
int const i = inset.latex(buf, os, runparams, fp);
os << "\\end{floating" << params_.type << "}%\n";
return i + 2;

View File

@ -56,7 +56,7 @@ public:
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool fp) const;
bool fp) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///

View File

@ -18,18 +18,29 @@ struct LatexRunParams {
PDFLATEX
};
LatexRunParams() : flavor(LATEX), nice(false) {}
LatexRunParams() : flavor(LATEX), nice(false),
fragile(false), use_babel(false) {}
/** The latex that we export depends occasionally on what is to
compile the file.
*/
FLAVOR flavor;
/** Are we to write a 'nice' LaTeX file or not.
This esentially seems to mean whether InsetInclude, InsetGraphics
and InsetExternal should add the absolute path to any external
files or not.
*/
bool nice;
/** fragile == true means that the inset should take care about
fragile commands by preceding the latex with \protect.
*/
bool fragile;
/** This var is set by the return value from BufferParams::writeLaTeX
*/
bool use_babel;
};
#endif // LatexRunParams_H
#endif // LATEXRUNPARAMS_H

View File

@ -1,3 +1,10 @@
2003-05-22 Angus Leeming <leeming@lyx.org>
* formula.[Ch] (latex):
* formulamacro.[Ch] (latex):
no longer has a fragile arg. Data is now passed through the
LatexRunParams arg.
2003-05-22 Angus Leeming <leeming@lyx.org>
* formula.[Ch] (latex):

View File

@ -32,6 +32,7 @@
#include "BufferView.h"
#include "gettext.h"
#include "debug.h"
#include "latexrunparams.h"
#include "lyxrc.h"
#include "funcrequest.h"
#include "Lsstream.h"
@ -127,10 +128,11 @@ void InsetFormula::write(Buffer const *, ostream & os) const
}
int InsetFormula::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool fragile, bool) const
int InsetFormula::latex(Buffer const *, ostream & os,
LatexRunParams const & runparams,
bool) const
{
WriteStream wi(os, fragile, true);
WriteStream wi(os, runparams.fragile, true);
par_->write(wi);
return wi.line();
}

View File

@ -45,7 +45,7 @@ public:
void read(Buffer const *, LyXLex & lex);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///

View File

@ -26,6 +26,7 @@
#include "math_mathmlstream.h"
#include "BufferView.h"
#include "gettext.h"
#include "latexrunparams.h"
#include "frontends/Painter.h"
#include "frontends/font_metrics.h"
#include "support/lyxlib.h"
@ -79,10 +80,11 @@ void InsetFormulaMacro::write(Buffer const *, ostream & os) const
}
int InsetFormulaMacro::latex(Buffer const *, ostream & os, LatexRunParams const &,
bool fragile, bool /*free_spacing*/) const
int InsetFormulaMacro::latex(Buffer const *, ostream & os,
LatexRunParams const & runparams,
bool /*free_spacing*/) const
{
WriteStream wi(os, fragile, true);
WriteStream wi(os, runparams.fragile, true);
par()->write(wi);
return 2;
}

View File

@ -45,7 +45,7 @@ public:
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
int latex(Buffer const *, std::ostream & os, LatexRunParams const &,
bool fragile, bool free_spc) const;
bool free_spc) const;
///
int linuxdoc(Buffer const *, std::ostream & os) const;
///

View File

@ -12,19 +12,22 @@
#include "paragraph.h"
#include "paragraph_pimpl.h"
#include "lyxrc.h"
#include "layout.h"
#include "language.h"
#include "buffer.h"
#include "bufferparams.h"
#include "debug.h"
#include "texrow.h"
#include "BufferView.h"
#include "encoding.h"
#include "ParameterStruct.h"
#include "gettext.h"
#include "changes.h"
#include "encoding.h"
#include "debug.h"
#include "gettext.h"
#include "language.h"
#include "latexrunparams.h"
#include "layout.h"
#include "lyxrc.h"
#include "paragraph_funcs.h"
#include "ParameterStruct.h"
#include "texrow.h"
#include "Lsstream.h"
#include "insets/insetbibitem.h"
@ -1058,8 +1061,10 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
column += Changes::latexMarkChange(os, running_change, change);
running_change = change;
LatexRunParams rp = runparams;
rp.fragile = moving_arg;
pimpl_->simpleTeXSpecialChars(buf, bparams,
os, texrow, runparams, moving_arg,
os, texrow, runparams,
font, running_font,
basefont, outerfont, open_font,
running_change,

View File

@ -283,7 +283,6 @@ TeXOnePar(Buffer const * buf,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
string const & everypar = string());
@ -554,7 +553,7 @@ TeXOnePar(Buffer const * buf,
InsetOptArg * it = optArgInset(*pit);
if (it)
it->latexOptional(buf, os, runparams,
false, false);
false);
}
else
os << style->latexparam();
@ -697,8 +696,7 @@ void latexParagraphs(Buffer const * buf,
ostream & os,
TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
string const & everypar)
string const & everypar)
{
bool was_title = false;
bool already_title = false;
@ -746,7 +744,7 @@ void latexParagraphs(Buffer const * buf,
if (layout->is_environment) {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
runparams, moving_arg, everypar);
runparams, everypar);
} else if (layout->isEnvironment() ||
!par->params().leftIndent().zero())
{
@ -754,11 +752,11 @@ void latexParagraphs(Buffer const * buf,
texrow, runparams);
} else {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
runparams, moving_arg, everypar);
runparams, everypar);
}
} else {
par = TeXOnePar(buf, paragraphs, par, os, texrow,
runparams, moving_arg, everypar);
runparams, everypar);
}
}
// It might be that we only have a title in this document

View File

@ -67,7 +67,6 @@ void latexParagraphs(Buffer const * buf,
std::ostream & ofs,
TexRow & texrow,
LatexRunParams const &,
bool moving_arg,
string const & everypar = string());
/// read a paragraph from a .lyx file. Returns number of unrecognised tokens

View File

@ -11,14 +11,16 @@
#include <config.h>
#include "paragraph_pimpl.h"
#include "LaTeXFeatures.h"
#include "texrow.h"
#include "language.h"
#include "bufferparams.h"
#include "encoding.h"
#include "lyxrc.h"
#include "debug.h"
#include "encoding.h"
#include "language.h"
#include "LaTeXFeatures.h"
#include "latexrunparams.h"
#include "lyxrc.h"
#include "paragraph_funcs.h"
#include "texrow.h"
#include "support/LAssert.h"
@ -484,7 +486,6 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
ostream & os,
TexRow & texrow,
LatexRunParams const & runparams,
bool moving_arg,
LyXFont & font,
LyXFont & running_font,
LyXFont & basefont,
@ -535,7 +536,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
if (font.family() == LyXFont::TYPEWRITER_FAMILY)
os << '~';
if (moving_arg)
if (runparams.fragile)
os << "\\protect ";
os << "\\\\\n";
@ -580,7 +581,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
running_font = basefont;
}
int tmp = inset->latex(buf, os, runparams, moving_arg,
int tmp = inset->latex(buf, os, runparams,
style.free_spacing);
if (close)

View File

@ -153,7 +153,7 @@ struct Paragraph::Pimpl {
///
void simpleTeXSpecialChars(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
LatexRunParams const &, bool moving_arg,
LatexRunParams const &,
LyXFont & font, LyXFont & running_font,
LyXFont & basefont,
LyXFont const & outerfont,

View File

@ -1873,7 +1873,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
LatexRunParams const & runparams,
bool fragile, bool fp) const
bool fp) const
{
if (!is_long_tabular)
return 0;
@ -1887,7 +1887,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endhead) {
ret += TeXRow(os, i, buf, runparams, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endhead.bottomDL) {
@ -1909,7 +1909,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endfirsthead) {
ret += TeXRow(os, i, buf, runparams, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endfirsthead.bottomDL) {
@ -1927,7 +1927,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endfoot) {
ret += TeXRow(os, i, buf, runparams, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endfoot.bottomDL) {
@ -1949,7 +1949,7 @@ int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
}
for (int i = 0; i < rows_; ++i) {
if (row_info[i].endlastfoot) {
ret += TeXRow(os, i, buf, runparams, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fp);
}
}
if (endlastfoot.bottomDL) {
@ -1973,7 +1973,7 @@ bool LyXTabular::isValidRow(int const row) const
int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
LatexRunParams const & runparams, bool fragile, bool fp) const
LatexRunParams const & runparams, bool fp) const
{
int ret = 0;
int cell = GetCellNumber(i, 0);
@ -1990,7 +1990,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
if (rtl)
os << "\\R{";
ret += inset->latex(buf, os, runparams, fragile, fp);
ret += inset->latex(buf, os, runparams, fp);
if (rtl)
os << '}';
@ -2009,7 +2009,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
int LyXTabular::latex(Buffer const * buf, ostream & os,
LatexRunParams const & runparams, bool fragile, bool fp) const
LatexRunParams const & runparams, bool fp) const
{
int ret = 0;
@ -2083,7 +2083,7 @@ int LyXTabular::latex(Buffer const * buf, ostream & os,
os << "}\n";
++ret;
ret += TeXLongtableHeaderFooter(os, buf, runparams, fragile, fp);
ret += TeXLongtableHeaderFooter(os, buf, runparams, fp);
//+---------------------------------------------------------------------
//+ the single row and columns (cells) +
@ -2091,7 +2091,7 @@ int LyXTabular::latex(Buffer const * buf, ostream & os,
for (int i = 0; i < rows_; ++i) {
if (isValidRow(i)) {
ret += TeXRow(os, i, buf, runparams, fragile, fp);
ret += TeXRow(os, i, buf, runparams, fp);
if (is_long_tabular && row_info[i].newpage) {
os << "\\newpage\n";
++ret;

View File

@ -291,7 +291,8 @@ public:
///
void Read(Buffer const *, LyXLex &);
///
int latex(Buffer const *, std::ostream &, LatexRunParams const &, bool, bool) const;
int latex(Buffer const *, std::ostream &, LatexRunParams const &,
bool) const;
///
int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
///
@ -560,12 +561,12 @@ private:
int TeXCellPostamble(std::ostream &, int cell) const;
///
int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf,
LatexRunParams const &, bool fragile, bool fp) const;
LatexRunParams const &, bool fp) const;
///
bool isValidRow(int const row) const;
///
int TeXRow(std::ostream &, int const row, Buffer const * buf,
LatexRunParams const &, bool fragile, bool fp) const;
LatexRunParams const &, bool fp) const;
///
// helper function for ASCII returns number of newlines
///