mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
* src/output_plaintext.C: check line length before outputting
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
This commit is contained in:
parent
018cb4905e
commit
1baa28f2bc
@ -201,6 +201,8 @@ public:
|
||||
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
|
||||
|
@ -80,6 +80,17 @@ int InsetFoot::latex(Buffer const & buf, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -31,8 +31,11 @@ public:
|
||||
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:
|
||||
|
@ -52,8 +52,8 @@ docstring const InsetHFill::getScreenLabel(Buffer const &) const
|
||||
int InsetHFill::plaintext(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\t';
|
||||
return 0;
|
||||
os << " ";
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,10 +30,10 @@ public:
|
||||
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
|
||||
|
@ -198,18 +198,24 @@ void writePlaintextParagraph(Buffer const & buf,
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user