]> git.lyx.org Git - features.git/commitdiff
Proper implementatiom of isInToc()
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 26 Oct 2010 01:10:19 +0000 (01:10 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 26 Oct 2010 01:10:19 +0000 (01:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35846 a592a061-630c-0410-9148-cb99ea01b6c8

src/Paragraph.cpp
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetCommand.h
src/insets/InsetHyperlink.h
src/mathed/InsetMath.h

index a1a0e1b740edad051a32be4b900a1adef0bdca48..d96ddaeefea3d282cfab127f0add726f1b00e116 100644 (file)
@@ -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);
                        }
index fd1c4e5b7bc0686e1c8c8f6d31e2a54e7024e6f5..916278d96c779b44575f6ab0c0193a98d5c6a8dc 100644 (file)
@@ -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();
index 5438cbe2c5c9ed2c11fc7f71b53c91b0c0346f59..09211a0232560b326acc11e9fe79d53c47ef0cac 100644 (file)
@@ -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;
index feb6626da451f64d5176868b32961b173694be1e..04f40f66a167fd3df152cf5554921837d136e9ae 100644 (file)
@@ -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
        //@{
index 247f703ee81f0a001ff78ca136e4c59f6c51e915..fb9579caabf925b2f6b996d91de3c7507b8bd93d 100644 (file)
@@ -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);
index e043a733fbc95a4a7e013339ac7129dd3453b4eb..3d68f22d902fd601ac15c1937c5efd1a22ab2a0c 100644 (file)
@@ -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; }
 };