#include "buffer.h"
#include "bufferparams.h"
+#include "counters.h"
#include "encoding.h"
#include "debug.h"
#include "gettext.h"
#include "insets/insetoptarg.h"
#include "support/lstrings.h"
-#include "support/textutils.h"
#include "support/std_sstream.h"
+#include "support/textutils.h"
+#include "support/tostr.h"
#include <boost/tuple/tuple.hpp>
+#include <boost/bind.hpp>
#include <list>
#include <stack>
}
-bool Paragraph::checkInsertChar(LyXFont & font)
+bool Paragraph::checkInsertChar(LyXFont &)
{
- if (pimpl_->inset_owner)
- return pimpl_->inset_owner->checkInsertChar(font);
return true;
}
bool Paragraph::hasSameLayout(Paragraph const & par) const
{
- return
- par.layout() == layout() &&
- params().sameLayout(par.params());
+ return par.layout() == layout() && params().sameLayout(par.params());
}
layout(new_layout);
params().labelWidthString(string());
params().align(LYX_ALIGN_LAYOUT);
- params().spaceTop(VSpace(VSpace::NONE));
- params().spaceBottom(VSpace(VSpace::NONE));
params().spacing(Spacing(Spacing::Default));
}
InsetBibitem * Paragraph::bibitem() const
{
- InsetList::const_iterator it = insetlist.begin();
- if (it != insetlist.end() && it->inset->lyxCode() == InsetOld::BIBTEX_CODE)
- return static_cast<InsetBibitem *>(it->inset);
+ if (!insetlist.empty()) {
+ InsetOld * inset = insetlist.begin()->inset;
+ if (inset->lyxCode() == InsetOld::BIBTEX_CODE)
+ return static_cast<InsetBibitem *>(inset);
+ }
return 0;
}
namespace {
-/* paragraphs inside floats need different alignment tags to avoid
-unwanted space */
+// paragraphs inside floats need different alignment tags to avoid
+// unwanted space
bool noTrivlistCentering(UpdatableInset const * inset)
{
char c = getChar(i);
+
if (c == Paragraph::META_INSET) {
- InsetOld const * inset = getInset(i);
- inset->linuxdoc(buf, os, runparams);
+ getInset(i)->linuxdoc(buf, os, runparams);
font_old = font;
continue;
}
if (ws && !isFreeSpacing()) {
// in freespacing mode, spaces are
// non-breaking characters
- if (desc_on) {// if char is ' ' then...
-
+ if (desc_on) { // if char is ' ' then...
++char_line_count;
sgmlLineBreak(os, char_line_count, 6);
os << "</tag>";
void Paragraph::simpleDocBookOnePar(Buffer const & buf,
ostream & os,
LyXFont const & outerfont,
- int & desc_on,
OutputParams const & runparams,
- lyx::depth_type depth) const
+ lyx::depth_type depth,
+ bool labelid) const
{
bool emph_flag = false;
LyXLayout_ptr const & style = layout();
+ LyXLayout_ptr const & defaultstyle =
+ buf.params().getLyXTextClass().defaultLayout();
- LyXFont font_old = (style->labeltype == LABEL_MANUAL ? style->labelfont : style->font);
+ LyXFont font_old =
+ style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
int char_line_count = depth;
- //if (!style.free_spacing)
- // os << string(depth,' ');
+ bool label_closed = true;
+ bool para_closed = true;
+
+ if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
+ string ls = "";
+ Counters & counters = buf.params().getLyXTextClass().counters();
+ if (!style->free_spacing)
+ os << string(depth,' ');
+ if (!style->labeltag().empty()) {
+ os << "<" << style->labeltag() << ">\n";
+ label_closed = false;
+ } else {
+ if (!defaultstyle->latexparam().empty()) {
+ counters.step("para");
+ ls = tostr(counters.value("para"));
+ ls = " id=\""
+ + subst(defaultstyle->latexparam(), "#", ls) + '"';
+ }
+ os << "<" << style->itemtag() << ">\n"
+ << string(depth, ' ') << "<"
+ << defaultstyle->latexname() << ls << ">\n";
+ para_closed = false;
+ }
+ }
// parsing main loop
for (pos_type i = 0; i < size(); ++i) {
if (isInset(i)) {
InsetOld const * inset = getInset(i);
// don't print the inset in position 0 if desc_on == 3 (label)
- if (i || desc_on != 3) {
+ //if (i || desc_on != 3) {
+ if (!labelid) {
if (style->latexparam() == "CDATA")
os << "]]>";
inset->docbook(buf, os, runparams);
os << c;
} else if (isFreeSpacing() || c != ' ') {
os << str;
- } else if (desc_on == 1) {
+ } else if (!style->labeltag().empty() && !label_closed) {
++char_line_count;
- os << "\n</term><listitem><para>";
- desc_on = 2;
+ os << "\n</" << style->labeltag() << "><"
+ << style->itemtag() << "><"
+ << defaultstyle->latexname() << ">";
+ label_closed = true;
+ para_closed = false;
} else {
os << ' ';
}
}
// resets description flag correctly
- if (desc_on == 1) {
+ if (!label_closed) {
// <term> not closed...
- os << "</term>\n<listitem><para> </para>";
+ os << "</" << style->labeltag() << ">\n<"
+ << style->itemtag() << "><"
+ << defaultstyle->latexname() << "> ";
+ }
+ if (!para_closed) {
+ os << "\n" << string(depth, ' ') << "</"
+ << defaultstyle->latexname() << ">\n";
}
if (style->free_spacing)
os << '\n';