#include "ParIterator.h"
#include "sgml.h"
#include "TexRow.h"
+#include "TexStream.h"
#include "TocBackend.h"
#include "Undo.h"
#include "version.h"
if (!openFileWrite(ofs, fname))
return false;
+ //TexStream ts(ofs.rdbuf(), &texrow());
+
bool failed_export = false;
try {
writeLaTeXSource(ofs, original_path,
OTHERLIBS = $(BOOST_LIBS) $(INTLLIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOCKET_LIBS)
+AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
+
pkglib_LTLIBRARIES = liblyxcore.la
noinst_PROGRAMS = $(FRONTENDS_PROGS)
EXTRA_PROGRAMS = lyx-qt4
SpellBase.h \
TexRow.cpp \
TexRow.h \
+ TexStream.cpp \
+ TexStream.h \
Text.h \
Text.cpp \
Text2.cpp \
insets/InsetTheorem.cpp \
insets/InsetTheorem.h
-AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
-
liblyxinsets_la_SOURCES = \
insets/MailInset.cpp \
insets/MailInset.h \
namespace lyx {
-/// Represents the correspondence between paragraphs and the generated LaTeX file
+/// Represents the correspondence between paragraphs and the generated
+//LaTeX file
+
class TexRow {
public:
///
{}
/// paragraph id
- int id() const {
- return id_;
- }
-
+ int id() const { return id_; }
/// set paragraph position
- void pos(int p) {
- pos_ = p;
- }
-
+ void pos(int p) { pos_ = p; }
/// paragraph position
- int pos() const {
- return pos_;
- }
-
+ int pos() const { return pos_; }
/// row number
- int rownumber() const {
- return rownumber_;
- }
+ int rownumber() const { return rownumber_; }
private:
RowItem();
int id_;
-#include "LaTeXStream.h"
+#include "TexStream.h"
+#include "TexRow.h"
#include <iostream>
#include <streambuf>
////////////////////////////////////////////////////////////////
//
-// LaTeXStreamBuffer
+// TexStreamBuffer
//
////////////////////////////////////////////////////////////////
-class LaTeXStreamBuffer : public std::streambuf
+class TexStreamBuffer : public TexStreamBase
{
public:
- explicit LaTeXStreamBuffer(std::streambuf * sbuf);
+ TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow);
int line() const { return line_; }
+ int column() const { return column_; }
protected:
int overflow(int);
int sync();
private:
- std::streambuf * sbuf_;
+ TexStreamBase * sbuf_;
+ TexRow * texrow_;
+ int column_;
int line_;
};
-LaTeXStreamBuffer::LaTeXStreamBuffer(std::streambuf *sb)
- : sbuf_(sb), line_(0)
+TexStreamBuffer::TexStreamBuffer(TexStreamBase *sb, TexRow * texrow)
+ : sbuf_(sb), texrow_(texrow), line_(0)
{
setp(0, 0);
setg(0, 0, 0);
}
-int LaTeXStreamBuffer::overflow(int c)
+int TexStreamBuffer::overflow(int c)
{
- if (c == '\n')
+ if (c == '\n') {
++line_;
+ column_ = 0;
+ } else {
+ ++column_;
+ }
return c;
}
-int LaTeXStreamBuffer::sync()
+int TexStreamBuffer::sync()
{
sbuf_->pubsync();
return 0;
////////////////////////////////////////////////////////////////
//
-// LaTeXStream
+// TexStream
//
////////////////////////////////////////////////////////////////
-LaTeXStream::LaTeXStream(std::streambuf * sbuf)
- : std::ostream(sbuf_ = new LaTeXStreamBuffer(sbuf))
+TexStream::TexStream(TexStreamBase * sbuf, TexRow * texrow)
+ : std::basic_ostream<char_type>(sbuf_ = new TexStreamBuffer(sbuf, texrow))
{}
-LaTeXStream::~LaTeXStream()
+TexStream::~TexStream()
{
delete sbuf_;
}
-int LaTeXStream::line() const
+int TexStream::line() const
{
return sbuf_->line();
}
int main(int argc, char *argv[])
{
- LaTeXStream out(std::cout.rdbuf());
+ TexStream out(std::cout.rdbuf());
char c;
while (std::cin) {
if (std::cin.get(c))
#ifndef LATEXSTREAM_H
#define LATEXSTREAM_H
+#include "support/docstring.h"
+
+#include "TexRow.h"
+
#include <iostream>
#include <streambuf>
namespace lyx {
-class LaTeXStreamBuffer;
+class TexStreamBuffer;
+class TexRow;
-class LaTeXStream : public std::ostream
+typedef std::basic_streambuf<char_type> TexStreamBase;
+
+class TexStream : public std::basic_ostream<char_type>
{
public:
- LaTeXStream(std::streambuf * sbuf);
- ~LaTeXStream();
+ TexStream(TexStreamBase * sbuf, TexRow * texrow);
+ ~TexStream();
int line() const;
+
private:
- LaTeXStreamBuffer * sbuf_;
+ TexStreamBuffer * sbuf_;
};
} // namespace lyx