+2003-11-05 José Matos <jamatos@lyx.org>
+
+ * output_docbook.[Ch]:
+ * output_latex.[Ch]:
+ * output_linuxdoc.[Ch]:
+ * output_plaintext.[Ch]: New files for output formats.
+ * output.[Ch]: New file for helper functions.
+
+ * buffer.[Ch]:
+ * paragraph_funcs.[Ch]: output functions moved to new files.
+
+ * outputparams.h: rename of latexrunparams.h
+
+ * LaTeX.[Ch]:
+ * buffer.[Ch]:
+ * bufferlist.[Ch]:
+ * converter.[Ch]:
+ * exporter.C:
+ * paragraph.[Ch]:
+ * paragraph_funcs.[Ch]:
+ * paragraph_pimpl.[Ch]:
+ * tabular.[Ch]: rename ascii to plaintext
+ and LatexRunParams to OutputParams.
+
2003-11-05 Alfredo Braunstein <abraunst@libero.it>
* iterators.[Ch] (text): require bv argument
* CLASS LaTeX
*/
-LaTeX::LaTeX(string const & latex, LatexRunParams const & rp,
+LaTeX::LaTeX(string const & latex, OutputParams const & rp,
string const & f, string const & p)
: cmd(latex), file(f), path(p), runparams(rp)
{
#ifndef LATEX_H
#define LATEX_H
-#include "latexrunparams.h"
+#include "outputparams.h"
#include <boost/utility.hpp>
#include <boost/signals/signal1.hpp>
cmd = the latex command, file = name of the (temporary) latex file,
path = name of the files original path.
*/
- LaTeX(std::string const & cmd, LatexRunParams const &,
+ LaTeX(std::string const & cmd, OutputParams const &,
std::string const & file, std::string const & path);
/// runs LaTeX several times
std::string output_file;
///
- LatexRunParams runparams;
+ OutputParams runparams;
};
#endif
LaTeX.h \
LaTeXFeatures.C \
LaTeXFeatures.h \
- latexrunparams.h \
LyXAction.C \
LyXAction.h \
MenuBackend.C \
messages.h \
metricsinfo.C \
metricsinfo.h \
+ output.C \
+ output.h \
+ outputparams.h \
+ output_docbook.C \
+ output_docbook.h \
+ output_latex.C \
+ output_latex.h \
+ output_linuxdoc.C \
+ output_linuxdoc.h \
+ output_plaintext.C \
+ output_plaintext.h \
paper.h \
paragraph.C \
paragraph.h \
#include "lyxrc.h"
#include "lyxvc.h"
#include "messages.h"
+#include "output.h"
+#include "output_docbook.h"
+#include "output_latex.h"
+#include "output_linuxdoc.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
const int LYX_FORMAT = 225;
-bool openFileWrite(ofstream & ofs, string const & fname)
-{
- ofs.open(fname.c_str());
- if (!ofs) {
- string const file = MakeDisplayPath(fname, 50);
- string text = bformat(_("Could not open the specified "
- "document\n%1$s."), file);
- Alert::error(_("Could not open file"), text);
- return false;
- }
- return true;
-}
-
} // namespace anon
}
-void Buffer::writeFileAscii(string const & fname, LatexRunParams const & runparams)
-{
- ofstream ofs;
- if (!::openFileWrite(ofs, fname))
- return;
- writeFileAscii(ofs, runparams);
-}
-
-
-void Buffer::writeFileAscii(ostream & os, LatexRunParams const & runparams)
-{
- ParagraphList::iterator beg = paragraphs().begin();
- ParagraphList::iterator end = paragraphs().end();
- ParagraphList::iterator it = beg;
- for (; it != end; ++it) {
- asciiParagraph(*this, *it, os, runparams, it == beg);
- }
- os << "\n";
-}
-
-
void Buffer::makeLaTeXFile(string const & fname,
string const & original_path,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
bool output_preamble, bool output_body)
{
lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl;
ofstream ofs;
- if (!::openFileWrite(ofs, fname))
+ if (!openFileWrite(ofs, fname))
return;
makeLaTeXFile(ofs, original_path,
void Buffer::makeLaTeXFile(ostream & os,
string const & original_path,
- LatexRunParams const & runparams_in,
+ OutputParams const & runparams_in,
bool output_preamble, bool output_body)
{
- LatexRunParams runparams = runparams_in;
+ OutputParams runparams = runparams_in;
niceFile() = runparams.nice; // this will be used by Insetincludes.
// validate the buffer.
void Buffer::makeLinuxDocFile(string const & fname,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
bool body_only )
{
ofstream ofs;
- if (!::openFileWrite(ofs, fname))
+ if (!openFileWrite(ofs, fname))
return;
niceFile() = runparams.nice; // this will be used by included files.
void Buffer::makeDocBookFile(string const & fname,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
bool only_body)
{
ofstream ofs;
- if (!::openFileWrite(ofs, fname))
+ if (!openFileWrite(ofs, fname))
return;
niceFile() = runparams.nice; // this will be used by Insetincludes.
message(_("Running chktex..."));
// Generate the LaTeX file if neccessary
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
runparams.nice = false;
makeLaTeXFile(name, org_path, runparams);
class LyXRC;
class LyXVC;
class LaTeXFeatures;
-class LatexRunParams;
+class OutputParams;
class Language;
class Messages;
class ParIterator;
bool writeFile(std::string const &) const;
///
- void writeFileAscii(std::string const &, LatexRunParams const &);
+ void writeFileAscii(std::string const &, OutputParams const &);
///
- void writeFileAscii(std::ostream &, LatexRunParams const &);
+ void writeFileAscii(std::ostream &, OutputParams const &);
/// Just a wrapper for the method below, first creating the ofstream.
void makeLaTeXFile(std::string const & filename,
std::string const & original_path,
- LatexRunParams const &,
+ OutputParams const &,
bool output_preamble = true,
bool output_body = true);
///
void makeLaTeXFile(std::ostream & os,
std::string const & original_path,
- LatexRunParams const &,
+ OutputParams const &,
bool output_preamble = true,
bool output_body = true);
///
void makeLinuxDocFile(std::string const & filename,
- LatexRunParams const & runparams_in,
+ OutputParams const & runparams_in,
bool only_body = false);
///
void makeDocBookFile(std::string const & filename,
- LatexRunParams const & runparams_in,
+ OutputParams const & runparams_in,
bool only_body = false);
/// returns the main language for the buffer (document)
Language const * getLanguage() const;
#include "lastfiles.h"
#include "lyx_cb.h"
#include "lyx_main.h"
+#include "output_latex.h"
#include "paragraph.h"
#include "frontends/Alert.h"
void BufferList::updateIncludedTeXfiles(string const & mastertmpdir,
- LatexRunParams const & runparams)
+ OutputParams const & runparams)
{
BufferStorage::iterator it = bstore.begin();
BufferStorage::iterator end = bstore.end();
#include <vector>
class Buffer;
-class LatexRunParams;
+class OutputParams;
/**
* The class holds all all open buffers, and handles construction
std::vector<std::string> const getFileNames() const;
/// FIXME
- void updateIncludedTeXfiles(std::string const &, LatexRunParams const &);
+ void updateIncludedTeXfiles(std::string const &, OutputParams const &);
/// emergency save for all buffers
void emergencyWriteAll();
#include "gettext.h"
#include "language.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "lyxtextclasslist.h"
+#include "outputparams.h"
#include "tex-strings.h"
#include "Spacing.h"
#include "texrow.h"
if (edgepath.empty()) {
return false;
}
- LatexRunParams runparams;
+ OutputParams runparams;
runparams.flavor = usePdflatex(edgepath) ?
- LatexRunParams::PDFLATEX : LatexRunParams::LATEX;
+ OutputParams::PDFLATEX : OutputParams::LATEX;
string path = OnlyPath(from_file);
Path p(path);
bool Converters::scanLog(Buffer const & buffer, string const & /*command*/,
string const & filename)
{
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
LaTeX latex("", runparams, filename, "");
TeXErrors terr;
int result = latex.scanLogFile(terr);
bool Converters::runLaTeX(Buffer const & buffer, string const & command,
- LatexRunParams const & runparams)
+ OutputParams const & runparams)
{
buffer.busy(true);
buffer.message(_("Running LaTeX..."));
class Buffer;
class Format;
class Formats;
-class LatexRunParams;
+class OutputParams;
///
std::string const & filename);
///
bool runLaTeX(Buffer const & buffer, std::string const & command,
- LatexRunParams const &);
+ OutputParams const &);
///
ConverterList converterlist_;
///
#include "converter.h"
#include "format.h"
#include "gettext.h"
-#include "latexrunparams.h"
#include "lyxrc.h"
-
+#include "output_plaintext.h"
+#include "outputparams.h"
#include "frontends/Alert.h"
#include "support/filetools.h"
bool put_in_tempdir, string & result_file)
{
string backend_format;
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
runparams.linelen = lyxrc.ascii_linelen;
vector<string> backends = Backends(*buffer);
if (find(backends.begin(), backends.end(), format) == backends.end()) {
converters.getPath(*it, format);
if (!p.empty()) {
if (converters.usePdflatex(p))
- runparams.flavor = LatexRunParams::PDFLATEX;
+ runparams.flavor = OutputParams::PDFLATEX;
backend_format = *it;
break;
}
// Ascii backend
if (backend_format == "text")
- buffer->writeFileAscii(filename, runparams);
+ writeFileAscii(*buffer, filename, runparams);
// Linuxdoc backend
else if (buffer->isLinuxDoc()) {
runparams.nice = !put_in_tempdir;
+2003-11-05 José Matos <jamatos@lyx.org>
+
+ * PreviewLoader.C (dumpPreamble): rename ascii to plaintext
+ and LatexRunParams to OutputParams.
+
2003-10-22 Angus Leeming <leeming@lyx.org>
* PreviewImage.C (statusChanged): always pass on the signal, not just
#include "converter.h"
#include "debug.h"
#include "format.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxrc.h"
+#include "outputparams.h"
#include "frontends/lyx_gui.h" // hexname
// Why on earth is Buffer::makeLaTeXFile a non-const method?
Buffer & tmp = const_cast<Buffer &>(buffer_);
// Dump the preamble only.
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
runparams.nice = true;
runparams.moving_arg = true;
runparams.free_spacing = true;
// FIXME! This is a HACK! The proper fix is to control the 'true'
// passed to WriteStream below:
// int InsetFormula::latex(Buffer const &, ostream & os,
- // LatexRunParams const & runparams) const
+ // OutputParams const & runparams) const
// {
// WriteStream wi(os, runparams.moving_arg, true);
// par_->write(wi);
+2003-11-05 José Matos <jamatos@lyx.org>
+
+ * inset.h:
+ * insetbibtex.[Ch]:
+ * insetbox.[Ch]:
+ * insetbranch.[Ch]:
+ * insetcaption.[Ch]:
+ * insetcite.[Ch]:
+ * insetcollapsable.[Ch]:
+ * insetcommand.[Ch]:
+ * insetenv.[Ch]:
+ * insetert.[Ch]:
+ * insetexternal.[Ch]:
+ * insetfloat.[Ch]:
+ * insetfloatlist.[Ch]:
+ * insetfoot.[Ch]:
+ * insetgraphics.[Ch]:
+ * insethfill.[Ch]:
+ * insetinclude.[Ch]:
+ * insetindex.[Ch]:
+ * insetlabel.[Ch]:
+ * insetlatexaccent.[Ch]:
+ * insetline.[Ch]:
+ * insetlist.[Ch]:
+ * insetmarginal.[Ch]:
+ * insetminipage.[Ch]:
+ * insetnewline.[Ch]:
+ * insetnote.[Ch]:
+ * insetoptarg.[Ch]:
+ * insetpagebreak.[Ch]:
+ * insetquotes.[Ch]:
+ * insetref.[Ch]:
+ * insetspace.[Ch]:
+ * insetspecialchar.[Ch]:
+ * insettabular.[Ch]:
+ * insettext.[Ch]:
+ * insettheorem.[Ch]:
+ * insettoc.[Ch]:
+ * inseturl.[Ch]:
+ * insetwrap.[Ch]: rename ascii to plaintext
+ and LatexRunParams to OutputParams.
+
2003-11-05 Alfredo Braunstein <abraunst@libero.it>
* insetcollapsable.C (edit): add open() all
class Buffer;
class LColor_color;
class FuncRequest;
-class LatexRunParams;
+class OutputParams;
class LyXCursor;
class LyXFont;
class LyXLex;
virtual void read(Buffer const &, LyXLex & lex) = 0;
/// returns the number of rows (\n's) of generated tex code.
virtual int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const = 0;
+ OutputParams const &) const = 0;
///
- virtual int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const = 0;
+ virtual int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const = 0;
///
virtual int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const = 0;
+ OutputParams const &) const = 0;
///
virtual int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const = 0;
+ OutputParams const &) const = 0;
/// returns LyX code associated with the inset. Used for TOC, ...)
virtual InsetOld::Code lyxCode() const { return NO_CODE; }
#include "debug.h"
#include "funcrequest.h"
#include "gettext.h"
-#include "latexrunparams.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "support/filetools.h"
#include "support/lstrings.h"
int InsetBibtex::latex(Buffer const & buffer, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
// changing the sequence of the commands
// 1. \bibliographystyle{style}
bool display() const { return true; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
void fillWithBibKeys(Buffer const & buffer,
std::vector<std::pair<std::string,std::string> > & keys) const;
int InsetBox::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
BoxType btype = boxtranslator().find(params_.type);
int InsetBox::linuxdoc(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return inset.linuxdoc(buf, os, runparams);
}
int InsetBox::docbook(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return inset.docbook(buf, os, runparams);
}
-int InsetBox::ascii(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+int InsetBox::plaintext(Buffer const & buf, std::ostream & os,
+ OutputParams const & runparams) const
{
int i = 0;
string const pt = params_.type;
break;
}
- i = inset.ascii(buf, os, runparams);
+ i = inset.plaintext(buf, os, runparams);
switch (btype) {
case Frameless:
bool showInsetDialog(BufferView * bv) const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const & runparams) const;
///
void validate(LaTeXFeatures &) const;
///
int InsetBranch::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string const branch_sel = buf.params().branchlist().allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos)
int InsetBranch::linuxdoc(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string const branch_sel = buf.params().branchlist().allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos)
int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string const branch_sel = buf.params().branchlist().allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos)
}
-int InsetBranch::ascii(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+int InsetBranch::plaintext(Buffer const & buf, std::ostream & os,
+ OutputParams const & runparams) const
{
string const branch_sel = buf.params().branchlist().allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos) {
- return inset.ascii(buf, os, runparams);
+ return inset.plaintext(buf, os, runparams);
}
return 0;
}
bool showInsetDialog(BufferView *) const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const & runparams) const;
///
void validate(LaTeXFeatures &) const;
///
int InsetCaption::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
// This is a bit too simplistic to take advantage of
// caption options we must add more later. (Lgb)
}
-int InsetCaption::ascii(Buffer const & /*buf*/,ostream & /*os*/,
- LatexRunParams const & /*runparams*/) const
+int InsetCaption::plaintext(Buffer const & /*buf*/,ostream & /*os*/,
+ OutputParams const & /*runparams*/) const
{
// FIX: Implement me!
return 0;
int InsetCaption::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret;
os << "<title>";
virtual void draw(PainterInfo & pi, int x, int y) const;
///
virtual int latex(Buffer const & buf, std::ostream & os,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const;
+ int plaintext(Buffer const & buf, std::ostream & os,
+ OutputParams const & runparams) const;
///
int docbook(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
};
}
-int InsetCitation::ascii(Buffer const & buffer, ostream & os, int) const
+int InsetCitation::plaintext(Buffer const & buffer, ostream & os, int) const
{
if (cache.params == params() && cache.style == getStyle(buffer))
os << cache.generated_label;
// 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 &) const
+ OutputParams const &) const
{
os << "\\";
if (buffer.params().use_natbib)
///
InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
///
- int ascii(Buffer const &, std::ostream &, int linelen) const;
+ int plaintext(Buffer const &, std::ostream &, int linelen) const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
protected:
int InsetCollapsable::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return inset.latex(buf, os, runparams);
}
-int InsetCollapsable::ascii(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+int InsetCollapsable::plaintext(Buffer const & buf, ostream & os,
+ OutputParams const & runparams) const
{
- return inset.ascii(buf, os, runparams);
+ return inset.plaintext(buf, os, runparams);
}
int InsetCollapsable::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return inset.linuxdoc(buf, os, runparams);
}
int InsetCollapsable::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return inset.docbook(buf, os, runparams);
}
int insetInInsetY() const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
///
void validate(LaTeXFeatures & features) const;
/// FIXME, document
int InsetCommand::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << getCommand();
return 0;
}
-int InsetCommand::ascii(Buffer const &, ostream &,
- LatexRunParams const &) const
+int InsetCommand::plaintext(Buffer const &, ostream &,
+ OutputParams const &) const
{
return 0;
}
int InsetCommand::linuxdoc(Buffer const &, ostream &,
- LatexRunParams const &) const
+ OutputParams const &) const
{
return 0;
}
int InsetCommand::docbook(Buffer const &, ostream &,
- LatexRunParams const &) const
+ OutputParams const &) const
{
return 0;
}
void scanCommand(std::string const & c) { p_.scanCommand(c); };
///
virtual int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
virtual int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
virtual int docbook(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
///
InsetOld::Code lyxCode() const { return InsetOld::NO_CODE; }
#include "bufferparams.h"
#include "gettext.h"
#include "paragraph.h"
-#include "paragraph_funcs.h"
+#include "output_latex.h"
#include "texrow.h"
#include "support/std_ostream.h"
int InsetEnvironment::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << layout_->latexheader;
TexRow texrow;
InsetOld::Code lyxCode() const { return InsetOld::ENVIRONMENT_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
std::string const editMessage() const;
///
int InsetERT::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
}
-int InsetERT::ascii(Buffer const &, ostream &,
- LatexRunParams const & /*runparams*/) const
+int InsetERT::plaintext(Buffer const &, ostream &,
+ OutputParams const & /*runparams*/) const
{
return 0;
}
int InsetERT::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &)const
+ OutputParams const &)const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
int InsetERT::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
EDITABLE editable() const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const & runparams) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
///
void validate(LaTeXFeatures &) const {}
///
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "lyx_main.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "frontends/lyx_gui.h"
#include "frontends/LyXView.h"
int InsetExternal::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
// "nice" means that the buffer is exported to LaTeX format but not
// run through the LaTeX compiler.
// If the template has specified a PDFLaTeX output, then we try and
// use that.
- if (runparams.flavor == LatexRunParams::PDFLATEX) {
+ if (runparams.flavor == OutputParams::PDFLATEX) {
external::Template const * const et_ptr =
external::getTemplatePtr(params_);
if (!et_ptr)
}
-int InsetExternal::ascii(Buffer const & buf, ostream & os,
- LatexRunParams const &) const
+int InsetExternal::plaintext(Buffer const & buf, ostream & os,
+ OutputParams const &) const
{
return external::writeExternal(params_, "Ascii", buf, os);
}
int InsetExternal::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
return external::writeExternal(params_, "LinuxDoc", buf, os);
}
int InsetExternal::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
return external::writeExternal(params_, "DocBook", buf, os);
}
string const latex_string(InsetExternal const & inset, Buffer const & buffer)
{
ostringstream os;
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
inset.latex(buffer, os, runparams);
return os.str();
/// \returns the number of rows (\n's) of generated code.
virtual int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- virtual int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ virtual int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
virtual int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
virtual int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
/// Update needed features for this inset.
virtual void validate(LaTeXFeatures & features) const;
#include "gettext.h"
#include "iterators.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxlex.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "support/lstrings.h"
int InsetFloat::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
FloatList const & floats = buf.params().getLyXTextClass().floats();
string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
int InsetFloat::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
FloatList const & floats = buf.params().getLyXTextClass().floats();
string const tmptype = params_.type;
int InsetFloat::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '<' << params_.type << '>';
int const i = inset.docbook(buf, os, runparams);
InsetOld::Code lyxCode() const { return InsetOld::FLOAT_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
std::string const editMessage() const;
///
int InsetFloatList::latex(Buffer const & buf, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
FloatList const & floats = buf.params().getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()];
}
-int InsetFloatList::ascii(Buffer const & buffer, ostream & os, LatexRunParams const &) const
+int InsetFloatList::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const
{
os << getScreenLabel(buffer) << "\n\n";
void read(Buffer const &, LyXLex &);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const { return 0; }
+ OutputParams const &) const { return 0; }
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const { return 0; }
+ OutputParams const &) const { return 0; }
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const & runparams) const;
///
void validate(LaTeXFeatures & features) const;
protected:
#include "insetfoot.h"
#include "gettext.h"
-#include "latexrunparams.h"
// the following are needed just to get the layout of the enclosing
// paragraph. This seems a bit too much to me (JMarc)
#include "lyxlayout.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
int InsetFoot::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
- LatexRunParams runparams = runparams_in;
+ OutputParams runparams = runparams_in;
runparams.moving_arg |= ownerPar(buf, this).layout()->intitle;
os << "%\n\\footnote{";
int InsetFoot::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "<footnote>";
int const i = inset.docbook(buf, os, runparams);
InsetOld::Code lyxCode() const { return InsetOld::FOOT_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
///
std::string const editMessage() const;
};
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "lyx_main.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
}
-string findTargetFormat(string const & suffix, LatexRunParams const & runparams)
+string findTargetFormat(string const & suffix, OutputParams const & runparams)
{
// Are we using latex or pdflatex).
- if (runparams.flavor == LatexRunParams::PDFLATEX) {
+ if (runparams.flavor == OutputParams::PDFLATEX) {
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode" << endl;
if (contains(suffix, "ps") || suffix == "pdf")
return "pdf";
string const InsetGraphics::prepareFile(Buffer const & buf,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string orig_file = params().filename.absFilename();
string const rel_file = params().filename.relFilename(buf.filePath());
int InsetGraphics::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
// If there is no file specified or not existing,
// just output a message about it in the latex output.
}
-int InsetGraphics::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetGraphics::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
// No graphics in ascii output. Possible to use gifscii to convert
// images to ascii approximation.
int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
string const file_name = buf.niceFile() ?
params().filename.relFilename(buf.filePath()):
// http://en.tldp.org/LDP/LDP-Author-Guide/inserting-pictures.html
// See also the docbook guide at http://www.docbook.org/
int InsetGraphics::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
// need to switch to MediaObject. However, for now this is sufficient and
fragile commands by adding a #\protect# before.
*/
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
/** Tell LyX what the latex features you need i.e. what latex packages
you need to be included.
/// Create the options for the latex command.
std::string const createLatexOptions() const;
/// Convert the file if needed, and return the location of the file.
- std::string const prepareFile(Buffer const & buf, LatexRunParams const &) const;
+ std::string const prepareFile(Buffer const & buf, OutputParams const &) const;
///
InsetGraphicsParams params_;
int InsetHFill::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << getCommand();
return 0;
}
-int InsetHFill::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetHFill::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << '\t';
return 0;
int InsetHFill::linuxdoc(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
int InsetHFill::docbook(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
InsetOld::Code lyxCode() const { return InsetOld::HFILL_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const & runparams) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const & runparams) const;
+ OutputParams const & runparams) const;
///
void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "lyx_main.h"
#include "lyxlex.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "frontends/LyXView.h"
#include "frontends/Painter.h"
int InsetInclude::latex(Buffer const & buffer, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile(params_.getContents());
}
-int InsetInclude::ascii(Buffer const & buffer, ostream & os,
- LatexRunParams const &) const
+int InsetInclude::plaintext(Buffer const & buffer, ostream & os,
+ OutputParams const &) const
{
if (isVerbatim(params_))
os << GetFileContents(includedFilename(buffer, params_));
int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile(params_.getContents());
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- LatexRunParams runp = runparams;
- runp.nice = buffer.niceFile();
+ OutputParams runp = runparams;
+ runp.nice = buffer.niceFile();
tmp->makeLinuxDocFile(writefile, runp, true);
}
int InsetInclude::docbook(Buffer const & buffer, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile(params_.getContents());
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- LatexRunParams runp = runparams;
+ OutputParams runp = runparams;
runp.nice = buffer.niceFile();
tmp->makeDocBookFile(writefile, runp, true);
}
string const latex_string(InsetInclude const & inset, Buffer const & buffer)
{
ostringstream os;
- LatexRunParams runparams;
- runparams.flavor = LatexRunParams::LATEX;
+ OutputParams runparams;
+ runparams.flavor = OutputParams::LATEX;
inset.latex(buffer, os, runparams);
return os.str();
void read(Buffer const &, LyXLex &);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
///
int InsetIndex::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "<indexterm><primary>" << getContents()
<< "</primary></indexterm>";
InsetOld::Code lyxCode() const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
DispatchResult priv_dispatch(FuncRequest const & cmd,
idx_type & idx, pos_type & pos);
int InsetLabel::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << escape(getCommand());
return 0;
}
-int InsetLabel::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetLabel::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << '<' << getContents() << '>';
return 0;
int InsetLabel::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "<label id=\"" << getContents() << "\" >";
return 0;
int InsetLabel::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "<anchor id=\"" << getContents() << "\">";
return 0;
void getLabelList(Buffer const &, std::vector<std::string> & list) const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
protected:
///
virtual
int InsetLatexAccent::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << contents;
return 0;
}
-int InsetLatexAccent::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetLatexAccent::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << contents;
return 0;
int InsetLatexAccent::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << contents;
return 0;
int InsetLatexAccent::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << contents;
return 0;
void read(Buffer const &, LyXLex & lex);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
bool directWrite() const;
///
int InsetLine::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "\\lyxline{}";
}
-int InsetLine::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetLine::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << "-------------------------------------------";
return 0;
int InsetLine::linuxdoc(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
int InsetLine::docbook(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
void draw(PainterInfo & pi, int x, int y) const;
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
void read(Buffer const &, LyXLex & lex);
int InsetList::latex(Buffer const * buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "\\footnote{%\n";
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
string const editMessage() const;
};
int InsetMarginal::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "%\n\\marginpar{";
InsetOld::Code lyxCode() const { return InsetOld::MARGIN_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
std::string const editMessage() const;
};
int InsetMinipage::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string s_pos;
switch (params_.pos) {
InsetOld::Code lyxCode() const { return InsetOld::MINIPAGE_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
std::string const editMessage() const;
///
int InsetNewline::latex(Buffer const &, ostream &,
- LatexRunParams const &) const
+ OutputParams const &) const
{
lyxerr << "Eek, calling InsetNewline::latex !" << endl;
return 0;
}
-int InsetNewline::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetNewline::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << '\n';
return 0;
int InsetNewline::linuxdoc(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
int InsetNewline::docbook(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
virtual void draw(PainterInfo & pi, int x, int y) const;
virtual int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
- virtual int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ virtual int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
virtual int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
virtual int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
virtual void read(Buffer const &, LyXLex & lex);
int InsetNote::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string const pt = params_.type;
int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string const pt = params_.type;
int InsetNote::docbook(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
string const pt = params_.type;
}
-int InsetNote::ascii(Buffer const & buf, std::ostream & os,
- LatexRunParams const & runparams) const
+int InsetNote::plaintext(Buffer const & buf, std::ostream & os,
+ OutputParams const & runparams) const
{
int i = 0;
string const pt = params_.type;
if (pt != "Note") {
os << "[";
- i = inset.ascii(buf, os, runparams);
+ i = inset.plaintext(buf, os, runparams);
os << "]";
}
return i;
bool showInsetDialog(BufferView * bv) const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
///
int InsetOptArg::latex(Buffer const &, ostream &,
- LatexRunParams const &) const
+ OutputParams const &) const
{
return 0;
}
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '[';
int const i = inset.latex(buf, os, runparams);
/// Standard LaTeX output -- short-circuited
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
/// Outputting the optional parameter of a LaTeX command
int latexOptional(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
/// Write out tothe .lyx file
void write(Buffer const & buf, std::ostream & os) const;
};
int InsetPagebreak::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "\\newpage{}";
return 0;
}
-int InsetPagebreak::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetPagebreak::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << '\n';
return 0;
int InsetPagebreak::linuxdoc(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
int InsetPagebreak::docbook(Buffer const &, std::ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '\n';
return 0;
void draw(PainterInfo & pi, int x, int y) const;
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
void read(Buffer const &, LyXLex & lex);
#include "debug.h"
#include "language.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
int InsetQuotes::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
// How do we get the local language here??
lyx::pos_type curr_pos = ownerPar(buf, this).getPositionOfInset(this);
}
-int InsetQuotes::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetQuotes::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << '"';
return 0;
int InsetQuotes::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '"';
return 0;
int InsetQuotes::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
if (times_ == DoubleQ) {
if (side_ == LeftQ)
void read(Buffer const &, LyXLex & lex);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
///
int InsetRef::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
if (getOptions().empty())
os << escape(getCommand());
}
-int InsetRef::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetRef::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
os << '[' << getContents() << ']';
return 0;
int InsetRef::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "<ref id=\"" << getContents()
<< "\" name=\"" << getOptions() << "\" >";
int InsetRef::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
if (getOptions().empty()) {
os << "<xref linkend=\"" << getContents() << "\">";
bool display() const { return false; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures & features) const;
protected:
#include "insetspace.h"
#include "debug.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxlex.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
int InsetSpace::latex(Buffer const &, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
switch (kind_) {
case NORMAL:
}
-int InsetSpace::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetSpace::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
switch (kind_) {
case NORMAL:
int InsetSpace::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case NORMAL:
int InsetSpace::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case NORMAL:
void read(Buffer const &, LyXLex & lex);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
///
int InsetSpecialChar::latex(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case HYPHENATION:
}
-int InsetSpecialChar::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetSpecialChar::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
switch (kind_) {
case HYPHENATION:
int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case HYPHENATION:
int InsetSpecialChar::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
switch (kind_) {
case HYPHENATION:
void read(Buffer const &, LyXLex & lex);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
///
#include "FuncStatus.h"
#include "gettext.h"
#include "language.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyx_cb.h"
#include "lyxlex.h"
#include "metricsinfo.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
int InsetTabular::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return tabular.latex(buf, os, runparams);
}
-int InsetTabular::ascii(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+int InsetTabular::plaintext(Buffer const & buf, ostream & os,
+ OutputParams const & runparams) const
{
if (runparams.linelen > 0)
- return tabular.ascii(buf, os, runparams,
+ return tabular.plaintext(buf, os, runparams,
ownerPar(buf, this).params().depth(),
false, 0);
- return tabular.ascii(buf, os, runparams, 0, false, 0);
+ return tabular.plaintext(buf, os, runparams, 0, false, 0);
}
int InsetTabular::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return tabular.linuxdoc(buf,os, runparams);
}
int InsetTabular::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret = 0;
InsetOld * master;
true, true);
ostringstream os;
- LatexRunParams const runparams;
- paste_tabular->ascii(*bv->buffer(), os, runparams,
- ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
+ OutputParams const runparams;
+ paste_tabular->plaintext(*bv->buffer(), os, runparams,
+ ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
bv->stuffClipboard(os.str());
return true;
}
bool display() const { return tabular.isLongTabular(); }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures & features) const;
///
#include "lyxlex.h"
#include "lyxrc.h"
#include "metricsinfo.h"
+#include "output_docbook.h"
+#include "output_latex.h"
+#include "output_linuxdoc.h"
+#include "output_plaintext.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
int InsetText::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
TexRow texrow;
latexParagraphs(buf, paragraphs, os, texrow, runparams);
}
-int InsetText::ascii(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+int InsetText::plaintext(Buffer const & buf, ostream & os,
+ OutputParams const & runparams) const
{
ParagraphList::const_iterator beg = paragraphs.begin();
ParagraphList::const_iterator end = paragraphs.end();
int InsetText::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
linuxdocParagraphs(buf, paragraphs, os, runparams);
return 0;
int InsetText::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
docbookParagraphs(buf, paragraphs, os, runparams);
return 0;
UpdatableInset *, bool lr = false);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const ;
+ OutputParams const &) const ;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const ;
+ OutputParams const &) const ;
///
void validate(LaTeXFeatures & features) const;
///
int InsetTheorem::latex(Buffer const * buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "\\begin{theorem}%\n";
void draw(PainterInfo & pi, int x, int y) const;
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
string const editMessage() const;
private:
}
-int InsetTOC::ascii(Buffer const & buffer, ostream & os,
- LatexRunParams const &) const
+int InsetTOC::plaintext(Buffer const & buffer, ostream & os,
+ OutputParams const &) const
{
os << getScreenLabel(buffer) << "\n\n";
int InsetTOC::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
if (getCmdName() == "tableofcontents")
os << "<toc>";
int InsetTOC::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
if (getCmdName() == "tableofcontents")
os << "<toc></toc>";
///
bool display() const { return true; }
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
protected:
///
virtual
#include "dispatchresult.h"
#include "funcrequest.h"
-#include "latexrunparams.h"
#include "LaTeXFeatures.h"
#include "gettext.h"
+#include "outputparams.h"
#include "support/lstrings.h"
int InsetUrl::latex(Buffer const &, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
if (!getOptions().empty())
os << getOptions() + ' ';
}
-int InsetUrl::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetUrl::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
if (getOptions().empty())
os << '[' << getContents() << ']';
int InsetUrl::linuxdoc(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << '<' << getCmdName()
<< " url=\"" << getContents() << "\""
int InsetUrl::docbook(Buffer const &, ostream & os,
- LatexRunParams const &) const
+ OutputParams const &) const
{
os << "<ulink url=\"" << subst(getContents(),"&","&")
<< "\">" << getOptions() << "</ulink>";
bool display() const { return false; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
protected:
///
virtual
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxlex.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "support/tostr.h"
int InsetWrap::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "\\begin{floating" << params_.type << '}';
if (!params_.placement.empty()) {
int InsetWrap::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
os << '<' << params_.type << '>';
int const i = inset.docbook(buf, os, runparams);
InsetOld::Code lyxCode() const { return InsetOld::WRAP_CODE; }
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
std::string const editMessage() const;
///
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file latexrunparams.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef LatexRunParams_H
-#define LatexRunParams_H
-
-struct LatexRunParams {
- enum FLAVOR {
- LATEX,
- PDFLATEX
- };
-
- LatexRunParams() : flavor(LATEX), nice(false),
- moving_arg(false), free_spacing(false),
- use_babel(false), mixed_content(false),
- linelen(0) {}
-
- /** 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;
-
- /** moving_arg == true means that the environment in which the inset
- is typeset is a moving argument. The inset should take care about
- fragile commands by preceding the latex with \protect.
- */
- bool moving_arg;
-
- /** free_spacing == true means that the inset is in a free-spacing
- paragraph.
- */
- bool free_spacing;
-
- /** This var is set by the return value from BufferParams::writeLaTeX
- */
- bool use_babel;
-
- /** Used for docbook to see if inside a region of mixed content.
- In that case all the white spaces are significant and can not appear
- at the begin or end.
- */
- bool mixed_content;
-
- /** Line lenght to use with ascii export.
- */
- int linelen;
-};
-
-#endif // LATEXRUNPARAMS_H
+2003-11-05 José Matos <jamatos@lyx.org>
+
+ * formula.[Ch] (ascii, linuxdoc, docbook):
+ * formulamacro.[Ch] (ascii, linuxdoc, docbook):
+ * math_inset.[Ch] (ascii, linuxdoc, docbook):
+ * ref_inset.[Ch] (ascii, linuxdoc, docbook):
+ rename ascii to plaintext and LatexRunParams to OutputParams.
+
2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
* Adjust for new DispatchResult semantics.
* formula.[Ch] (ascii, linuxdoc, docbook):
* formulamacro.[Ch] (ascii, linuxdoc, docbook):
* math_inset.[Ch] (ascii, linuxdoc, docbook):
- * math_inset.[Ch] (ascii, linuxdoc, docbook):
* ref_inset.[Ch] (ascii, linuxdoc, docbook):
add LatexRunParams argument.
#include "BufferView.h"
#include "debug.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyx_main.h"
+#include "outputparams.h"
#include "frontends/Painter.h"
int InsetFormula::latex(Buffer const &, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
WriteStream wi(os, runparams.moving_arg, true);
par_->write(wi);
}
-int InsetFormula::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetFormula::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
if (0 && display()) {
Dimension dim;
int InsetFormula::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
return docbook(buf, os, runparams);
}
int InsetFormula::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
MathMLStream ms(os);
ms << MTag("equation");
ms << MTag("alt");
ms << "<[CDATA[";
- int res = ascii(buf, ms.os(), runparams);
+ int res = plaintext(buf, ms.os(), runparams);
ms << "]]>";
ms << ETag("alt");
ms << MTag("math");
void read(Buffer const &, LyXLex & lex);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
#include "math_mathmlstream.h"
#include "gettext.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxlex.h"
+#include "outputparams.h"
#include "frontends/Painter.h"
#include "frontends/font_metrics.h"
int InsetFormulaMacro::latex(Buffer const &, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
WriteStream wi(os, runparams.moving_arg, true);
par()->write(wi);
}
-int InsetFormulaMacro::ascii(Buffer const &, ostream & os,
- LatexRunParams const &) const
+int InsetFormulaMacro::plaintext(Buffer const &, ostream & os,
+ OutputParams const &) const
{
WriteStream wi(os, false, true);
par()->write(wi);
int InsetFormulaMacro::linuxdoc(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
- return ascii(buf, os, runparams);
+ return plaintext(buf, os, runparams);
}
int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
- return ascii(buf, os, runparams);
+ return plaintext(buf, os, runparams);
}
///
void write(Buffer const &, std::ostream & os) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const &) const;
///
int latex(Buffer const &, std::ostream & os,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream & os,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
}
-int MathInset::ascii(std::ostream &, LatexRunParams const &) const
+int MathInset::plaintext(std::ostream &, OutputParams const &) const
{
return 0;
}
-int MathInset::linuxdoc(std::ostream &, LatexRunParams const &) const
+int MathInset::linuxdoc(std::ostream &, OutputParams const &) const
{
return 0;
}
-int MathInset::docbook(std::ostream &, LatexRunParams const &) const
+int MathInset::docbook(std::ostream &, OutputParams const &) const
{
return 0;
}
*/
-class LatexRunParams;
+class OutputParams;
class MathArrayInset;
class MathAMSArrayInset;
class MathCharInset;
/// describe content if cursor behind
virtual void infoize2(std::ostream &) const {}
/// plain ascii output
- virtual int ascii(std::ostream & os, LatexRunParams const &) const;
+ virtual int plaintext(std::ostream & os, OutputParams const &) const;
/// linuxdoc output
- virtual int linuxdoc(std::ostream & os, LatexRunParams const &) const;
+ virtual int linuxdoc(std::ostream & os, OutputParams const &) const;
/// docbook output
- virtual int docbook(std::ostream & os, LatexRunParams const &) const;
+ virtual int docbook(std::ostream & os, OutputParams const &) const;
/// dump content to stderr for debugging
virtual void dump() const;
}
-int RefInset::ascii(std::ostream & os, LatexRunParams const &) const
+int RefInset::plaintext(std::ostream & os, OutputParams const &) const
{
os << '[' << asString(cell(0)) << ']';
return 0;
}
-int RefInset::linuxdoc(std::ostream & os, LatexRunParams const &) const
+int RefInset::linuxdoc(std::ostream & os, OutputParams const &) const
{
os << "<ref id=\"" << asString(cell(0))
<< "\" name=\"" << asString(cell(1)) << "\" >";
}
-int RefInset::docbook(std::ostream & os, LatexRunParams const &) const
+int RefInset::docbook(std::ostream & os, OutputParams const &) const
{
if (cell(1).empty()) {
os << "<xref linkend=\"" << asString(cell(0)) << "\">";
virtual RefInset * asRefInset() { return this; }
/// plain ascii output
- int ascii(std::ostream & os, LatexRunParams const &) const;
+ int plaintext(std::ostream & os, OutputParams const &) const;
/// linuxdoc output
- int linuxdoc(std::ostream & os, LatexRunParams const &) const;
+ int linuxdoc(std::ostream & os, OutputParams const &) const;
/// docbook output
- int docbook(std::ostream & os, LatexRunParams const &) const;
+ int docbook(std::ostream & os, OutputParams const &) const;
/// small wrapper for the time being
DispatchResult localDispatch(FuncRequest const & cmd);
--- /dev/null
+/**
+ * \file output.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "output.h"
+
+#include "gettext.h"
+
+#include "frontends/Alert.h"
+
+#include "support/filetools.h"
+
+#include <fstream>
+
+using lyx::support::bformat;
+using lyx::support::MakeDisplayPath;
+
+using std::ofstream;
+using std::string;
+
+bool openFileWrite(ofstream & ofs, string const & fname)
+{
+ ofs.open(fname.c_str());
+ if (!ofs) {
+ string const file = MakeDisplayPath(fname, 50);
+ string text = bformat(_("Could not open the specified "
+ "document\n%1$s."), file);
+ Alert::error(_("Could not open file"), text);
+ return false;
+ }
+ return true;
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file output.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef OUTPUT_H
+#define OUTPUT_H
+
+#include <iosfwd>
+
+bool openFileWrite(std::ofstream & ofs, std::string const & fname);
+
+#endif
--- /dev/null
+/**
+ * \file output_docbook.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "output_docbook.h"
+
+#include "buffer.h"
+#include "bufferparams.h"
+#include "paragraph.h"
+#include "paragraph_funcs.h"
+#include "ParagraphParameters.h"
+#include "sgml.h"
+
+#include "insets/insetcommand.h"
+
+#include "support/lstrings.h"
+#include "support/lyxlib.h"
+
+#include <stack>
+
+#ifdef HAVE_LOCALE
+#endif
+
+using lyx::support::atoi;
+using lyx::support::split;
+
+using std::endl;
+using std::ostream;
+using std::stack;
+using std::vector;
+using std::string;
+
+
+void docbookParagraphs(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ostream & os,
+ OutputParams const & runparams)
+{
+ vector<string> environment_stack(10);
+ vector<string> environment_inner(10);
+ vector<string> command_stack(10);
+
+ bool command_flag = false;
+ Paragraph::depth_type command_depth = 0;
+ Paragraph::depth_type command_base = 0;
+ Paragraph::depth_type cmd_depth = 0;
+ Paragraph::depth_type depth = 0; // paragraph depth
+
+ string item_name;
+ string command_name;
+
+ ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
+ ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
+
+ for (; par != pend; ++par) {
+ string sgmlparam;
+ string c_depth;
+ string c_params;
+ int desc_on = 0; // description mode
+
+ LyXLayout_ptr const & style = par->layout();
+
+ // environment tag closing
+ for (; depth > par->params().depth(); --depth) {
+ if (!environment_inner[depth].empty())
+ sgml::closeEnvTags(os, false, environment_inner[depth],
+ command_depth + depth);
+ sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
+ environment_stack[depth].erase();
+ environment_inner[depth].erase();
+ }
+
+ if (depth == par->params().depth()
+ && environment_stack[depth] != style->latexname()
+ && !environment_stack[depth].empty()) {
+ sgml::closeEnvTags(os, false, environment_inner[depth],
+ command_depth + depth);
+ sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
+
+ environment_stack[depth].erase();
+ environment_inner[depth].erase();
+ }
+
+ // Write opening SGML tags.
+ switch (style->latextype) {
+ case LATEX_PARAGRAPH:
+ sgml::openTag(os, depth + command_depth,
+ false, style->latexname());
+ break;
+
+ case LATEX_COMMAND:
+ if (depth != 0)
+ //error(ErrorItem(_("Error"), _("Wrong depth for LatexType Command."), par->id(), 0, par->size()));
+ ;
+
+ command_name = style->latexname();
+
+ sgmlparam = style->latexparam();
+ c_params = split(sgmlparam, c_depth,'|');
+
+ cmd_depth = atoi(c_depth);
+
+ if (command_flag) {
+ if (cmd_depth < command_base) {
+ for (Paragraph::depth_type j = command_depth;
+ j >= command_base; --j) {
+ sgml::closeTag(os, j, false, command_stack[j]);
+ os << endl;
+ }
+ command_depth = command_base = cmd_depth;
+ } else if (cmd_depth <= command_depth) {
+ for (int j = command_depth;
+ j >= int(cmd_depth); --j) {
+ sgml::closeTag(os, j, false, command_stack[j]);
+ os << endl;
+ }
+ command_depth = cmd_depth;
+ } else
+ command_depth = cmd_depth;
+ } else {
+ command_depth = command_base = cmd_depth;
+ command_flag = true;
+ }
+ if (command_stack.size() == command_depth + 1)
+ command_stack.push_back(string());
+ command_stack[command_depth] = command_name;
+
+ // treat label as a special case for
+ // more WYSIWYM handling.
+ // This is a hack while paragraphs can't have
+ // attributes, like id in this case.
+ if (par->isInset(0)) {
+ InsetOld * inset = par->getInset(0);
+ InsetOld::Code lyx_code = inset->lyxCode();
+ if (lyx_code == InsetOld::LABEL_CODE) {
+ command_name += " id=\"";
+ command_name += (static_cast<InsetCommand *>(inset))->getContents();
+ command_name += '"';
+ desc_on = 3;
+ }
+ }
+
+ sgml::openTag(os, depth + command_depth, false, command_name);
+
+ item_name = c_params.empty() ? "title" : c_params;
+ sgml::openTag(os, depth + 1 + command_depth, false, item_name);
+ break;
+
+ case LATEX_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ if (depth < par->params().depth()) {
+ depth = par->params().depth();
+ environment_stack[depth].erase();
+ }
+
+ if (environment_stack[depth] != style->latexname()) {
+ if (environment_stack.size() == depth + 1) {
+ environment_stack.push_back("!-- --");
+ environment_inner.push_back("!-- --");
+ }
+ environment_stack[depth] = style->latexname();
+ environment_inner[depth] = "!-- --";
+ sgml::openTag(os, depth + command_depth, false, environment_stack[depth]);
+ } else {
+ sgml::closeEnvTags(os, false, environment_inner[depth],
+ command_depth + depth);
+ }
+
+ if (style->latextype == LATEX_ENVIRONMENT) {
+ if (!style->latexparam().empty()) {
+ if (style->latexparam() == "CDATA")
+ os << "<![CDATA[";
+ else
+ sgml::openTag(os, depth + command_depth, false, style->latexparam());
+ }
+ break;
+ }
+
+ desc_on = (style->labeltype == LABEL_MANUAL);
+
+ environment_inner[depth] = desc_on ? "varlistentry" : "listitem";
+ sgml::openTag(os, depth + 1 + command_depth,
+ false, environment_inner[depth]);
+
+ item_name = desc_on ? "term" : "para";
+ sgml::openTag(os, depth + 1 + command_depth,
+ false, item_name);
+ break;
+ default:
+ sgml::openTag(os, depth + command_depth,
+ false, style->latexname());
+ break;
+ }
+
+ par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs), desc_on,
+ runparams, depth + 1 + command_depth);
+
+ string end_tag;
+ // write closing SGML tags
+ switch (style->latextype) {
+ case LATEX_COMMAND:
+ end_tag = c_params.empty() ? "title" : c_params;
+ sgml::closeTag(os, depth + command_depth,
+ false, end_tag);
+ break;
+ case LATEX_ENVIRONMENT:
+ if (!style->latexparam().empty()) {
+ if (style->latexparam() == "CDATA")
+ os << "]]>";
+ else
+ sgml::closeTag(os, depth + command_depth, false, style->latexparam());
+ }
+ break;
+ case LATEX_ITEM_ENVIRONMENT:
+ if (desc_on == 1) break;
+ end_tag = "para";
+ sgml::closeTag(os, depth + 1 + command_depth, false, end_tag);
+ break;
+ case LATEX_PARAGRAPH:
+ sgml::closeTag(os, depth + command_depth, false, style->latexname());
+ break;
+ default:
+ sgml::closeTag(os, depth + command_depth, false, style->latexname());
+ break;
+ }
+ }
+
+ // Close open tags
+ for (int d = depth; d >= 0; --d) {
+ if (!environment_stack[depth].empty()) {
+ sgml::closeEnvTags(os, false, environment_inner[depth],
+ command_depth + depth);
+ }
+ }
+
+ for (int j = command_depth; j >= 0 ; --j)
+ if (!command_stack[j].empty()) {
+ sgml::closeTag(os, j, false, command_stack[j]);
+ os << endl;
+ }
+}
+
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file output_docbook.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef OUTPUT_DOCBOOK_H
+#define OUTPUT_DOCBOOK_H
+
+#include "ParagraphList_fwd.h"
+
+
+class Buffer;
+class OutputParams;
+
+///
+
+void docbookParagraphs(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ std::ostream & os,
+ OutputParams const & runparams);
+
+#endif
--- /dev/null
+/**
+ * \file output_latex.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "output_latex.h"
+
+#include "buffer.h"
+#include "bufferparams.h"
+#include "debug.h"
+#include "encoding.h"
+#include "language.h"
+#include "lyxrc.h"
+#include "paragraph.h"
+#include "paragraph_funcs.h"
+#include "ParagraphParameters.h"
+#include "texrow.h"
+#include "vspace.h"
+
+#include "insets/insetoptarg.h"
+
+#include "support/lstrings.h"
+
+#ifdef HAVE_LOCALE
+#endif
+
+using lyx::support::subst;
+
+using std::endl;
+using std::ostream;
+using std::string;
+
+extern string bibitemWidest(Buffer const &);
+
+
+namespace {
+
+ParagraphList::iterator
+TeXEnvironment(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ParagraphList::iterator pit,
+ ostream & os, TexRow & texrow,
+ OutputParams const & runparams);
+
+ParagraphList::iterator
+TeXOnePar(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ParagraphList::iterator pit,
+ ostream & os, TexRow & texrow,
+ OutputParams const & runparams,
+ string const & everypar = string());
+
+
+ParagraphList::iterator
+TeXDeeper(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ParagraphList::iterator pit,
+ ostream & os, TexRow & texrow,
+ OutputParams const & runparams)
+{
+ lyxerr[Debug::LATEX] << "TeXDeeper... " << &*pit << endl;
+ ParagraphList::iterator par = pit;
+
+ while (par != const_cast<ParagraphList&>(paragraphs).end() &&
+ par->params().depth() == pit->params().depth()) {
+ if (par->layout()->isEnvironment()) {
+ par = TeXEnvironment(buf, paragraphs, par,
+ os, texrow, runparams);
+ } else {
+ par = TeXOnePar(buf, paragraphs, par,
+ os, texrow, runparams);
+ }
+ }
+ lyxerr[Debug::LATEX] << "TeXDeeper...done " << &*par << endl;
+
+ return par;
+}
+
+
+ParagraphList::iterator
+TeXEnvironment(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ParagraphList::iterator pit,
+ ostream & os, TexRow & texrow,
+ OutputParams const & runparams)
+{
+ lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
+
+ BufferParams const & bparams = buf.params();
+
+ LyXLayout_ptr const & style = pit->layout();
+
+ Language const * language = pit->getParLanguage(bparams);
+ Language const * doc_language = bparams.language;
+ Language const * previous_language =
+ (pit != const_cast<ParagraphList&>(paragraphs).begin())
+ ? boost::prior(pit)->getParLanguage(bparams)
+ : doc_language;
+ if (language->babel() != previous_language->babel()) {
+
+ if (!lyxrc.language_command_end.empty() &&
+ previous_language->babel() != doc_language->babel()) {
+ os << subst(lyxrc.language_command_end, "$$lang",
+ previous_language->babel())
+ << endl;
+ texrow.newline();
+ }
+
+ if (lyxrc.language_command_end.empty() ||
+ language->babel() != doc_language->babel()) {
+ os << subst(lyxrc.language_command_begin, "$$lang",
+ language->babel())
+ << endl;
+ texrow.newline();
+ }
+ }
+
+ bool leftindent_open = false;
+ if (!pit->params().leftIndent().zero()) {
+ os << "\\begin{LyXParagraphLeftIndent}{" <<
+ pit->params().leftIndent().asLatexString() << "}\n";
+ texrow.newline();
+ leftindent_open = true;
+ }
+
+ if (style->isEnvironment()) {
+ if (style->latextype == LATEX_LIST_ENVIRONMENT) {
+ os << "\\begin{" << style->latexname() << "}{"
+ << pit->params().labelWidthString() << "}\n";
+ } else if (style->labeltype == LABEL_BIBLIO) {
+ // ale970405
+ os << "\\begin{" << style->latexname() << "}{"
+ << bibitemWidest(buf)
+ << "}\n";
+ } else if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
+ os << "\\begin{" << style->latexname() << '}'
+ << style->latexparam() << '\n';
+ } else
+ os << "\\begin{" << style->latexname() << '}'
+ << style->latexparam() << '\n';
+ texrow.newline();
+ }
+ ParagraphList::iterator par = pit;
+ do {
+ par = TeXOnePar(buf, paragraphs, par, os, texrow, runparams);
+
+ if (par != const_cast<ParagraphList&>(paragraphs).end() && par->params().depth() > pit->params().depth()) {
+ if (par->layout()->isParagraph()) {
+
+ // Thinko!
+ // How to handle this? (Lgb)
+ //&& !suffixIs(os, "\n\n")
+ //) {
+ // There should be at least one '\n' already
+ // but we need there to be two for Standard
+ // paragraphs that are depth-increment'ed to be
+ // output correctly. However, tables can
+ // also be paragraphs so don't adjust them.
+ // ARRae
+ // Thinkee:
+ // Will it ever harm to have one '\n' too
+ // many? i.e. that we sometimes will have
+ // three in a row. (Lgb)
+ os << '\n';
+ texrow.newline();
+ }
+ par = TeXDeeper(buf, paragraphs, par, os, texrow,
+ runparams);
+ }
+ } while (par != const_cast<ParagraphList&>(paragraphs).end()
+ && par->layout() == pit->layout()
+ && par->params().depth() == pit->params().depth()
+ && par->params().leftIndent() == pit->params().leftIndent());
+
+ if (style->isEnvironment()) {
+ os << "\\end{" << style->latexname() << "}\n";
+ texrow.newline();
+ }
+
+ if (leftindent_open) {
+ os << "\\end{LyXParagraphLeftIndent}\n";
+ texrow.newline();
+ }
+
+ lyxerr[Debug::LATEX] << "TeXEnvironment...done " << &*par << endl;
+ return par; // ale970302
+}
+
+
+InsetOptArg * optArgInset(Paragraph const & par)
+{
+ // Find the entry.
+ InsetList::const_iterator it = par.insetlist.begin();
+ InsetList::const_iterator end = par.insetlist.end();
+ for (; it != end; ++it) {
+ InsetOld * ins = it->inset;
+ if (ins->lyxCode() == InsetOld::OPTARG_CODE) {
+ return static_cast<InsetOptArg *>(ins);
+ }
+ }
+ return 0;
+}
+
+
+ParagraphList::iterator
+TeXOnePar(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ParagraphList::iterator pit,
+ ostream & os, TexRow & texrow,
+ OutputParams const & runparams,
+ string const & everypar)
+{
+ lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
+ << everypar << "'" << endl;
+ BufferParams const & bparams = buf.params();
+
+ InsetOld const * in = pit->inInset();
+ bool further_blank_line = false;
+ LyXLayout_ptr style;
+
+ // well we have to check if we are in an inset with unlimited
+ // length (all in one row) if that is true then we don't allow
+ // any special options in the paragraph and also we don't allow
+ // any environment other then "Standard" to be valid!
+ if (in == 0 || !in->forceDefaultParagraphs(in)) {
+ style = pit->layout();
+
+ if (pit->params().startOfAppendix()) {
+ os << "\\appendix\n";
+ texrow.newline();
+ }
+
+ if (!pit->params().spacing().isDefault()
+ && (pit == const_cast<ParagraphList&>(paragraphs).begin()
+ || !boost::prior(pit)->hasSameLayout(*pit)))
+ {
+ os << pit->params().spacing().writeEnvirBegin() << '\n';
+ texrow.newline();
+ }
+
+ if (style->isCommand()) {
+ os << '\n';
+ texrow.newline();
+ }
+
+ if (pit->params().spaceTop().kind() != VSpace::NONE) {
+ os << pit->params().spaceTop().asLatexCommand(bparams);
+ further_blank_line = true;
+ }
+
+ if (further_blank_line) {
+ os << '\n';
+ texrow.newline();
+ }
+ } else {
+ style = bparams.getLyXTextClass().defaultLayout();
+ }
+
+ Language const * language = pit->getParLanguage(bparams);
+ Language const * doc_language = bparams.language;
+ Language const * previous_language =
+ (pit != const_cast<ParagraphList&>(paragraphs).begin())
+ ? boost::prior(pit)->getParLanguage(bparams)
+ : doc_language;
+
+ if (language->babel() != previous_language->babel()
+ // check if we already put language command in TeXEnvironment()
+ && !(style->isEnvironment()
+ && (pit == const_cast<ParagraphList&>(paragraphs).begin() ||
+ (boost::prior(pit)->layout() != pit->layout() &&
+ boost::prior(pit)->getDepth() <= pit->getDepth())
+ || boost::prior(pit)->getDepth() < pit->getDepth())))
+ {
+ if (!lyxrc.language_command_end.empty() &&
+ previous_language->babel() != doc_language->babel())
+ {
+ os << subst(lyxrc.language_command_end, "$$lang",
+ previous_language->babel())
+ << endl;
+ texrow.newline();
+ }
+
+ if (lyxrc.language_command_end.empty() ||
+ language->babel() != doc_language->babel())
+ {
+ os << subst(lyxrc.language_command_begin, "$$lang",
+ language->babel())
+ << endl;
+ texrow.newline();
+ }
+ }
+
+ if (bparams.inputenc == "auto" &&
+ language->encoding() != previous_language->encoding()) {
+ os << "\\inputencoding{"
+ << language->encoding()->LatexName()
+ << "}\n";
+ texrow.newline();
+ }
+
+ switch (style->latextype) {
+ case LATEX_COMMAND:
+ os << '\\' << style->latexname();
+
+ // Separate handling of optional argument inset.
+ if (style->optionalargs == 1) {
+ InsetOptArg * it = optArgInset(*pit);
+ if (it)
+ it->latexOptional(buf, os, runparams);
+ }
+ else
+ os << style->latexparam();
+ break;
+ case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_LIST_ENVIRONMENT:
+ os << "\\item ";
+ break;
+ case LATEX_BIB_ENVIRONMENT:
+ // ignore this, the inset will write itself
+ break;
+ default:
+ break;
+ }
+
+ os << everypar;
+ bool need_par = pit->simpleTeXOnePar(buf, bparams,
+ outerFont(pit, paragraphs),
+ os, texrow, runparams);
+
+ // Make sure that \\par is done with the font of the last
+ // character if this has another size as the default.
+ // This is necessary because LaTeX (and LyX on the screen)
+ // calculates the space between the baselines according
+ // to this font. (Matthias)
+ //
+ // Is this really needed ? (Dekel)
+ // We do not need to use to change the font for the last paragraph
+ // or for a command.
+ LyXFont const outerfont(outerFont(pit, paragraphs));
+
+ LyXFont const font =
+ (pit->empty()
+ ? pit->getLayoutFont(bparams, outerfont)
+ : pit->getFont(bparams, pit->size() - 1, outerfont));
+
+ bool is_command = style->isCommand();
+
+ if (style->resfont.size() != font.size()
+ && boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
+ && !is_command) {
+ if (!need_par)
+ os << '{';
+ os << "\\" << font.latexSize() << " \\par}";
+ } else if (need_par) {
+ os << "\\par}";
+ } else if (is_command)
+ os << '}';
+
+ switch (style->latextype) {
+ case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_LIST_ENVIRONMENT:
+ if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
+ && (pit->params().depth() < boost::next(pit)->params().depth())) {
+ os << '\n';
+ texrow.newline();
+ }
+ break;
+ case LATEX_ENVIRONMENT: {
+ // if its the last paragraph of the current environment
+ // skip it otherwise fall through
+ ParagraphList::iterator next = boost::next(pit);
+
+ if (next != const_cast<ParagraphList&>(paragraphs).end()
+ && (next->layout() != pit->layout()
+ || next->params().depth() != pit->params().depth()))
+ break;
+ }
+
+ // fall through possible
+ default:
+ // we don't need it for the last paragraph!!!
+ if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()) {
+ os << '\n';
+ texrow.newline();
+ }
+ }
+
+ if (in == 0 || !in->forceDefaultParagraphs(in)) {
+ further_blank_line = false;
+
+ if (pit->params().spaceBottom().kind() != VSpace::NONE) {
+ os << pit->params().spaceBottom().asLatexCommand(bparams);
+ further_blank_line = true;
+ }
+
+ if (further_blank_line) {
+ os << '\n';
+ texrow.newline();
+ }
+
+ if (!pit->params().spacing().isDefault()
+ && (boost::next(pit) == const_cast<ParagraphList&>(paragraphs).end()
+ || !boost::next(pit)->hasSameLayout(*pit)))
+ {
+ os << pit->params().spacing().writeEnvirEnd() << '\n';
+ texrow.newline();
+ }
+ }
+
+ // we don't need it for the last paragraph!!!
+ if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()) {
+ os << '\n';
+ texrow.newline();
+ } else {
+ // Since \selectlanguage write the language to the aux file,
+ // we need to reset the language at the end of footnote or
+ // float.
+
+ if (language->babel() != doc_language->babel()) {
+ if (lyxrc.language_command_end.empty())
+ os << subst(lyxrc.language_command_begin,
+ "$$lang",
+ doc_language->babel())
+ << endl;
+ else
+ os << subst(lyxrc.language_command_end,
+ "$$lang",
+ language->babel())
+ << endl;
+ texrow.newline();
+ }
+ }
+
+ lyxerr[Debug::LATEX] << "TeXOnePar...done " << &*boost::next(pit) << endl;
+ return ++pit;
+}
+
+} //anon namespace
+
+//
+// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
+//
+void latexParagraphs(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ostream & os,
+ TexRow & texrow,
+ OutputParams const & runparams,
+ string const & everypar)
+{
+ bool was_title = false;
+ bool already_title = false;
+ LyXTextClass const & tclass = buf.params().getLyXTextClass();
+ ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
+ ParagraphList::iterator endpar = const_cast<ParagraphList&>(paragraphs).end();
+
+ // if only_body
+ while (par != endpar) {
+ InsetOld * in = par->inInset();
+ // well we have to check if we are in an inset with unlimited
+ // length (all in one row) if that is true then we don't allow
+ // any special options in the paragraph and also we don't allow
+ // any environment other then "Standard" to be valid!
+ if (in == 0 || !in->forceDefaultParagraphs(in)) {
+ LyXLayout_ptr const & layout = par->layout();
+
+ if (layout->intitle) {
+ if (already_title) {
+ lyxerr <<"Error in latexParagraphs: You"
+ " should not mix title layouts"
+ " with normal ones." << endl;
+ } else if (!was_title) {
+ was_title = true;
+ if (tclass.titletype() == TITLE_ENVIRONMENT) {
+ os << "\\begin{"
+ << tclass.titlename()
+ << "}\n";
+ texrow.newline();
+ }
+ }
+ } else if (was_title && !already_title) {
+ if (tclass.titletype() == TITLE_ENVIRONMENT) {
+ os << "\\end{" << tclass.titlename()
+ << "}\n";
+ }
+ else {
+ os << "\\" << tclass.titlename()
+ << "\n";
+ }
+ texrow.newline();
+ already_title = true;
+ was_title = false;
+ }
+
+ if (layout->is_environment) {
+ par = TeXOnePar(buf, paragraphs, par, os, texrow,
+ runparams, everypar);
+ } else if (layout->isEnvironment() ||
+ !par->params().leftIndent().zero())
+ {
+ par = TeXEnvironment(buf, paragraphs, par, os,
+ texrow, runparams);
+ } else {
+ par = TeXOnePar(buf, paragraphs, par, os, texrow,
+ runparams, everypar);
+ }
+ } else {
+ par = TeXOnePar(buf, paragraphs, par, os, texrow,
+ runparams, everypar);
+ }
+ }
+ // It might be that we only have a title in this document
+ if (was_title && !already_title) {
+ if (tclass.titletype() == TITLE_ENVIRONMENT) {
+ os << "\\end{" << tclass.titlename()
+ << "}\n";
+ }
+ else {
+ os << "\\" << tclass.titlename()
+ << "\n";
+ }
+ texrow.newline();
+ }
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file output_latex.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef OUTPUT_LATEX_H
+#define OUTPUT_LATEX_H
+
+#include "ParagraphList_fwd.h"
+
+#include <string>
+
+class Buffer;
+class OutputParams;
+class TexRow;
+
+/// Just a wrapper for the method below, first creating the ofstream.
+
+void latexParagraphs(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ std::ostream & ofs,
+ TexRow & texrow,
+ OutputParams const &,
+ std::string const & everypar = std::string());
+
+#endif
--- /dev/null
+/**
+ * \file output_linuxdoc.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "output_linuxdoc.h"
+
+#include "buffer.h"
+#include "bufferparams.h"
+#include "paragraph.h"
+#include "paragraph_funcs.h"
+#include "ParagraphParameters.h"
+#include "sgml.h"
+
+#include <stack>
+
+#ifdef HAVE_LOCALE
+#endif
+
+using std::ostream;
+using std::stack;
+using std::vector;
+using std::string;
+
+void linuxdocParagraphs(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ ostream & os,
+ OutputParams const & runparams)
+{
+
+ Paragraph::depth_type depth = 0; // paragraph depth
+ string item_name;
+ vector<string> environment_stack(5);
+
+ ParagraphList::iterator pit = const_cast<ParagraphList&>(paragraphs).begin();
+ ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
+ for (; pit != pend; ++pit) {
+ LyXLayout_ptr const & style = pit->layout();
+ // treat <toc> as a special case for compatibility with old code
+ if (pit->isInset(0)) {
+ InsetOld * inset = pit->getInset(0);
+ InsetOld::Code lyx_code = inset->lyxCode();
+ if (lyx_code == InsetOld::TOC_CODE) {
+ string const temp = "toc";
+ sgml::openTag(os, depth, false, temp);
+ continue;
+ }
+ }
+
+ // environment tag closing
+ for (; depth > pit->params().depth(); --depth) {
+ sgml::closeTag(os, depth, false, environment_stack[depth]);
+ environment_stack[depth].erase();
+ }
+
+ // write opening SGML tags
+ switch (style->latextype) {
+ case LATEX_PARAGRAPH:
+ if (depth == pit->params().depth()
+ && !environment_stack[depth].empty()) {
+ sgml::closeTag(os, depth, false, environment_stack[depth]);
+ environment_stack[depth].erase();
+ if (depth)
+ --depth;
+ else
+ os << "</p>";
+ }
+ sgml::openTag(os, depth, false, style->latexname());
+ break;
+
+ case LATEX_COMMAND:
+ if (depth != 0)
+ //error(ErrorItem(_("Error:"), _("Wrong depth for LatexType Command.\n"), pit->id(), 0, pit->size()));
+ ;
+
+ if (!environment_stack[depth].empty()) {
+ sgml::closeTag(os, depth, false, environment_stack[depth]);
+ os << "</p>";
+ }
+
+ environment_stack[depth].erase();
+ sgml::openTag(os, depth, false, style->latexname());
+ break;
+
+ case LATEX_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_BIB_ENVIRONMENT:
+ {
+ string const & latexname = style->latexname();
+
+ if (depth == pit->params().depth()
+ && environment_stack[depth] != latexname) {
+ sgml::closeTag(os, depth, false,
+ environment_stack[depth]);
+ environment_stack[depth].erase();
+ }
+ if (depth < pit->params().depth()) {
+ depth = pit->params().depth();
+ environment_stack[depth].erase();
+ }
+ if (environment_stack[depth] != latexname) {
+ if (depth == 0) {
+ sgml::openTag(os, depth, false, "p");
+ }
+ sgml::openTag(os, depth, false, latexname);
+
+ if (environment_stack.size() == depth + 1)
+ environment_stack.push_back("!-- --");
+ environment_stack[depth] = latexname;
+ }
+
+ if (style->latexparam() == "CDATA")
+ os << "<![CDATA[";
+
+ if (style->latextype == LATEX_ENVIRONMENT) break;
+
+ if (style->labeltype == LABEL_MANUAL)
+ item_name = "tag";
+ else
+ item_name = "item";
+
+ sgml::openTag(os, depth + 1, false, item_name);
+ }
+ break;
+
+ default:
+ sgml::openTag(os, depth, false, style->latexname());
+ break;
+ }
+
+ pit->simpleLinuxDocOnePar(buf, os, outerFont(pit, paragraphs),
+ runparams, depth);
+
+ os << "\n";
+ // write closing SGML tags
+ switch (style->latextype) {
+ case LATEX_COMMAND:
+ break;
+ case LATEX_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_BIB_ENVIRONMENT:
+ if (style->latexparam() == "CDATA")
+ os << "]]>";
+ break;
+ default:
+ sgml::closeTag(os, depth, false, style->latexname());
+ break;
+ }
+ }
+
+ // Close open tags
+ for (int i = depth; i >= 0; --i)
+ sgml::closeTag(os, depth, false, environment_stack[i]);
+}
+
+
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file output_linuxdoc.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef OUTPUT_LINUXDOC_H
+#define OUTPUT_LINUXDOC_H
+
+#include "ParagraphList_fwd.h"
+
+
+class Buffer;
+class OutputParams;
+
+///
+void linuxdocParagraphs(Buffer const & buf,
+ ParagraphList const & paragraphs,
+ std::ostream & os,
+ OutputParams const & runparams);
+
+
+#endif
--- /dev/null
+/**
+ * \file output_plaintext.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "output_plaintext.h"
+
+#include "buffer.h"
+#include "bufferparams.h"
+#include "debug.h"
+#include "gettext.h"
+#include "output.h"
+#include "outputparams.h"
+#include "paragraph.h"
+#include "ParagraphParameters.h"
+
+#include "support/gzstream.h"
+#include "support/lstrings.h"
+
+#ifdef HAVE_LOCALE
+#endif
+
+using lyx::support::ascii_lowercase;
+using lyx::support::compare_ascii_no_case;
+using lyx::support::compare_no_case;
+using lyx::support::contains;
+
+using lyx::pos_type;
+using std::endl;
+using std::ostream;
+using std::ofstream;
+using std::pair;
+using std::string;
+
+
+void writeFileAscii(Buffer const & buf,
+ string const & fname,
+ OutputParams const & runparams)
+{
+ ofstream ofs;
+ if (!::openFileWrite(ofs, fname))
+ return;
+ writeFileAscii(buf, ofs, runparams);
+}
+
+
+void writeFileAscii(Buffer const & buf,
+ ostream & os,
+ OutputParams const & runparams)
+{
+ Buffer & tmp = const_cast<Buffer &>(buf);
+ ParagraphList par = const_cast<ParagraphList&>(tmp.paragraphs());
+ ParagraphList::iterator beg = par.begin();
+ ParagraphList::iterator end = par.end();
+ ParagraphList::iterator it = beg;
+ for (; it != end; ++it) {
+ asciiParagraph(buf, *it, os, runparams, it == beg);
+ }
+ os << "\n";
+}
+
+
+namespace {
+
+pair<int, string> const addDepth(int depth, int ldepth)
+{
+ int d = depth * 2;
+ if (ldepth > depth)
+ d += (ldepth - depth) * 2;
+ return make_pair(d, string(d, ' '));
+}
+
+}
+
+
+void asciiParagraph(Buffer const & buf,
+ Paragraph const & par,
+ ostream & os,
+ OutputParams const & runparams,
+ bool noparbreak)
+{
+ int ltype = 0;
+ Paragraph::depth_type ltype_depth = 0;
+ bool ref_printed = false;
+ Paragraph::depth_type depth = par.params().depth();
+
+ // First write the layout
+ string const & tmp = par.layout()->name();
+ if (compare_no_case(tmp, "itemize") == 0) {
+ ltype = 1;
+ ltype_depth = depth + 1;
+ } else if (compare_ascii_no_case(tmp, "enumerate") == 0) {
+ ltype = 2;
+ ltype_depth = depth + 1;
+ } else if (contains(ascii_lowercase(tmp), "ection")) {
+ ltype = 3;
+ ltype_depth = depth + 1;
+ } else if (contains(ascii_lowercase(tmp), "aragraph")) {
+ ltype = 4;
+ ltype_depth = depth + 1;
+ } else if (compare_ascii_no_case(tmp, "description") == 0) {
+ ltype = 5;
+ ltype_depth = depth + 1;
+ } else if (compare_ascii_no_case(tmp, "abstract") == 0) {
+ ltype = 6;
+ ltype_depth = 0;
+ } else if (compare_ascii_no_case(tmp, "bibliography") == 0) {
+ ltype = 7;
+ ltype_depth = 0;
+ } else {
+ ltype = 0;
+ ltype_depth = 0;
+ }
+
+ /* maybe some vertical spaces */
+
+ /* the labelwidthstring used in lists */
+
+ /* some lines? */
+
+ /* some pagebreaks? */
+
+ /* noindent ? */
+
+ /* what about the alignment */
+
+ // runparams.linelen <= 0 is special and means we don't have paragraph breaks
+
+ string::size_type currlinelen = 0;
+
+ if (!noparbreak) {
+ if (runparams.linelen > 0)
+ os << "\n\n";
+
+ os << string(depth * 2, ' ');
+ currlinelen += depth * 2;
+
+ //--
+ // we should probably change to the paragraph language in the
+ // gettext here (if possible) so that strings are outputted in
+ // the correct language! (20012712 Jug)
+ //--
+ switch (ltype) {
+ case 0: // Standard
+ case 4: // (Sub)Paragraph
+ case 5: // Description
+ break;
+ case 6: // Abstract
+ if (runparams.linelen > 0) {
+ os << _("Abstract") << "\n\n";
+ currlinelen = 0;
+ } else {
+ string const abst = _("Abstract: ");
+ os << abst;
+ currlinelen += abst.length();
+ }
+ break;
+ case 7: // Bibliography
+ if (!ref_printed) {
+ if (runparams.linelen > 0) {
+ os << _("References") << "\n\n";
+ currlinelen = 0;
+ } else {
+ string const refs = _("References: ");
+ os << refs;
+ currlinelen += refs.length();
+ }
+
+ ref_printed = true;
+ }
+ break;
+ default:
+ {
+ string const parlab = par.params().labelString();
+ os << parlab << ' ';
+ currlinelen += parlab.length() + 1;
+ }
+ break;
+
+ }
+ }
+
+ if (!currlinelen) {
+ pair<int, string> p = addDepth(depth, ltype_depth);
+ os << p.second;
+ currlinelen += p.first;
+ }
+
+ // this is to change the linebreak to do it by word a bit more
+ // intelligent hopefully! (only in the case where we have a
+ // max runparams.linelength!) (Jug)
+
+ string word;
+
+ for (pos_type i = 0; i < par.size(); ++i) {
+ char c = par.getUChar(buf.params(), i);
+ switch (c) {
+ case Paragraph::META_INSET:
+ {
+ InsetOld const * inset = par.getInset(i);
+ if (inset) {
+ if (runparams.linelen > 0) {
+ os << word;
+ currlinelen += word.length();
+ word.erase();
+ }
+ if (inset->plaintext(buf, os, runparams)) {
+ // to be sure it breaks paragraph
+ currlinelen += runparams.linelen;
+ }
+ }
+ }
+ break;
+
+ default:
+ if (c == ' ') {
+ if (runparams.linelen > 0 &&
+ currlinelen + word.length() > runparams.linelen - 10) {
+ os << "\n";
+ pair<int, string> p = addDepth(depth, ltype_depth);
+ os << p.second;
+ currlinelen = p.first;
+ }
+
+ os << word << ' ';
+ currlinelen += word.length() + 1;
+ word.erase();
+
+ } else {
+ if (c != '\0') {
+ word += c;
+ } else {
+ lyxerr[Debug::INFO] <<
+ "writeAsciiFile: NULL char in structure." << endl;
+ }
+ if ((runparams.linelen > 0) &&
+ (currlinelen + word.length()) > runparams.linelen)
+ {
+ os << "\n";
+
+ pair<int, string> p =
+ addDepth(depth, ltype_depth);
+ os << p.second;
+ currlinelen = p.first;
+ }
+ }
+ break;
+ }
+ }
+ os << word;
+}
+
+
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file output_plaintext.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef OUTPUT_PLAINTEXT_H
+#define OUTPUT_PLAINTEXT_H
+
+#include "ParagraphList_fwd.h"
+
+
+class Buffer;
+class OutputParams;
+
+///
+void writeFileAscii(Buffer const & buf, std::string const &, OutputParams const &);
+///
+void writeFileAscii(Buffer const & buf, std::ostream &, OutputParams const &);
+
+///
+void asciiParagraph(Buffer const & buf,
+ Paragraph const & paragraphs,
+ std::ostream & ofs,
+ OutputParams const &,
+ bool noparbreak = false);
+
+#endif
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file outputparams.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef OUTPUTPARAMS_H
+#define OUTPUTPARAMS_H
+
+struct OutputParams {
+ enum FLAVOR {
+ LATEX,
+ PDFLATEX
+ };
+
+ OutputParams() : flavor(LATEX), nice(false),
+ moving_arg(false), free_spacing(false),
+ use_babel(false), mixed_content(false),
+ linelen(0) {}
+
+ /** 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;
+
+ /** moving_arg == true means that the environment in which the inset
+ is typeset is a moving argument. The inset should take care about
+ fragile commands by preceding the latex with \protect.
+ */
+ bool moving_arg;
+
+ /** free_spacing == true means that the inset is in a free-spacing
+ paragraph.
+ */
+ bool free_spacing;
+
+ /** This var is set by the return value from BufferParams::writeLaTeX
+ */
+ bool use_babel;
+
+ /** Used for docbook to see if inside a region of mixed content.
+ In that case all the white spaces are significant and can not appear
+ at the begin or end.
+ */
+ bool mixed_content;
+
+ /** Line lenght to use with ascii export.
+ */
+ int linelen;
+};
+
+#endif // LATEXRUNPARAMS_H
#include "debug.h"
#include "gettext.h"
#include "language.h"
-#include "latexrunparams.h"
#include "lyxfont.h"
#include "lyxrc.h"
#include "lyxrow.h"
+#include "outputparams.h"
#include "paragraph_funcs.h"
#include "sgml.h"
#include "texrow.h"
BufferParams const & bparams,
LyXFont const & outerfont,
ostream & os, TexRow & texrow,
- LatexRunParams const & runparams)
+ OutputParams const & runparams)
{
lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl;
column += Changes::latexMarkChange(os, running_change, change);
running_change = change;
- LatexRunParams rp = runparams;
+ OutputParams rp = runparams;
rp.moving_arg = moving_arg;
rp.free_spacing = style->free_spacing;
pimpl_->simpleTeXSpecialChars(buf, bparams,
void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
ostream & os,
LyXFont const & outerfont,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
lyx::depth_type /*depth*/) const
{
LyXLayout_ptr const & style = layout();
ostream & os,
LyXFont const & outerfont,
int & desc_on,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
lyx::depth_type depth) const
{
bool emph_flag = false;
string const Paragraph::asString(Buffer const & buffer,
bool label) const
{
- LatexRunParams runparams;
+ OutputParams runparams;
return asString(buffer, runparams, label);
}
string const Paragraph::asString(Buffer const & buffer,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
bool label) const
{
#if 0
else if (c == META_INSET &&
getInset(i)->lyxCode() == InsetOld::MATH_CODE) {
ostringstream os;
- getInset(i)->ascii(buffer, os, runparams);
+ getInset(i)->plaintext(buffer, os, runparams);
s += subst(STRCONV(os.str()),'\n',' ');
}
}
pos_type beg, pos_type end, bool label) const
{
- LatexRunParams const runparams;
+ OutputParams const runparams;
return asString(buffer, runparams, beg, end, label);
}
string const Paragraph::asString(Buffer const & buffer,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
pos_type beg, pos_type end, bool label) const
{
ostringstream os;
if (IsPrintable(c))
os << c;
else if (c == META_INSET)
- getInset(i)->ascii(buffer, os, runparams);
+ getInset(i)->plaintext(buffer, os, runparams);
}
return os.str();
class InsetOld_code;
class Language;
class LaTeXFeatures;
-class LatexRunParams;
+class OutputParams;
class LyXFont;
class LyXFont_size;
class ParagraphParameters;
///
std::string const asString(Buffer const &,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
bool label) const;
///
std::string const asString(Buffer const &, bool label) const;
bool label) const;
///
std::string const asString(Buffer const &,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
lyx::pos_type beg,
lyx::pos_type end,
bool label) const;
///
bool simpleTeXOnePar(Buffer const &, BufferParams const &,
LyXFont const & outerfont, std::ostream &,
- TexRow & texrow, LatexRunParams const &);
+ TexRow & texrow, OutputParams const &);
///
void simpleLinuxDocOnePar(Buffer const & buf,
std::ostream & os,
LyXFont const & outerfont,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
lyx::depth_type depth) const;
///
std::ostream &,
LyXFont const & outerfont,
int & desc_on,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
lyx::depth_type depth) const;
///
#include "gettext.h"
#include "iterators.h"
#include "language.h"
-#include "latexrunparams.h"
#include "lyxlex.h"
#include "lyxrc.h"
+#include "outputparams.h"
#include "paragraph_pimpl.h"
#include "sgml.h"
#include "texrow.h"
using std::ostream;
using std::pair;
-extern string bibitemWidest(Buffer const &);
-
namespace {
}
-namespace {
-
-ParagraphList::iterator
-TeXEnvironment(Buffer const & buf,
- ParagraphList const & paragraphs,
- ParagraphList::iterator pit,
- ostream & os, TexRow & texrow,
- LatexRunParams const & runparams);
-
-ParagraphList::iterator
-TeXOnePar(Buffer const & buf,
- ParagraphList const & paragraphs,
- ParagraphList::iterator pit,
- ostream & os, TexRow & texrow,
- LatexRunParams const & runparams,
- string const & everypar = string());
-
-
-ParagraphList::iterator
-TeXDeeper(Buffer const & buf,
- ParagraphList const & paragraphs,
- ParagraphList::iterator pit,
- ostream & os, TexRow & texrow,
- LatexRunParams const & runparams)
-{
- lyxerr[Debug::LATEX] << "TeXDeeper... " << &*pit << endl;
- ParagraphList::iterator par = pit;
-
- while (par != const_cast<ParagraphList&>(paragraphs).end() &&
- par->params().depth() == pit->params().depth()) {
- if (par->layout()->isEnvironment()) {
- par = TeXEnvironment(buf, paragraphs, par,
- os, texrow, runparams);
- } else {
- par = TeXOnePar(buf, paragraphs, par,
- os, texrow, runparams);
- }
- }
- lyxerr[Debug::LATEX] << "TeXDeeper...done " << &*par << endl;
-
- return par;
-}
-
-
-ParagraphList::iterator
-TeXEnvironment(Buffer const & buf,
- ParagraphList const & paragraphs,
- ParagraphList::iterator pit,
- ostream & os, TexRow & texrow,
- LatexRunParams const & runparams)
-{
- lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
-
- BufferParams const & bparams = buf.params();
-
- LyXLayout_ptr const & style = pit->layout();
-
- Language const * language = pit->getParLanguage(bparams);
- Language const * doc_language = bparams.language;
- Language const * previous_language =
- (pit != const_cast<ParagraphList&>(paragraphs).begin())
- ? boost::prior(pit)->getParLanguage(bparams)
- : doc_language;
- if (language->babel() != previous_language->babel()) {
-
- if (!lyxrc.language_command_end.empty() &&
- previous_language->babel() != doc_language->babel()) {
- os << subst(lyxrc.language_command_end, "$$lang",
- previous_language->babel())
- << endl;
- texrow.newline();
- }
-
- if (lyxrc.language_command_end.empty() ||
- language->babel() != doc_language->babel()) {
- os << subst(lyxrc.language_command_begin, "$$lang",
- language->babel())
- << endl;
- texrow.newline();
- }
- }
-
- bool leftindent_open = false;
- if (!pit->params().leftIndent().zero()) {
- os << "\\begin{LyXParagraphLeftIndent}{" <<
- pit->params().leftIndent().asLatexString() << "}\n";
- texrow.newline();
- leftindent_open = true;
- }
-
- if (style->isEnvironment()) {
- if (style->latextype == LATEX_LIST_ENVIRONMENT) {
- os << "\\begin{" << style->latexname() << "}{"
- << pit->params().labelWidthString() << "}\n";
- } else if (style->labeltype == LABEL_BIBLIO) {
- // ale970405
- os << "\\begin{" << style->latexname() << "}{"
- << bibitemWidest(buf)
- << "}\n";
- } else if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
- os << "\\begin{" << style->latexname() << '}'
- << style->latexparam() << '\n';
- } else
- os << "\\begin{" << style->latexname() << '}'
- << style->latexparam() << '\n';
- texrow.newline();
- }
- ParagraphList::iterator par = pit;
- do {
- par = TeXOnePar(buf, paragraphs, par, os, texrow, runparams);
-
- if (par != const_cast<ParagraphList&>(paragraphs).end() && par->params().depth() > pit->params().depth()) {
- if (par->layout()->isParagraph()) {
-
- // Thinko!
- // How to handle this? (Lgb)
- //&& !suffixIs(os, "\n\n")
- //) {
- // There should be at least one '\n' already
- // but we need there to be two for Standard
- // paragraphs that are depth-increment'ed to be
- // output correctly. However, tables can
- // also be paragraphs so don't adjust them.
- // ARRae
- // Thinkee:
- // Will it ever harm to have one '\n' too
- // many? i.e. that we sometimes will have
- // three in a row. (Lgb)
- os << '\n';
- texrow.newline();
- }
- par = TeXDeeper(buf, paragraphs, par, os, texrow,
- runparams);
- }
- } while (par != const_cast<ParagraphList&>(paragraphs).end()
- && par->layout() == pit->layout()
- && par->params().depth() == pit->params().depth()
- && par->params().leftIndent() == pit->params().leftIndent());
-
- if (style->isEnvironment()) {
- os << "\\end{" << style->latexname() << "}\n";
- texrow.newline();
- }
-
- if (leftindent_open) {
- os << "\\end{LyXParagraphLeftIndent}\n";
- texrow.newline();
- }
-
- lyxerr[Debug::LATEX] << "TeXEnvironment...done " << &*par << endl;
- return par; // ale970302
-}
-
-
-InsetOptArg * optArgInset(Paragraph const & par)
-{
- // Find the entry.
- InsetList::const_iterator it = par.insetlist.begin();
- InsetList::const_iterator end = par.insetlist.end();
- for (; it != end; ++it) {
- InsetOld * ins = it->inset;
- if (ins->lyxCode() == InsetOld::OPTARG_CODE) {
- return static_cast<InsetOptArg *>(ins);
- }
- }
- return 0;
-}
-
-
-ParagraphList::iterator
-TeXOnePar(Buffer const & buf,
- ParagraphList const & paragraphs,
- ParagraphList::iterator pit,
- ostream & os, TexRow & texrow,
- LatexRunParams const & runparams,
- string const & everypar)
-{
- lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
- << everypar << "'" << endl;
- BufferParams const & bparams = buf.params();
-
- InsetOld const * in = pit->inInset();
- bool further_blank_line = false;
- LyXLayout_ptr style;
-
- // well we have to check if we are in an inset with unlimited
- // length (all in one row) if that is true then we don't allow
- // any special options in the paragraph and also we don't allow
- // any environment other then "Standard" to be valid!
- if (in == 0 || !in->forceDefaultParagraphs(in)) {
- style = pit->layout();
-
- if (pit->params().startOfAppendix()) {
- os << "\\appendix\n";
- texrow.newline();
- }
-
- if (!pit->params().spacing().isDefault()
- && (pit == const_cast<ParagraphList&>(paragraphs).begin()
- || !boost::prior(pit)->hasSameLayout(*pit)))
- {
- os << pit->params().spacing().writeEnvirBegin() << '\n';
- texrow.newline();
- }
-
- if (style->isCommand()) {
- os << '\n';
- texrow.newline();
- }
-
- if (pit->params().spaceTop().kind() != VSpace::NONE) {
- os << pit->params().spaceTop().asLatexCommand(bparams);
- further_blank_line = true;
- }
-
- if (further_blank_line) {
- os << '\n';
- texrow.newline();
- }
- } else {
- style = bparams.getLyXTextClass().defaultLayout();
- }
-
- Language const * language = pit->getParLanguage(bparams);
- Language const * doc_language = bparams.language;
- Language const * previous_language =
- (pit != const_cast<ParagraphList&>(paragraphs).begin())
- ? boost::prior(pit)->getParLanguage(bparams)
- : doc_language;
-
- if (language->babel() != previous_language->babel()
- // check if we already put language command in TeXEnvironment()
- && !(style->isEnvironment()
- && (pit == const_cast<ParagraphList&>(paragraphs).begin() ||
- (boost::prior(pit)->layout() != pit->layout() &&
- boost::prior(pit)->getDepth() <= pit->getDepth())
- || boost::prior(pit)->getDepth() < pit->getDepth())))
- {
- if (!lyxrc.language_command_end.empty() &&
- previous_language->babel() != doc_language->babel())
- {
- os << subst(lyxrc.language_command_end, "$$lang",
- previous_language->babel())
- << endl;
- texrow.newline();
- }
-
- if (lyxrc.language_command_end.empty() ||
- language->babel() != doc_language->babel())
- {
- os << subst(lyxrc.language_command_begin, "$$lang",
- language->babel())
- << endl;
- texrow.newline();
- }
- }
-
- if (bparams.inputenc == "auto" &&
- language->encoding() != previous_language->encoding()) {
- os << "\\inputencoding{"
- << language->encoding()->LatexName()
- << "}\n";
- texrow.newline();
- }
-
- switch (style->latextype) {
- case LATEX_COMMAND:
- os << '\\' << style->latexname();
-
- // Separate handling of optional argument inset.
- if (style->optionalargs == 1) {
- InsetOptArg * it = optArgInset(*pit);
- if (it)
- it->latexOptional(buf, os, runparams);
- }
- else
- os << style->latexparam();
- break;
- case LATEX_ITEM_ENVIRONMENT:
- case LATEX_LIST_ENVIRONMENT:
- os << "\\item ";
- break;
- case LATEX_BIB_ENVIRONMENT:
- // ignore this, the inset will write itself
- break;
- default:
- break;
- }
-
- os << everypar;
- bool need_par = pit->simpleTeXOnePar(buf, bparams,
- outerFont(pit, paragraphs),
- os, texrow, runparams);
-
- // Make sure that \\par is done with the font of the last
- // character if this has another size as the default.
- // This is necessary because LaTeX (and LyX on the screen)
- // calculates the space between the baselines according
- // to this font. (Matthias)
- //
- // Is this really needed ? (Dekel)
- // We do not need to use to change the font for the last paragraph
- // or for a command.
- LyXFont const outerfont(outerFont(pit, paragraphs));
-
- LyXFont const font =
- (pit->empty()
- ? pit->getLayoutFont(bparams, outerfont)
- : pit->getFont(bparams, pit->size() - 1, outerfont));
-
- bool is_command = style->isCommand();
-
- if (style->resfont.size() != font.size()
- && boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
- && !is_command) {
- if (!need_par)
- os << '{';
- os << "\\" << font.latexSize() << " \\par}";
- } else if (need_par) {
- os << "\\par}";
- } else if (is_command)
- os << '}';
-
- switch (style->latextype) {
- case LATEX_ITEM_ENVIRONMENT:
- case LATEX_LIST_ENVIRONMENT:
- if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
- && (pit->params().depth() < boost::next(pit)->params().depth())) {
- os << '\n';
- texrow.newline();
- }
- break;
- case LATEX_ENVIRONMENT: {
- // if its the last paragraph of the current environment
- // skip it otherwise fall through
- ParagraphList::iterator next = boost::next(pit);
-
- if (next != const_cast<ParagraphList&>(paragraphs).end()
- && (next->layout() != pit->layout()
- || next->params().depth() != pit->params().depth()))
- break;
- }
-
- // fall through possible
- default:
- // we don't need it for the last paragraph!!!
- if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()) {
- os << '\n';
- texrow.newline();
- }
- }
-
- if (in == 0 || !in->forceDefaultParagraphs(in)) {
- further_blank_line = false;
-
- if (pit->params().spaceBottom().kind() != VSpace::NONE) {
- os << pit->params().spaceBottom().asLatexCommand(bparams);
- further_blank_line = true;
- }
-
- if (further_blank_line) {
- os << '\n';
- texrow.newline();
- }
-
- if (!pit->params().spacing().isDefault()
- && (boost::next(pit) == const_cast<ParagraphList&>(paragraphs).end()
- || !boost::next(pit)->hasSameLayout(*pit)))
- {
- os << pit->params().spacing().writeEnvirEnd() << '\n';
- texrow.newline();
- }
- }
-
- // we don't need it for the last paragraph!!!
- if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()) {
- os << '\n';
- texrow.newline();
- } else {
- // Since \selectlanguage write the language to the aux file,
- // we need to reset the language at the end of footnote or
- // float.
-
- if (language->babel() != doc_language->babel()) {
- if (lyxrc.language_command_end.empty())
- os << subst(lyxrc.language_command_begin,
- "$$lang",
- doc_language->babel())
- << endl;
- else
- os << subst(lyxrc.language_command_end,
- "$$lang",
- language->babel())
- << endl;
- texrow.newline();
- }
- }
-
- lyxerr[Debug::LATEX] << "TeXOnePar...done " << &*boost::next(pit) << endl;
- return ++pit;
-}
-
-} // anon namespace
-
-
-//
-// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
-//
-void latexParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- ostream & os,
- TexRow & texrow,
- LatexRunParams const & runparams,
- string const & everypar)
-{
- bool was_title = false;
- bool already_title = false;
- LyXTextClass const & tclass = buf.params().getLyXTextClass();
- ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
- ParagraphList::iterator endpar = const_cast<ParagraphList&>(paragraphs).end();
-
- // if only_body
- while (par != endpar) {
- InsetOld * in = par->inInset();
- // well we have to check if we are in an inset with unlimited
- // length (all in one row) if that is true then we don't allow
- // any special options in the paragraph and also we don't allow
- // any environment other then "Standard" to be valid!
- if (in == 0 || !in->forceDefaultParagraphs(in)) {
- LyXLayout_ptr const & layout = par->layout();
-
- if (layout->intitle) {
- if (already_title) {
- lyxerr <<"Error in latexParagraphs: You"
- " should not mix title layouts"
- " with normal ones." << endl;
- } else if (!was_title) {
- was_title = true;
- if (tclass.titletype() == TITLE_ENVIRONMENT) {
- os << "\\begin{"
- << tclass.titlename()
- << "}\n";
- texrow.newline();
- }
- }
- } else if (was_title && !already_title) {
- if (tclass.titletype() == TITLE_ENVIRONMENT) {
- os << "\\end{" << tclass.titlename()
- << "}\n";
- }
- else {
- os << "\\" << tclass.titlename()
- << "\n";
- }
- texrow.newline();
- already_title = true;
- was_title = false;
- }
-
- if (layout->is_environment) {
- par = TeXOnePar(buf, paragraphs, par, os, texrow,
- runparams, everypar);
- } else if (layout->isEnvironment() ||
- !par->params().leftIndent().zero())
- {
- par = TeXEnvironment(buf, paragraphs, par, os,
- texrow, runparams);
- } else {
- par = TeXOnePar(buf, paragraphs, par, os, texrow,
- runparams, everypar);
- }
- } else {
- par = TeXOnePar(buf, paragraphs, par, os, texrow,
- runparams, everypar);
- }
- }
- // It might be that we only have a title in this document
- if (was_title && !already_title) {
- if (tclass.titletype() == TITLE_ENVIRONMENT) {
- os << "\\end{" << tclass.titlename()
- << "}\n";
- }
- else {
- os << "\\" << tclass.titlename()
- << "\n";
- }
- texrow.newline();
- }
-}
-
-
-namespace {
-
-pair<int, string> const addDepth(int depth, int ldepth)
-{
- int d = depth * 2;
- if (ldepth > depth)
- d += (ldepth - depth) * 2;
- return make_pair(d, string(d, ' '));
-}
-
-}
-
-
-void asciiParagraph(Buffer const & buf,
- Paragraph const & par,
- ostream & os,
- LatexRunParams const & runparams,
- bool noparbreak)
-{
- int ltype = 0;
- Paragraph::depth_type ltype_depth = 0;
- bool ref_printed = false;
- Paragraph::depth_type depth = par.params().depth();
-
- // First write the layout
- string const & tmp = par.layout()->name();
- if (compare_no_case(tmp, "itemize") == 0) {
- ltype = 1;
- ltype_depth = depth + 1;
- } else if (compare_ascii_no_case(tmp, "enumerate") == 0) {
- ltype = 2;
- ltype_depth = depth + 1;
- } else if (contains(ascii_lowercase(tmp), "ection")) {
- ltype = 3;
- ltype_depth = depth + 1;
- } else if (contains(ascii_lowercase(tmp), "aragraph")) {
- ltype = 4;
- ltype_depth = depth + 1;
- } else if (compare_ascii_no_case(tmp, "description") == 0) {
- ltype = 5;
- ltype_depth = depth + 1;
- } else if (compare_ascii_no_case(tmp, "abstract") == 0) {
- ltype = 6;
- ltype_depth = 0;
- } else if (compare_ascii_no_case(tmp, "bibliography") == 0) {
- ltype = 7;
- ltype_depth = 0;
- } else {
- ltype = 0;
- ltype_depth = 0;
- }
-
- /* maybe some vertical spaces */
-
- /* the labelwidthstring used in lists */
-
- /* some lines? */
-
- /* some pagebreaks? */
-
- /* noindent ? */
-
- /* what about the alignment */
-
- // runparams.linelen <= 0 is special and means we don't have paragraph breaks
-
- string::size_type currlinelen = 0;
-
- if (!noparbreak) {
- if (runparams.linelen > 0)
- os << "\n\n";
-
- os << string(depth * 2, ' ');
- currlinelen += depth * 2;
-
- //--
- // we should probably change to the paragraph language in the
- // gettext here (if possible) so that strings are outputted in
- // the correct language! (20012712 Jug)
- //--
- switch (ltype) {
- case 0: // Standard
- case 4: // (Sub)Paragraph
- case 5: // Description
- break;
- case 6: // Abstract
- if (runparams.linelen > 0) {
- os << _("Abstract") << "\n\n";
- currlinelen = 0;
- } else {
- string const abst = _("Abstract: ");
- os << abst;
- currlinelen += abst.length();
- }
- break;
- case 7: // Bibliography
- if (!ref_printed) {
- if (runparams.linelen > 0) {
- os << _("References") << "\n\n";
- currlinelen = 0;
- } else {
- string const refs = _("References: ");
- os << refs;
- currlinelen += refs.length();
- }
-
- ref_printed = true;
- }
- break;
- default:
- {
- string const parlab = par.params().labelString();
- os << parlab << ' ';
- currlinelen += parlab.length() + 1;
- }
- break;
-
- }
- }
-
- if (!currlinelen) {
- pair<int, string> p = addDepth(depth, ltype_depth);
- os << p.second;
- currlinelen += p.first;
- }
-
- // this is to change the linebreak to do it by word a bit more
- // intelligent hopefully! (only in the case where we have a
- // max runparams.linelength!) (Jug)
-
- string word;
-
- for (pos_type i = 0; i < par.size(); ++i) {
- char c = par.getUChar(buf.params(), i);
- switch (c) {
- case Paragraph::META_INSET:
- {
- InsetOld const * inset = par.getInset(i);
- if (inset) {
- if (runparams.linelen > 0) {
- os << word;
- currlinelen += word.length();
- word.erase();
- }
- if (inset->ascii(buf, os, runparams)) {
- // to be sure it breaks paragraph
- currlinelen += runparams.linelen;
- }
- }
- }
- break;
-
- default:
- if (c == ' ') {
- if (runparams.linelen > 0 &&
- currlinelen + word.length() > runparams.linelen - 10) {
- os << "\n";
- pair<int, string> p = addDepth(depth, ltype_depth);
- os << p.second;
- currlinelen = p.first;
- }
-
- os << word << ' ';
- currlinelen += word.length() + 1;
- word.erase();
-
- } else {
- if (c != '\0') {
- word += c;
- } else {
- lyxerr[Debug::INFO] <<
- "writeAsciiFile: NULL char in structure." << endl;
- }
- if ((runparams.linelen > 0) &&
- (currlinelen + word.length()) > runparams.linelen)
- {
- os << "\n";
-
- pair<int, string> p =
- addDepth(depth, ltype_depth);
- os << p.second;
- currlinelen = p.first;
- }
- }
- break;
- }
- }
- os << word;
-}
-
-
-void linuxdocParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- ostream & os,
- LatexRunParams const & runparams)
-{
-
- Paragraph::depth_type depth = 0; // paragraph depth
- string item_name;
- vector<string> environment_stack(5);
-
- ParagraphList::iterator pit = const_cast<ParagraphList&>(paragraphs).begin();
- ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
- for (; pit != pend; ++pit) {
- LyXLayout_ptr const & style = pit->layout();
- // treat <toc> as a special case for compatibility with old code
- if (pit->isInset(0)) {
- InsetOld * inset = pit->getInset(0);
- InsetOld::Code lyx_code = inset->lyxCode();
- if (lyx_code == InsetOld::TOC_CODE) {
- string const temp = "toc";
- sgml::openTag(os, depth, false, temp);
- continue;
- }
- }
-
- // environment tag closing
- for (; depth > pit->params().depth(); --depth) {
- sgml::closeTag(os, depth, false, environment_stack[depth]);
- environment_stack[depth].erase();
- }
-
- // write opening SGML tags
- switch (style->latextype) {
- case LATEX_PARAGRAPH:
- if (depth == pit->params().depth()
- && !environment_stack[depth].empty()) {
- sgml::closeTag(os, depth, false, environment_stack[depth]);
- environment_stack[depth].erase();
- if (depth)
- --depth;
- else
- os << "</p>";
- }
- sgml::openTag(os, depth, false, style->latexname());
- break;
-
- case LATEX_COMMAND:
- if (depth != 0)
- //error(ErrorItem(_("Error:"), _("Wrong depth for LatexType Command.\n"), pit->id(), 0, pit->size()));
- ;
-
- if (!environment_stack[depth].empty()) {
- sgml::closeTag(os, depth, false, environment_stack[depth]);
- os << "</p>";
- }
-
- environment_stack[depth].erase();
- sgml::openTag(os, depth, false, style->latexname());
- break;
-
- case LATEX_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- case LATEX_BIB_ENVIRONMENT:
- {
- string const & latexname = style->latexname();
-
- if (depth == pit->params().depth()
- && environment_stack[depth] != latexname) {
- sgml::closeTag(os, depth, false,
- environment_stack[depth]);
- environment_stack[depth].erase();
- }
- if (depth < pit->params().depth()) {
- depth = pit->params().depth();
- environment_stack[depth].erase();
- }
- if (environment_stack[depth] != latexname) {
- if (depth == 0) {
- sgml::openTag(os, depth, false, "p");
- }
- sgml::openTag(os, depth, false, latexname);
-
- if (environment_stack.size() == depth + 1)
- environment_stack.push_back("!-- --");
- environment_stack[depth] = latexname;
- }
-
- if (style->latexparam() == "CDATA")
- os << "<![CDATA[";
-
- if (style->latextype == LATEX_ENVIRONMENT) break;
-
- if (style->labeltype == LABEL_MANUAL)
- item_name = "tag";
- else
- item_name = "item";
-
- sgml::openTag(os, depth + 1, false, item_name);
- }
- break;
-
- default:
- sgml::openTag(os, depth, false, style->latexname());
- break;
- }
-
- pit->simpleLinuxDocOnePar(buf, os, outerFont(pit, paragraphs),
- runparams, depth);
-
- os << "\n";
- // write closing SGML tags
- switch (style->latextype) {
- case LATEX_COMMAND:
- break;
- case LATEX_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- case LATEX_BIB_ENVIRONMENT:
- if (style->latexparam() == "CDATA")
- os << "]]>";
- break;
- default:
- sgml::closeTag(os, depth, false, style->latexname());
- break;
- }
- }
-
- // Close open tags
- for (int i = depth; i >= 0; --i)
- sgml::closeTag(os, depth, false, environment_stack[i]);
-}
-
-
-void docbookParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- ostream & os,
- LatexRunParams const & runparams)
-{
- vector<string> environment_stack(10);
- vector<string> environment_inner(10);
- vector<string> command_stack(10);
-
- bool command_flag = false;
- Paragraph::depth_type command_depth = 0;
- Paragraph::depth_type command_base = 0;
- Paragraph::depth_type cmd_depth = 0;
- Paragraph::depth_type depth = 0; // paragraph depth
-
- string item_name;
- string command_name;
-
- ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
- ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
-
- for (; par != pend; ++par) {
- string sgmlparam;
- string c_depth;
- string c_params;
- int desc_on = 0; // description mode
-
- LyXLayout_ptr const & style = par->layout();
-
- // environment tag closing
- for (; depth > par->params().depth(); --depth) {
- if (!environment_inner[depth].empty())
- sgml::closeEnvTags(os, false, environment_inner[depth],
- command_depth + depth);
- sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
- environment_stack[depth].erase();
- environment_inner[depth].erase();
- }
-
- if (depth == par->params().depth()
- && environment_stack[depth] != style->latexname()
- && !environment_stack[depth].empty()) {
- sgml::closeEnvTags(os, false, environment_inner[depth],
- command_depth + depth);
- sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
-
- environment_stack[depth].erase();
- environment_inner[depth].erase();
- }
-
- // Write opening SGML tags.
- switch (style->latextype) {
- case LATEX_PARAGRAPH:
- sgml::openTag(os, depth + command_depth,
- false, style->latexname());
- break;
-
- case LATEX_COMMAND:
- if (depth != 0)
- //error(ErrorItem(_("Error"), _("Wrong depth for LatexType Command."), par->id(), 0, par->size()));
- ;
-
- command_name = style->latexname();
-
- sgmlparam = style->latexparam();
- c_params = split(sgmlparam, c_depth,'|');
-
- cmd_depth = atoi(c_depth);
-
- if (command_flag) {
- if (cmd_depth < command_base) {
- for (Paragraph::depth_type j = command_depth;
- j >= command_base; --j) {
- sgml::closeTag(os, j, false, command_stack[j]);
- os << endl;
- }
- command_depth = command_base = cmd_depth;
- } else if (cmd_depth <= command_depth) {
- for (int j = command_depth;
- j >= int(cmd_depth); --j) {
- sgml::closeTag(os, j, false, command_stack[j]);
- os << endl;
- }
- command_depth = cmd_depth;
- } else
- command_depth = cmd_depth;
- } else {
- command_depth = command_base = cmd_depth;
- command_flag = true;
- }
- if (command_stack.size() == command_depth + 1)
- command_stack.push_back(string());
- command_stack[command_depth] = command_name;
-
- // treat label as a special case for
- // more WYSIWYM handling.
- // This is a hack while paragraphs can't have
- // attributes, like id in this case.
- if (par->isInset(0)) {
- InsetOld * inset = par->getInset(0);
- InsetOld::Code lyx_code = inset->lyxCode();
- if (lyx_code == InsetOld::LABEL_CODE) {
- command_name += " id=\"";
- command_name += (static_cast<InsetCommand *>(inset))->getContents();
- command_name += '"';
- desc_on = 3;
- }
- }
-
- sgml::openTag(os, depth + command_depth, false, command_name);
-
- item_name = c_params.empty() ? "title" : c_params;
- sgml::openTag(os, depth + 1 + command_depth, false, item_name);
- break;
-
- case LATEX_ENVIRONMENT:
- case LATEX_ITEM_ENVIRONMENT:
- if (depth < par->params().depth()) {
- depth = par->params().depth();
- environment_stack[depth].erase();
- }
-
- if (environment_stack[depth] != style->latexname()) {
- if (environment_stack.size() == depth + 1) {
- environment_stack.push_back("!-- --");
- environment_inner.push_back("!-- --");
- }
- environment_stack[depth] = style->latexname();
- environment_inner[depth] = "!-- --";
- sgml::openTag(os, depth + command_depth, false, environment_stack[depth]);
- } else {
- sgml::closeEnvTags(os, false, environment_inner[depth],
- command_depth + depth);
- }
-
- if (style->latextype == LATEX_ENVIRONMENT) {
- if (!style->latexparam().empty()) {
- if (style->latexparam() == "CDATA")
- os << "<![CDATA[";
- else
- sgml::openTag(os, depth + command_depth, false, style->latexparam());
- }
- break;
- }
-
- desc_on = (style->labeltype == LABEL_MANUAL);
-
- environment_inner[depth] = desc_on ? "varlistentry" : "listitem";
- sgml::openTag(os, depth + 1 + command_depth,
- false, environment_inner[depth]);
-
- item_name = desc_on ? "term" : "para";
- sgml::openTag(os, depth + 1 + command_depth,
- false, item_name);
- break;
- default:
- sgml::openTag(os, depth + command_depth,
- false, style->latexname());
- break;
- }
-
- par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs), desc_on,
- runparams, depth + 1 + command_depth);
-
- string end_tag;
- // write closing SGML tags
- switch (style->latextype) {
- case LATEX_COMMAND:
- end_tag = c_params.empty() ? "title" : c_params;
- sgml::closeTag(os, depth + command_depth,
- false, end_tag);
- break;
- case LATEX_ENVIRONMENT:
- if (!style->latexparam().empty()) {
- if (style->latexparam() == "CDATA")
- os << "]]>";
- else
- sgml::closeTag(os, depth + command_depth, false, style->latexparam());
- }
- break;
- case LATEX_ITEM_ENVIRONMENT:
- if (desc_on == 1) break;
- end_tag = "para";
- sgml::closeTag(os, depth + 1 + command_depth, false, end_tag);
- break;
- case LATEX_PARAGRAPH:
- sgml::closeTag(os, depth + command_depth, false, style->latexname());
- break;
- default:
- sgml::closeTag(os, depth + command_depth, false, style->latexname());
- break;
- }
- }
-
- // Close open tags
- for (int d = depth; d >= 0; --d) {
- if (!environment_stack[depth].empty()) {
- sgml::closeEnvTags(os, false, environment_inner[depth],
- command_depth + depth);
- }
- }
-
- for (int j = command_depth; j >= 0 ; --j)
- if (!command_stack[j].empty()) {
- sgml::closeTag(os, j, false, command_stack[j]);
- os << endl;
- }
-}
-
namespace {
int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & token)
class Buffer;
class BufferParams;
-class TexRow;
-class LatexRunParams;
class LyXFont;
class LyXLex;
class InsetOld;
int getEndLabel(ParagraphList::iterator pit,
ParagraphList const & plist);
-
-void latexParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- std::ostream & ofs,
- TexRow & texrow,
- LatexRunParams const &,
- std::string const & everypar = std::string());
-
-///
-void asciiParagraph(Buffer const & buf,
- Paragraph const & paragraphs,
- std::ostream & ofs,
- LatexRunParams const &,
- bool noparbreak = false);
-
-void linuxdocParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- std::ostream & os,
- LatexRunParams const & runparams);
-
-void docbookParagraphs(Buffer const & buf,
- ParagraphList const & paragraphs,
- std::ostream & os,
- LatexRunParams const & runparams);
-
/// read a paragraph from a .lyx file. Returns number of unrecognised tokens
int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);
#include "encoding.h"
#include "language.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "LColor.h"
#include "lyxlength.h"
#include "lyxrc.h"
+#include "outputparams.h"
#include "texrow.h"
BufferParams const & bparams,
ostream & os,
TexRow & texrow,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
LyXFont & font,
LyXFont & running_font,
LyXFont & basefont,
os << c;
} else {
InsetOld const * inset = owner_->getInset(i);
- inset->ascii(buf, os, runparams);
+ inset->plaintext(buf, os, runparams);
}
return;
}
///
void simpleTeXSpecialChars(Buffer const &, BufferParams const &,
std::ostream &, TexRow & texrow,
- LatexRunParams const &,
+ OutputParams const &,
LyXFont & font, LyXFont & running_font,
LyXFont & basefont,
LyXFont const & outerfont,
#include "bufferparams.h"
#include "debug.h"
#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
#include "lyxlex.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "insets/insettabular.h"
int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const & buf,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
if (!is_long_tabular)
return 0;
int LyXTabular::TeXRow(ostream & os, int i, Buffer const & buf,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret = 0;
int cell = getCellNumber(i, 0);
int LyXTabular::latex(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret = 0;
int LyXTabular::linuxdoc(Buffer const & buf, ostream & os,
- const LatexRunParams & runparams) const
+ const OutputParams & runparams) const
{
os << "<tabular ca=\"";
for (int i = 0; i < columns_; ++i) {
int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret = 0;
int cell = getFirstCellInRow(row);
}
os << '>';
- LatexRunParams runp = runparams;
+ OutputParams runp = runparams;
runp.mixed_content = true;
ret += getCellInset(cell).docbook(buf, os, runp);
os << "</entry>\n";
int LyXTabular::docbook(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret = 0;
int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams,
+ OutputParams const & runparams,
int cell, int row, int column,
vector<unsigned int> const & clen,
bool onlydata) const
{
ostringstream sstr;
- int ret = getCellInset(cell).ascii(buf, sstr, runparams);
+ int ret = getCellInset(cell).plaintext(buf, sstr, runparams);
if (onlydata) {
os << sstr.str();
}
-int LyXTabular::ascii(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams,
+int LyXTabular::plaintext(Buffer const & buf, ostream & os,
+ OutputParams const & runparams,
int const depth,
bool onlydata, unsigned char delim) const
{
if (isMultiColumnReal(cell))
continue;
ostringstream sstr;
- getCellInset(cell).ascii(buf, sstr, runparams);
+ getCellInset(cell).plaintext(buf, sstr, runparams);
if (clen[j] < sstr.str().length())
clen[j] = sstr.str().length();
}
if (!isMultiColumnReal(cell) || isPartOfMultiColumn(i, j))
continue;
ostringstream sstr;
- getCellInset(cell).ascii(buf, sstr, runparams);
+ getCellInset(cell).plaintext(buf, sstr, runparams);
int len = int(sstr.str().length());
int const n = cells_in_multicolumn(cell);
for (int k = j; len > 0 && k < j + n - 1; ++k)
#include <vector>
class InsetTabular;
-class LatexRunParams;
+class OutputParams;
/* The features the text class offers for tables */
void read(Buffer const &, LyXLex &);
///
int latex(Buffer const &, std::ostream &,
- LatexRunParams const &) const;
+ OutputParams const &) const;
//
int linuxdoc(Buffer const & buf, std::ostream & os,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
int docbook(Buffer const & buf, std::ostream & os,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
- int ascii(Buffer const &, std::ostream &,
- LatexRunParams const & runparams,
+ int plaintext(Buffer const &, std::ostream &,
+ OutputParams const & runparams,
int const depth,
bool onlydata, unsigned char delim) const;
///
int TeXCellPostamble(std::ostream &, int cell) const;
///
int TeXLongtableHeaderFooter(std::ostream &, Buffer const & buf,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
bool isValidRow(int const row) const;
///
int TeXRow(std::ostream &, int const row, Buffer const & buf,
- LatexRunParams const &) const;
+ OutputParams const &) const;
///
// helper function for ASCII returns number of newlines
///
std::vector<unsigned int> const &) const;
///
int asciiPrintCell(Buffer const &, std::ostream &,
- LatexRunParams const &,
+ OutputParams const &,
int cell, int row, int column,
std::vector<unsigned int> const &,
bool onlydata) const;
/// auxiliary function for docbook
int docbookRow(Buffer const & buf, std::ostream & os, int,
- LatexRunParams const &) const;
+ OutputParams const &) const;
private:
/// renumber cells after structural changes