* src/insets/insetbox.[Ch]:

* src/insets/insetnote.[Ch]: fix plaintext()


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17207 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2007-02-15 22:59:06 +00:00
parent 5caa8e2c6d
commit 2ca15c641a
4 changed files with 47 additions and 48 deletions

View File

@ -389,13 +389,6 @@ int InsetBox::latex(Buffer const & buf, odocstream & os,
}
int InsetBox::docbook(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
return InsetText::docbook(buf, os, runparams);
}
int InsetBox::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
@ -403,25 +396,33 @@ int InsetBox::plaintext(Buffer const & buf, odocstream & os,
switch (btype) {
case Frameless: break;
case Boxed: os << "["; break;
case ovalbox: os << "("; break;
case Ovalbox: os << "(("; break;
case Shadowbox: os << "["; break;
case Doublebox: os << "[["; break;
case Boxed: os << "[\n"; break;
case ovalbox: os << "(\n"; break;
case Ovalbox: os << "((\n"; break;
case Shadowbox: os << "[/\n"; break;
case Doublebox: os << "[[\n"; break;
}
int i = InsetText::plaintext(buf, os, runparams);
InsetText::plaintext(buf, os, runparams);
int len = 0;
switch (btype) {
case Frameless: break;
case Boxed: os << "]"; break;
case ovalbox: os << ")"; break;
case Ovalbox: os << "))"; break;
case Shadowbox: os << "]/"; break;
case Doublebox: os << "]]"; break;
case Boxed: os << "\n]"; len = 1; break;
case ovalbox: os << "\n)"; len = 1; break;
case Ovalbox: os << "\n))"; len = 2; break;
case Shadowbox: os << "\n/]"; len = 2; break;
case Doublebox: os << "\n]]"; len = 2; break;
}
return i;
return len + runparams.linelen; // len chars on a separate line
}
int InsetBox::docbook(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
return InsetText::docbook(buf, os, runparams);
}

View File

@ -86,10 +86,9 @@ public:
///
int latex(Buffer const &, odocstream &, OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &, OutputParams const &) const;
int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
OutputParams const & runparams) const;
int docbook(Buffer const &, odocstream &, OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
///

View File

@ -295,6 +295,26 @@ int InsetNote::latex(Buffer const & buf, odocstream & os,
}
int InsetNote::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams_in) const
{
if (params_.type == InsetNoteParams::Note)
return 0;
OutputParams runparams(runparams_in);
if (params_.type == InsetNoteParams::Comment) {
runparams.inComment = true;
// Ignore files that are exported inside a comment
runparams.exportdata.reset(new ExportData);
}
os << '[' << _("note") << ":\n";
InsetText::plaintext(buf, os, runparams);
os << "\n]";
return 1 + runparams.linelen; // one char on a separate line
}
int InsetNote::docbook(Buffer const & buf, odocstream & os,
OutputParams const & runparams_in) const
{
@ -320,27 +340,6 @@ int InsetNote::docbook(Buffer const & buf, odocstream & os,
}
int InsetNote::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams_in) const
{
if (params_.type == InsetNoteParams::Note)
return 0;
OutputParams runparams(runparams_in);
if (params_.type == InsetNoteParams::Comment) {
runparams.inComment = true;
// Ignore files that are exported inside a comment
runparams.exportdata.reset(new ExportData);
}
os << "[";
int const nlines = InsetText::plaintext(buf, os, runparams);
os << "]";
// Return how many newlines we issued.
return nlines;
}
void InsetNote::validate(LaTeXFeatures & features) const
{
if (params_.type == InsetNoteParams::Comment)

View File

@ -62,10 +62,10 @@ public:
///
int latex(Buffer const &, odocstream &, OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &, OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
///
int docbook(Buffer const &, odocstream &, OutputParams const &) const;
///
void validate(LaTeXFeatures &) const;
///
InsetNoteParams const & params() const { return params_; }