#include "ParagraphParameters.h"
#include "SpellChecker.h"
#include "sgml.h"
+#include "texstream.h"
#include "TextClass.h"
#include "TexRow.h"
#include "Text.h"
}
+void Paragraph::addChangesToBuffer(Buffer const & buf) const
+{
+ d->changes_.updateBuffer(buf);
+}
+
+
+bool Paragraph::isChangeUpdateRequired() const
+{
+ return d->changes_.isUpdateRequired();
+}
+
+
bool Paragraph::isDeleted(pos_type start, pos_type end) const
{
LASSERT(start >= 0 && start <= size(), return false);
break;
case '-':
os << '-';
- if (i + 1 < end_pos && text_[i+1] == '-') {
+ if (i + 1 < static_cast<pos_type>(text_.size()) &&
+ (end_pos == -1 || i + 1 < end_pos) &&
+ text_[i+1] == '-') {
// Prevent "--" becoming an endash and "---" becoming
// an emdash.
// Within \ttfamily, "--" is merged to "-" (no endash)
BufferParams const & bp = features.runparams().is_child
? buf.masterParams() : buf.params();
Font f;
- TexRow texrow;
// Using a string stream here circumvents the encoding
// switching machinery of odocstream. Therefore the
// output is wrong if this paragraph contains content
// that needs to switch encoding.
odocstringstream ods;
- otexstream os(ods, texrow);
+ otexstream os(ods, false);
if (is_command) {
os << '\\' << from_ascii(layout_->latexname());
// we have to provide all the optional arguments here, even though
}
}
string const snippet = to_utf8(ods.str());
- features.addPreambleSnippet(snippet);
+ features.addPreambleSnippet(snippet, true);
}
}
icit->inset->validate(features);
if (layout_->needprotect &&
icit->inset->lyxCode() == FOOT_CODE)
- features.require("footmisc");
+ features.require("NeedLyXFootnoteCode");
}
}
FontSpan Paragraph::fontSpan(pos_type pos) const
{
- LBUFERR(pos < size());
+ LBUFERR(pos <= size());
+
+ if (pos == size())
+ return FontSpan(pos, pos);
pos_type start = 0;
FontList::const_iterator cit = d->fontlist_.begin();
}
-/// Returns the height of the highest font in range
-FontSize Paragraph::highestFontInRange
- (pos_type startpos, pos_type endpos, FontSize def_size) const
-{
- return d->fontlist_.highestInRange(startpos, endpos, def_size);
-}
-
-
char_type Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
{
char_type c = d->text_[pos];
if (allowcust && d->endTeXParParams(bparams, os, runparams)
&& runparams.encoding != prev_encoding) {
runparams.encoding = prev_encoding;
- if (!bparams.useNonTeXFonts)
- os << setEncoding(prev_encoding->iconvName());
+ os << setEncoding(prev_encoding->iconvName());
}
LYXERR(Debug::LATEX, "Paragraph::latex... done " << this);
docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
XHTMLStream & xs,
OutputParams const & runparams,
- Font const & outerfont,
+ Font const & outerfont,
+ bool start_paragraph, bool close_paragraph,
pos_type initial) const
{
docstring retval;
Layout const & style = *d->layout_;
- xs.startParagraph(allowEmpty());
+ if (start_paragraph)
+ xs.startDivision(allowEmpty());
FontInfo font_old =
style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
if (!runparams.for_toc || inset->isInToc()) {
OutputParams np = runparams;
np.local_font = &font;
- if (!inset->getLayout().htmlisblock())
+ // If the paragraph has size 1, then we are in the "special
+ // case" where we do not output the containing paragraph info
+ if (!inset->getLayout().htmlisblock() && size() != 1)
np.html_in_par = true;
retval += inset->xhtml(xs, np);
}
font_old = font.fontInfo();
}
+ // FIXME XHTML
+ // I'm worried about what happens if a branch, say, is itself
+ // wrapped in some font stuff. I think that will not work.
xs.closeFontTags();
- xs.endParagraph();
+ if (close_paragraph)
+ xs.endDivision();
+
return retval;
}
char_type const c = d->text_[i];
if (isPrintable(c))
os += c;
- else if (c == '\t' || c == '\n')
- os += ' ';
else if (c == META_INSET)
getInset(i)->forOutliner(os, tmplen, false);
}