From: Vincent van Ravesteijn Date: Tue, 26 Oct 2010 01:10:19 +0000 (+0000) Subject: Proper implementatiom of isInToc() X-Git-Tag: 2.0.0~2240 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8693ae474be667e88dba1e53a5a1130ff440e756;p=features.git Proper implementatiom of isInToc() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35846 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index a1a0e1b740..d96ddaeefe 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2725,13 +2725,9 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf, Inset const * inset = getInset(i); if (inset) { - InsetCommand const * ic = inset->asInsetCommand(); - InsetLayout const & il = inset->getLayout(); - InsetMath const * im = inset->asInsetMath(); - if (!runparams.for_toc - || im || il.isInToc() || (ic && ic->isInToc())) { + if (!runparams.for_toc || inset->isInToc()) { OutputParams np = runparams; - if (!il.htmlisblock()) + if (!inset->getLayout().htmlisblock()) np.html_in_par = true; retval += inset->xhtml(xs, np); } diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index fd1c4e5b7b..916278d96c 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -234,12 +234,19 @@ bool Inset::allowEmpty() const return getLayout().isKeepEmpty(); } + bool Inset::forceLTR() const { return getLayout().forceLTR(); } +bool Inset::isInToc() const +{ + return getLayout().isInToc(); +} + + docstring Inset::toolTip(BufferView const &, int, int) const { return docstring(); diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 5438cbe2c5..09211a0232 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -226,6 +226,8 @@ public: virtual bool allowEmpty() const; /// Force inset into LTR environment if surroundings are RTL 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? virtual bool idxUpDown(Cursor & cur, bool up) const; diff --git a/src/insets/InsetCommand.h b/src/insets/InsetCommand.h index feb6626da4..04f40f66a1 100644 --- a/src/insets/InsetCommand.h +++ b/src/insets/InsetCommand.h @@ -63,8 +63,6 @@ public: void setParam(std::string const & name, docstring const & value); /// FIXME Remove 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 //@{ diff --git a/src/insets/InsetHyperlink.h b/src/insets/InsetHyperlink.h index 247f703ee8..fb9579caab 100644 --- a/src/insets/InsetHyperlink.h +++ b/src/insets/InsetHyperlink.h @@ -54,11 +54,12 @@ public: /// Force inset into LTR environment if surroundings are RTL 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 toolTip(BufferView const & bv, int x, int y) const; + private: /// void doDispatch(Cursor & cur, FuncRequest & cmd); diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h index e043a733fb..3d68f22d90 100644 --- a/src/mathed/InsetMath.h +++ b/src/mathed/InsetMath.h @@ -216,6 +216,8 @@ public: /// superscript kerning virtual int kerning(BufferView const *) const { return 0; } /// + bool isInToc() const { return true; } + /// InsetCode lyxCode() const { return MATH_CODE; } };