2006-10-11 19:40:50 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file docstream.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Georg Baum
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LYX_DOCSTREAM_H
|
|
|
|
#define LYX_DOCSTREAM_H
|
|
|
|
|
2011-02-10 20:02:48 +00:00
|
|
|
#include "TexRow.h"
|
2006-10-11 19:40:50 +00:00
|
|
|
#include "support/docstring.h"
|
|
|
|
|
2010-04-22 14:28:52 +00:00
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
|
|
|
// Ugly workaround for MSVC10 STL bug:
|
|
|
|
// std::numpunct has a hardcoded dllimport in definition, but we wanna it with 32 bit
|
|
|
|
// so we can't import it and must define it but then the compiler complains.
|
|
|
|
#include "support/numpunct_lyx_char_type.h"
|
|
|
|
#endif
|
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2006-10-26 15:01:45 +00:00
|
|
|
class iconv_codecvt_facet_exception : public std::exception {
|
|
|
|
public:
|
|
|
|
virtual ~iconv_codecvt_facet_exception() throw() {}
|
|
|
|
virtual const char * what() const throw();
|
|
|
|
};
|
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
/// Base class for UCS4 input streams
|
|
|
|
typedef std::basic_istream<char_type> idocstream;
|
|
|
|
|
|
|
|
/** Base class for UCS4 output streams.
|
|
|
|
If you want to output a single UCS4 character, use \code
|
|
|
|
os.put(c);
|
|
|
|
\endcode, not \code
|
|
|
|
os << c;
|
|
|
|
\endcode . The latter will not output the character, but the code point
|
2011-04-11 20:11:27 +00:00
|
|
|
as number if USE_WCHAR_T is not defined. This is because we can't overload
|
|
|
|
operator<< (our character type is not always a real type but sometimes a
|
|
|
|
typedef). Narrow characters of type char can be output as usual.
|
2006-10-11 19:40:50 +00:00
|
|
|
*/
|
|
|
|
typedef std::basic_ostream<char_type> odocstream;
|
|
|
|
|
|
|
|
/// File stream for reading UTF8-encoded files with automatic conversion to
|
|
|
|
/// UCS4.
|
2008-11-16 12:21:29 +00:00
|
|
|
class ifdocstream : public std::basic_ifstream<char_type> {
|
2006-10-11 19:40:50 +00:00
|
|
|
typedef std::basic_ifstream<char_type> base;
|
|
|
|
public:
|
2009-04-20 15:40:01 +00:00
|
|
|
ifdocstream();
|
2008-11-16 12:21:29 +00:00
|
|
|
explicit ifdocstream(const char* s,
|
2006-12-15 16:09:05 +00:00
|
|
|
std::ios_base::openmode mode = std::ios_base::in,
|
|
|
|
std::string const & encoding = "UTF-8");
|
2008-11-16 12:21:29 +00:00
|
|
|
~ifdocstream() {}
|
2006-10-11 19:40:50 +00:00
|
|
|
};
|
|
|
|
|
2006-10-26 15:01:45 +00:00
|
|
|
/// File stream for writing files in 8bit encoding \p encoding with automatic
|
|
|
|
/// conversion from UCS4.
|
2010-04-22 11:16:58 +00:00
|
|
|
|
2008-11-16 12:21:29 +00:00
|
|
|
class ofdocstream : public std::basic_ofstream<char_type> {
|
2006-10-11 19:40:50 +00:00
|
|
|
typedef std::basic_ofstream<char_type> base;
|
|
|
|
public:
|
2008-11-16 12:21:29 +00:00
|
|
|
ofdocstream();
|
|
|
|
explicit ofdocstream(const char* s,
|
2006-10-26 15:01:45 +00:00
|
|
|
std::ios_base::openmode mode = std::ios_base::out|std::ios_base::trunc,
|
|
|
|
std::string const & encoding = "UTF-8");
|
2008-11-16 12:21:29 +00:00
|
|
|
~ofdocstream() {}
|
2007-12-05 13:56:53 +00:00
|
|
|
///
|
|
|
|
void reset(std::string const & encoding);
|
2006-10-11 19:40:50 +00:00
|
|
|
};
|
|
|
|
|
2010-04-22 11:16:58 +00:00
|
|
|
|
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
/// UCS4 input stringstream
|
|
|
|
typedef std::basic_istringstream<char_type> idocstringstream;
|
|
|
|
|
2011-02-14 17:09:39 +00:00
|
|
|
/// UCS4 output manipulator
|
|
|
|
typedef odocstream & (*odocstream_manip)(odocstream &);
|
|
|
|
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
/** Wrapper class for odocstream.
|
2011-02-10 20:02:48 +00:00
|
|
|
This class is used to automatically count the lines of the exported latex
|
|
|
|
code and also to ensure that no blank lines may be inadvertently output.
|
|
|
|
To this end, use the special variables "breakln" and "safebreakln" as if
|
|
|
|
they were iomanip's to ensure that the next output will start at the
|
|
|
|
beginning of a line. Using "breakln", a '\n' char will be output if needed,
|
|
|
|
while using "safebreakln", "%\n" will be output if needed.
|
2011-08-05 11:23:00 +00:00
|
|
|
The class also records the last output character.
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class otexstream {
|
|
|
|
public:
|
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
otexstream(odocstream & os, TexRow & texrow)
|
|
|
|
: os_(os), texrow_(texrow),
|
2011-08-05 11:23:00 +00:00
|
|
|
canbreakline_(false), protectspace_(false), lastchar_(0) {}
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
///
|
|
|
|
odocstream & os() { return os_; }
|
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
TexRow & texrow() { return texrow_; }
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void put(char_type const & c);
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
///
|
|
|
|
void canBreakLine(bool breakline) { canbreakline_ = breakline; }
|
|
|
|
///
|
|
|
|
bool canBreakLine() const { return canbreakline_; }
|
|
|
|
///
|
|
|
|
void protectSpace(bool protectspace) { protectspace_ = protectspace; }
|
|
|
|
///
|
2011-01-29 19:44:53 +00:00
|
|
|
bool protectSpace() const { return protectspace_; }
|
2011-08-05 11:23:00 +00:00
|
|
|
///
|
|
|
|
void lastChar(char_type const & c) { lastchar_ = c; }
|
|
|
|
///
|
|
|
|
char_type lastChar() const { return lastchar_; }
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
odocstream & os_;
|
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
TexRow & texrow_;
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
///
|
|
|
|
bool canbreakline_;
|
|
|
|
///
|
|
|
|
bool protectspace_;
|
2011-08-05 11:23:00 +00:00
|
|
|
///
|
|
|
|
char_type lastchar_;
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Helper structs for breaking a line
|
|
|
|
struct BreakLine {
|
|
|
|
char n;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SafeBreakLine {
|
|
|
|
char n;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern BreakLine breakln;
|
|
|
|
extern SafeBreakLine safebreakln;
|
|
|
|
|
|
|
|
///
|
|
|
|
otexstream & operator<<(otexstream &, BreakLine);
|
|
|
|
///
|
|
|
|
otexstream & operator<<(otexstream &, SafeBreakLine);
|
|
|
|
///
|
2011-02-14 17:09:39 +00:00
|
|
|
otexstream & operator<<(otexstream &, odocstream_manip);
|
|
|
|
///
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
otexstream & operator<<(otexstream &, docstring const &);
|
|
|
|
///
|
2011-10-22 15:10:43 +00:00
|
|
|
otexstream & operator<<(otexstream &, std::string const &);
|
|
|
|
///
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
otexstream & operator<<(otexstream &, char const *);
|
|
|
|
///
|
|
|
|
otexstream & operator<<(otexstream &, char);
|
|
|
|
///
|
2011-01-29 19:44:53 +00:00
|
|
|
template <typename Type>
|
|
|
|
otexstream & operator<<(otexstream & ots, Type value);
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
|
2007-01-09 19:25:40 +00:00
|
|
|
/// Helper struct for changing stream encoding
|
|
|
|
struct SetEnc {
|
|
|
|
SetEnc(std::string const & e) : encoding(e) {}
|
|
|
|
std::string encoding;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Helper function for changing stream encoding
|
|
|
|
SetEnc setEncoding(std::string const & encoding);
|
|
|
|
|
|
|
|
/** Change the encoding of \p os to \p e.encoding.
|
|
|
|
\p e.encoding must be a valid iconv name of an 8bit encoding.
|
|
|
|
This does nothing if the stream is not a file stream, since only
|
|
|
|
file streams do have an associated 8bit encoding.
|
|
|
|
Usage: \code
|
|
|
|
os << setEncoding("ISO-8859-1");
|
|
|
|
\endcode
|
|
|
|
*/
|
|
|
|
odocstream & operator<<(odocstream & os, SetEnc e);
|
2008-11-16 19:25:26 +00:00
|
|
|
idocstream & operator<<(idocstream & os, SetEnc e);
|
2007-01-09 19:25:40 +00:00
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
}
|
2006-10-19 21:00:33 +00:00
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
#endif
|