#include <locale>
#endif
-#include <boost/tuple/tuple.hpp>
-
#ifdef __GNUG__
#pragma implementation
#endif
#include "converter.h"
#include "BufferView.h"
#include "ParagraphParameters.h"
+#include "iterators.h"
using std::ostream;
using std::ofstream;
++pos;
space_inserted = true;
} else {
- const Paragraph::value_type nb = 8 - pos % 8;
+ const Paragraph::size_type nb = 8 - pos % 8;
for (Paragraph::size_type a = 0;
a < nb ; ++a) {
par->insertChar(pos, ' ', font);
// The top of the file should not be written by params.
// write out a comment in the top of the file
- ofs << '#' << LYX_DOCVERSION
+ ofs << '#' << lyx_docversion
<< " created this file. For more info see http://www.lyx.org/\n"
<< "\\lyxformat " << LYX_FORMAT << "\n";
Paragraph::depth_type depth = 0;
int ltype = 0;
Paragraph::depth_type ltype_depth = 0;
- unsigned int currlinelen = 0;
+ string::size_type currlinelen = 0;
bool ref_printed = false;
int noparbreak = 0;
case Paragraph::META_HFILL:
buffer << "\t";
break;
-
- case '\\':
- buffer << "\\";
- break;
-
+
default:
if ((linelen > 0) && (currlinelen > (linelen - 10)) &&
(c == ' ') && ((i + 2) < par->size()))
buffer << " ";
currlinelen += (ltype_depth-depth)*2;
}
- } else if (c != '\0')
+ } else if (c != '\0') {
buffer << c;
- else if (c == '\0')
+ ++currlinelen;
+ } else
lyxerr[Debug::INFO] << "writeAsciiFile: NULL char in structure." << endl;
- ++currlinelen;
break;
}
}
texrow.start(paragraph, 0);
if (!only_body && nice) {
- ofs << "%% " LYX_DOCVERSION " created this file. "
+ ofs << "%% " << lyx_docversion << " created this file. "
"For more info, see http://www.lyx.org/.\n"
"%% Do not edit unless you really know what "
"you are doing.\n";
texrow.newline();
}
- // We try to load babel late, in case it interferes
- // with other packages.
- if (use_babel) {
- string tmp = lyxrc.language_package;
- if (!lyxrc.language_global_options
- && tmp == "\\usepackage{babel}")
- tmp = string("\\usepackage[") +
- language_options.str().c_str() +
- "]{babel}";
- ofs << tmp << "\n";
- texrow.newline();
- }
-
if (params.secnumdepth != tclass.secnumdepth()) {
ofs << "\\setcounter{secnumdepth}{"
<< params.secnumdepth
ofs << preamble;
+ // We try to load babel late, in case it interferes
+ // with other packages.
+ if (use_babel) {
+ string tmp = lyxrc.language_package;
+ if (!lyxrc.language_global_options
+ && tmp == "\\usepackage{babel}")
+ tmp = string("\\usepackage[") +
+ language_options.str().c_str() +
+ "]{babel}";
+ ofs << tmp << "\n";
+ texrow.newline();
+ }
+
// make the body.
ofs << "\\begin{document}\n";
texrow.newline();
}
}
- ofs << "<!-- " << LYX_DOCVERSION
+ ofs << "<!-- " << lyx_docversion
<< " created this file. For more info see http://www.lyx.org/"
<< " -->\n";
}
-void Buffer::docBookHandleCaption(ostream & os, string & inner_tag,
+void Buffer::docbookHandleCaption(ostream & os, string & inner_tag,
Paragraph::depth_type depth, int desc_on,
Paragraph * & par)
{
}
sgmlOpenTag(ofs, 0, top);
- ofs << "<!-- DocBook file was created by " << LYX_DOCVERSION
+ ofs << "<!-- DocBook file was created by " << lyx_docversion
<< "\n See http://www.lyx.org/ for more information -->\n";
vector<string> environment_stack(10);
if (c == Paragraph::META_INSET) {
Inset * inset = par->getInset(i);
ostringstream ost;
- inset->docBook(this, ost);
+ inset->docbook(this, ost);
string tmp_out = ost.str().c_str();
//
}
} else {
string sgml_string;
- if (par->linuxDocConvertChar(c, sgml_string)
- && !style.free_spacing) { // in freespacing
- // mode, spaces are
- // non-breaking characters
- // char is ' '
- if (desc_on == 1) {
- ++char_line_count;
- os << "\n</term><listitem><para>";
- desc_on = 2;
- } else {
- os << c;
- }
+ par->linuxDocConvertChar(c, sgml_string);
+
+ if (style.pass_thru) {
+ os << c;
+ } else if(style.free_spacing || c != ' ') {
+ os << sgml_string;
+ } else if (desc_on ==1) {
+ ++char_line_count;
+ os << "\n</term><listitem><para>";
+ desc_on = 2;
} else {
- os << sgml_string;
+ os << ' ';
}
}
font_old = font;
{
Lists l;
Paragraph * par = paragraph;
+
+#if 1
+ std::pair<bool, LyXTextClassList::size_type> const tmp =
+ textclasslist.NumberOfLayout(params.textclass, "Caption");
+ bool const found = tmp.first;
+ LyXTextClassList::size_type const cap = tmp.second;
+
+#else
+ // This is the prefered way to to this, but boost::tie can break
+ // some compilers
bool found;
LyXTextClassList::size_type cap;
boost::tie(found, cap) = textclasslist
.NumberOfLayout(params.textclass, "Caption");
+#endif
while (par) {
char const labeltype =
void Buffer::changeLanguage(Language const * from, Language const * to)
{
- Paragraph * par = paragraph;
- while (par) {
- par->changeLanguage(params, from, to);
- par = par->next();
- }
+ ParIterator end = par_iterator_end();
+ for (ParIterator it = par_iterator_begin(); it != end; ++it)
+ (*it)->changeLanguage(params, from, to);
}
bool Buffer::isMultiLingual()
{
- Paragraph * par = paragraph;
- while (par) {
- if (par->isMultiLingual(params))
+ ParIterator end = par_iterator_end();
+ for (ParIterator it = par_iterator_begin(); it != end; ++it)
+ if ((*it)->isMultiLingual(params))
return true;
- par = par->next();
- }
+
return false;
}
}
return 0;
}
+
+
+ParIterator Buffer::par_iterator_begin()
+{
+ return ParIterator(paragraph);
+}
+
+
+ParIterator Buffer::par_iterator_end()
+{
+ return ParIterator();
+}