#include "buffer_funcs.h"
#include "bufferlist.h"
#include "bufferparams.h"
+#include "counters.h"
#include "Bullet.h"
#include "Chktex.h"
#include "debug.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"
+#include "PosIterator.h"
#include "sgml.h"
#include "texrow.h"
#include "undo.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.
ofs << "<!-- DocBook file was created by LyX " << lyx_version
<< "\n See http://www.lyx.org/ for more information -->\n";
+ params().getLyXTextClass().counters().reset();
docbookParagraphs(*this, paragraphs(), ofs, runparams);
ofs << "\n\n";
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);
}
-InsetOld * Buffer::getInsetFromID(int id_arg) const
-{
- for (inset_iterator it = inset_const_iterator_begin();
- it != inset_const_iterator_end(); ++it)
- {
- if (it->id() == id_arg)
- return &(*it);
- InsetOld * in = it->getInsetFromID(id_arg);
- if (in)
- return in;
- }
- return 0;
-}
-
-
ParIterator Buffer::getParFromID(int id) const
{
#warning FIXME: const correctness! (Andre)
}
+PosIterator Buffer::pos_iterator_begin()
+{
+ return PosIterator(¶graphs(), paragraphs().begin(), 0);
+}
+
+
+PosIterator Buffer::pos_iterator_end()
+{
+ return PosIterator(¶graphs(), paragraphs().end(), 0);
+}
+
+
ParIterator Buffer::par_iterator_begin()
{
return ParIterator(paragraphs().begin(), paragraphs());