Proper implementatiom of isInToc()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35846 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-26 01:10:19 +00:00
parent 2e42a7b645
commit 8693ae474b
6 changed files with 15 additions and 9 deletions

View File

@ -2725,13 +2725,9 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
Inset const * inset = getInset(i); Inset const * inset = getInset(i);
if (inset) { if (inset) {
InsetCommand const * ic = inset->asInsetCommand(); if (!runparams.for_toc || inset->isInToc()) {
InsetLayout const & il = inset->getLayout();
InsetMath const * im = inset->asInsetMath();
if (!runparams.for_toc
|| im || il.isInToc() || (ic && ic->isInToc())) {
OutputParams np = runparams; OutputParams np = runparams;
if (!il.htmlisblock()) if (!inset->getLayout().htmlisblock())
np.html_in_par = true; np.html_in_par = true;
retval += inset->xhtml(xs, np); retval += inset->xhtml(xs, np);
} }

View File

@ -234,12 +234,19 @@ bool Inset::allowEmpty() const
return getLayout().isKeepEmpty(); return getLayout().isKeepEmpty();
} }
bool Inset::forceLTR() const bool Inset::forceLTR() const
{ {
return getLayout().forceLTR(); return getLayout().forceLTR();
} }
bool Inset::isInToc() const
{
return getLayout().isInToc();
}
docstring Inset::toolTip(BufferView const &, int, int) const docstring Inset::toolTip(BufferView const &, int, int) const
{ {
return docstring(); return docstring();

View File

@ -226,6 +226,8 @@ public:
virtual bool allowEmpty() const; virtual bool allowEmpty() const;
/// Force inset into LTR environment if surroundings are RTL /// Force inset into LTR environment if surroundings are RTL
virtual bool forceLTR() const; virtual bool forceLTR() const;
/// whether to include this inset in the strings generated for the TOC
virtual bool isInToc() const;
/// Where should we go when we press the up or down cursor key? /// Where should we go when we press the up or down cursor key?
virtual bool idxUpDown(Cursor & cur, bool up) const; virtual bool idxUpDown(Cursor & cur, bool up) const;

View File

@ -63,8 +63,6 @@ public:
void setParam(std::string const & name, docstring const & value); void setParam(std::string const & name, docstring const & value);
/// FIXME Remove /// FIXME Remove
docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); } docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
/// whether to include this inset in the strings generated for the TOC
virtual bool isInToc() const { return false; }
/// \name Methods inherited from Inset class /// \name Methods inherited from Inset class
//@{ //@{

View File

@ -54,11 +54,12 @@ public:
/// Force inset into LTR environment if surroundings are RTL /// Force inset into LTR environment if surroundings are RTL
bool forceLTR() const { return true; } bool forceLTR() const { return true; }
/// ///
virtual bool isInToc() const { return true; } bool isInToc() const { return true; }
/// ///
docstring contextMenu(BufferView const & bv, int x, int y) const; docstring contextMenu(BufferView const & bv, int x, int y) const;
/// ///
docstring toolTip(BufferView const & bv, int x, int y) const; docstring toolTip(BufferView const & bv, int x, int y) const;
private: private:
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);

View File

@ -216,6 +216,8 @@ public:
/// superscript kerning /// superscript kerning
virtual int kerning(BufferView const *) const { return 0; } virtual int kerning(BufferView const *) const { return 0; }
/// ///
bool isInToc() const { return true; }
///
InsetCode lyxCode() const { return MATH_CODE; } InsetCode lyxCode() const { return MATH_CODE; }
}; };