bool failed_export = false;
try {
+ texrow().reset();
writeLaTeXSource(ofs, original_path,
runparams, output_preamble, output_body);
}
validate(features);
LYXERR(Debug::LATEX) << " Buffer validation done." << endl;
- texrow().reset();
-
// The starting paragraph of the coming rows is the
// first paragraph of the document. (Asger)
- texrow().start(paragraphs().begin()->id(), 0);
-
if (output_preamble && runparams.nice) {
os << "%% LyX " << lyx_version << " created this file. "
"For more info, see http://www.lyx.org/.\n"
os << "\\begin{document}\n";
texrow().newline();
} // output_preamble
+
+ texrow().start(paragraphs().begin()->id(), 0);
+
LYXERR(Debug::INFO) << "preamble finished, now the body." << endl;
if (!lyxrc.language_auto_begin &&
// No side effect of file copying and image conversion
runparams.dryrun = true;
+ texrow().reset();
if (full_source) {
os << "% " << _("Preview source code") << "\n\n";
+ texrow().newline();
+ texrow().newline();
if (isLatex())
writeLaTeXSource(os, filePath(), runparams, true, true);
else {
convert<docstring>(par_begin),
convert<docstring>(par_end - 1))
<< "\n\n";
+ texrow().newline();
+ texrow().newline();
// output paragraphs
if (isLatex()) {
- texrow().reset();
latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
} else {
// DocBook
#include "BufferView.h"
#include "Buffer.h"
#include "Cursor.h"
+#include "TexRow.h"
#include <sstream>
using std::string;
}
+std::pair<int, int> ControlViewSource::getRows() const
+{
+ BufferView const * view = kernel().bufferview();
+ CursorSlice beg = view->cursor().selectionBegin().bottom();
+ CursorSlice end = view->cursor().selectionEnd().bottom();
+
+ int begrow = view->buffer()->texrow().
+ getRowFromIdPos(beg.paragraph().id(), beg.pos());
+ int endrow = view->buffer()->texrow().
+ getRowFromIdPos(end.paragraph().id(), end.pos() + 1);
+ return std::make_pair(begrow, endrow);
+}
+
+
void ControlViewSource::clearParams()
{
}
if (autoUpdateCB->isChecked())
form_->update(viewFullSourceCB->isChecked());
+ int beg, end;
+ boost::tie(beg, end) = form_->getRows();
+ QTextCursor c = QTextCursor(viewSourceTV->document());
+ c.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor, beg);
+ c.select(QTextCursor::BlockUnderCursor);
+ c.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor, end - beg + 1);
+ viewSourceTV->setTextCursor(c);
QWidget::update();
}