a word in front of an inset; make sensible use of plaintext()
return value (IMHO totally broken before)
* insets/insetfoot.[Ch]: add plaintext()
* insets/insethfill.[Ch]: adjust plaintext(); make the
number of characters determinitic; minor header cleanup
* insets/insetbase.h: add comment on return value
of plaintext() - before its meaning was unclear
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17200
a592a061-630c-0410-9148-
cb99ea01b6c8
virtual void infoize2(odocstream &) const {}
/// plain text output in ucs4 encoding
+ /// return the number of characters, in case of multiple lines of
+ /// output, add runparams.linelen to the number of chars in the last line
virtual int plaintext(Buffer const &, odocstream &,
OutputParams const &) const;
/// docbook output
}
+int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
+{
+ os << '[' << _("footnote") << ":\n";
+ InsetText::plaintext(buf, os, runparams);
+ os << "\n]";
+
+ return 1 + runparams.linelen; // one char on a separate line
+}
+
+
int InsetFoot::docbook(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
int latex(Buffer const &, odocstream &,
OutputParams const &) const;
///
+ int plaintext(Buffer const &, odocstream &,
+ OutputParams const &) const;
+ ///
int docbook(Buffer const &, odocstream &,
- OutputParams const & runparams) const;
+ OutputParams const &) const;
///
virtual docstring const editMessage() const;
protected:
int InsetHFill::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
- os << '\t';
- return 0;
+ os << " ";
+ return 5;
}
InsetBase::Code lyxCode() const { return InsetBase::HFILL_CODE; }
///
int plaintext(Buffer const &, odocstream &,
- OutputParams const & runparams) const;
+ OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &,
- OutputParams const & runparams) const;
+ OutputParams const &) const;
///
void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset
char_type c = par.getUChar(buf.params(), i);
switch (c) {
case Paragraph::META_INSET: {
- InsetBase const * inset = par.getInset(i);
-
+ if (runparams.linelen > 0 &&
+ currlinelen + word.length() > runparams.linelen) {
+ os << '\n';
+ pair<int, docstring> p = addDepth(depth, ltype_depth);
+ os << p.second;
+ currlinelen = p.first;
+ }
os << word;
currlinelen += word.length();
word.erase();
OutputParams rp = runparams;
rp.depth = par.params().depth();
- if (inset->plaintext(buf, os, rp)) {
- // to be sure it breaks paragraph
- currlinelen += runparams.linelen;
- }
+ int len = par.getInset(i)->plaintext(buf, os, rp);
+ if (len >= runparams.linelen)
+ currlinelen = len - runparams.linelen;
+ else
+ currlinelen += len;
break;
}