]> git.lyx.org Git - features.git/commitdiff
Add a member to TocItem that tells us whether the item in question
authorRichard Heck <rgheck@lyx.org>
Fri, 8 Mar 2013 21:18:26 +0000 (16:18 -0500)
committerRichard Heck <rgheck@lyx.org>
Fri, 8 Mar 2013 21:38:18 +0000 (16:38 -0500)
is included in output.

36 files changed:
src/Buffer.cpp
src/Changes.cpp
src/Changes.h
src/Paragraph.cpp
src/Paragraph.h
src/TocBackend.cpp
src/TocBackend.h
src/insets/Inset.h
src/insets/InsetBranch.cpp
src/insets/InsetBranch.h
src/insets/InsetCaption.cpp
src/insets/InsetCaption.h
src/insets/InsetCitation.cpp
src/insets/InsetCitation.h
src/insets/InsetFoot.cpp
src/insets/InsetFoot.h
src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h
src/insets/InsetInclude.cpp
src/insets/InsetInclude.h
src/insets/InsetIndex.cpp
src/insets/InsetIndex.h
src/insets/InsetLabel.cpp
src/insets/InsetLabel.h
src/insets/InsetMarginal.cpp
src/insets/InsetMarginal.h
src/insets/InsetNote.cpp
src/insets/InsetNote.h
src/insets/InsetRef.cpp
src/insets/InsetRef.h
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h
src/insets/InsetText.cpp
src/insets/InsetText.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index 2379f49b4ab9a6d629eadd4d762c69aa0fe409f1..b646cf6619982519c34ed52c32bc455f61b34445 100644 (file)
@@ -4256,7 +4256,7 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
 
        d->bibinfo_cache_valid_ = true;
        d->cite_labels_valid_ = true;
-       cbuf.tocBackend().update();
+       cbuf.tocBackend().update(true);
        if (scope == UpdateMaster)
                cbuf.structureChanged();
 }
index 29095f9b7932e3527d14ff477d63f6e6ce3f5919..d24df403ccf07f478d54792b71cc781aac711466 100644 (file)
@@ -459,7 +459,8 @@ void Changes::checkAuthors(AuthorList const & authorList)
 }
 
 
-void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer) const
+void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer,
+        bool output_active) const
 {
        if (table_.empty())
                return;
@@ -481,8 +482,7 @@ void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer) const
                        break;
                case Change::INSERTED:
                        // 0x270d is the hand writting symbol in the Dingbats unicode group.
-                       str.push_back(0x270d);
-                       break;
+                       str.push_back(0x270d); break;
                }
                dit.pos() = it->range.start;
                Paragraph const & par = dit.paragraph();
@@ -493,8 +493,8 @@ void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer) const
                docstring const & author = author_list.get(it->change.author).name();
                Toc::iterator it = change_list.item(0, author);
                if (it == change_list.end()) {
-                       change_list.push_back(TocItem(dit, 0, author));
-                       change_list.push_back(TocItem(dit, 1, str,
+                       change_list.push_back(TocItem(dit, 0, author, output_active));
+                       change_list.push_back(TocItem(dit, 1, str, output_active,
                                support::wrapParas(str, 4)));
                        continue;
                }
@@ -502,7 +502,7 @@ void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer) const
                        if (it->depth() == 0 && it->str() != author)
                                break;
                }
-               change_list.insert(it, TocItem(dit, 1, str,
+               change_list.insert(it, TocItem(dit, 1, str, output_active,
                        support::wrapParas(str, 4)));
        }
 }
index 84c4fea707e67d684287cb6e83cd36d3e0d368b4..9219edc6539dcd26c6588f916ffa1618671d8267 100644 (file)
@@ -115,7 +115,8 @@ public:
        void checkAuthors(AuthorList const & authorList);
 
        ///
-       void addToToc(DocIterator const & cdit, Buffer const & buffer) const;
+       void addToToc(DocIterator const & cdit, Buffer const & buffer,
+               bool output_active) const;
 
 private:
        class Range {
index f039a71ed291304bcf049f1fac2119c2f189776d..3ed382a23ea96912bb6cf6c04f604a39efc7be70 100644 (file)
@@ -585,9 +585,9 @@ Paragraph::Private::Private(Private const & p, Paragraph * owner,
 
 
 void Paragraph::addChangesToToc(DocIterator const & cdit,
-       Buffer const & buf) const
+       Buffer const & buf, bool output_active) const
 {
-       d->changes_.addToToc(cdit, buf);
+       d->changes_.addToToc(cdit, buf, output_active);
 }
 
 
index 0ea959fd544804779b3589392da91b8bb86109ea..dc461790ee9936740342b0cb4eca4759da98df54 100644 (file)
@@ -154,7 +154,8 @@ public:
        void setId(int id);
 
        ///
-       void addChangesToToc(DocIterator const & cdit, Buffer const & buf) const;
+       void addChangesToToc(DocIterator const & cdit, Buffer const & buf,
+               bool output_active) const;
        ///
        Language const * getParLanguage(BufferParams const &) const;
        ///
index 0b9f6b60e83f0861f394908d828c462c7a7d3003..c8bf4adf4853a96911596e1f1b042e416fd0d37e 100644 (file)
@@ -45,7 +45,8 @@ namespace lyx {
 ///////////////////////////////////////////////////////////////////////////
 
 TocItem::TocItem(DocIterator const & dit, int d, docstring const & s,
-       docstring const & t) : dit_(dit), depth_(d), str_(s), tooltip_(t)
+       bool output_active, docstring const & t) :
+  dit_(dit), depth_(d), str_(s), tooltip_(t), output_(output_active)
 {
 }
 
@@ -166,12 +167,12 @@ bool TocBackend::updateItem(DocIterator const & dit)
 }
 
 
-void TocBackend::update()
+void TocBackend::update(bool output_active)
 {
        tocs_.clear();
        if (!buffer_->isInternal()) {
                DocIterator dit;
-               buffer_->inset().addToToc(dit);
+               buffer_->inset().addToToc(dit, output_active);
        }
 }
 
index f3bd1e88234ea941f37483c3280eecbd78e2e395..bc7a414745e71d2154c42f16fba4d4c271f46959 100644 (file)
@@ -43,6 +43,7 @@ public:
        TocItem(DocIterator const & dit,
                int depth,
                docstring const & s,
+         bool output_active,
                docstring const & t = docstring()
                );
        ///
@@ -59,6 +60,8 @@ public:
        docstring const asString() const;
        ///
        DocIterator const & dit() const;
+       ///
+       bool isOutput() const { return output_; }
 
        /// the action corresponding to the goTo above
        FuncRequest action() const;
@@ -66,15 +69,14 @@ public:
 protected:
        /// Current position of item.
        DocIterator dit_;
-
        /// nesting depth
        int depth_;
-
        /// Full item string
        docstring str_;
-
        /// The tooltip string
        docstring tooltip_;
+       /// Is this item in a note, inactive branch, etc?
+       bool output_;
 };
 
 
@@ -109,7 +111,7 @@ public:
        ///
        void setBuffer(Buffer const * buffer) { buffer_ = buffer; }
        ///
-       void update();
+       void update(bool output_active);
        /// \return true if the item was updated.
        bool updateItem(DocIterator const & pit);
 
index a79ce38ac2ed54d164ab81c743403abc208fd8f3..36a0f929d8b38c445e0d7fb5b0ca3dd274c566bc 100644 (file)
@@ -496,7 +496,7 @@ public:
        /// Add an entry to the TocList
        /// Pass a DocIterator that points at the paragraph containing
        /// the inset
-       virtual void addToToc(DocIterator const &) const {}
+       virtual void addToToc(DocIterator const & /* di */, bool /* output_active */) const {}
        /// Collect BibTeX information
        virtual void collectBibKeys(InsetIterator const &) const {}
        /// Update the counters of this inset and of its contents.
index 11774a390b0e73cbd4957412439b0e03dca7c997..2676d93338855498c7ae18d5f2ef114068537119 100644 (file)
@@ -348,7 +348,7 @@ void InsetBranch::string2params(string const & in, InsetBranchParams & params)
 }
 
 
-void InsetBranch::addToToc(DocIterator const & cpit) const
+void InsetBranch::addToToc(DocIterator const & cpit, bool output_active) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetBranch &>(*this)));
@@ -356,9 +356,10 @@ void InsetBranch::addToToc(DocIterator const & cpit) const
        Toc & toc = buffer().tocBackend().toc("branch");
        docstring str = params_.branch + ": ";
        text().forToc(str, TOC_ENTRY_LENGTH);
-       toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+       toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
        // Proceed with the rest of the inset.
-       InsetCollapsable::addToToc(cpit);
+       bool const doing_output = output_active && isBranchSelected();
+       InsetCollapsable::addToToc(cpit, doing_output);
 }
 
 
index f64f616b40ee4ebb805a1db0dbf22b93d0142bd3..7521fbe0c2245ea28409dcd046cdf7c55a95b3a7 100644 (file)
@@ -82,7 +82,7 @@ private:
        ///
        std::string contextMenuName() const;
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        InsetBranchParams const & params() const { return params_; }
        ///
index 764e940a130b1a0d10438be66dc04b3c827c39c6..6891d6387ef87874946336a178255c86a9355513 100644 (file)
@@ -97,7 +97,7 @@ void InsetCaption::setCustomLabel(docstring const & label)
 }
 
 
-void InsetCaption::addToToc(DocIterator const & cpit) const
+void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const
 {
        if (floattype_.empty())
                return;
@@ -108,10 +108,10 @@ void InsetCaption::addToToc(DocIterator const & cpit) const
        Toc & toc = buffer().tocBackend().toc(floattype_);
        docstring str = full_label_;
        text().forToc(str, TOC_ENTRY_LENGTH);
-       toc.push_back(TocItem(pit, 0, str));
+       toc.push_back(TocItem(pit, 0, str, output_active));
 
        // Proceed with the rest of the inset.
-       InsetText::addToToc(cpit);
+       InsetText::addToToc(cpit, output_active);
 }
 
 
index 58822435cd46a8bd15488dd767fbaad650baf464..37566ca67829e6479e966fed4599cb85be63f305 100644 (file)
@@ -80,7 +80,7 @@ private:
        ///
        void setCustomLabel(docstring const & label);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        /// 
        virtual bool forcePlainLayout(idx_type = 0) const { return true; }
        /// Captions don't accept alignment, spacing, etc.
index 743bda69cbe178f6e7d95ec3803c4c8902a09a9e..b21ae6ae39c9855b14d5da76015d4a804e9f5f56 100644 (file)
@@ -330,7 +330,7 @@ void InsetCitation::updateBuffer(ParIterator const &, UpdateType)
 }
 
 
-void InsetCitation::addToToc(DocIterator const & cpit) const
+void InsetCitation::addToToc(DocIterator const & cpit, bool output_active) const
 {
        // NOTE
        // XHTML output uses the TOC to collect the citations
@@ -338,7 +338,7 @@ void InsetCitation::addToToc(DocIterator const & cpit) const
        // will need to change how the citations are collected.
        docstring const tocitem = getParam("key");
        Toc & toc = buffer().tocBackend().toc("citation");
-       toc.push_back(TocItem(cpit, 0, tocitem));
+       toc.push_back(TocItem(cpit, 0, tocitem, output_active));
 }
 
 
index 0bd048ebfb5ec0351ac030e9fb9c058c7289aad2..53f42da8cc6ec4e92c0b89fd1aba6e0a455838ab 100644 (file)
@@ -67,7 +67,7 @@ public:
        ///
        void updateBuffer(ParIterator const & it, UpdateType);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        std::string contextMenuName() const;
        //@}
index a7139f92136ed0e00efe2a8cfd7416f1a8867366..e48d67cb0869c5406468f7d993e123b476267e59 100644 (file)
@@ -61,7 +61,7 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype)
 }
 
 
-void InsetFoot::addToToc(DocIterator const & cpit) const
+void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetFoot &>(*this)));
@@ -69,9 +69,9 @@ void InsetFoot::addToToc(DocIterator const & cpit) const
        Toc & toc = buffer().tocBackend().toc("footnote");
        docstring str = custom_label_ + ": ";
        text().forToc(str, TOC_ENTRY_LENGTH);
-       toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+       toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
        // Proceed with the rest of the inset.
-       InsetFootlike::addToToc(cpit);
+       InsetFootlike::addToToc(cpit, output_active);
 }
 
 
index 6106fcd3524ed3d01f5e3cdb5b4f638fb4339e4f..f308b142e6cb244ab9170a6d9dd1f9ff6f8559fe 100644 (file)
@@ -41,7 +41,7 @@ private:
        /// Update the counters of this inset and of its contents
        void updateBuffer(ParIterator const &, UpdateType);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
index eec663e30bdbcadfa52d88b4af2b5ba9e8310ce6..2aec82fbf55269b0d7d083983fef508698b528f8 100644 (file)
@@ -1047,13 +1047,13 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p) const
 }
 
 
-void InsetGraphics::addToToc(DocIterator const & cpit) const
+void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active) const
 {
        TocBackend & backend = buffer().tocBackend();
 
        //FIXME UNICODE
        docstring const str = from_utf8(params_.filename.onlyFileName());
-       backend.toc("graphics").push_back(TocItem(cpit, 0, str));
+       backend.toc("graphics").push_back(TocItem(cpit, 0, str, output_active));
 }
 
 
index d8ad8f8c713f5dd5868a9e0716d47797efd11350..a6e6ce33815ac60734a28b20f4405d1f316f0353 100644 (file)
@@ -97,7 +97,7 @@ private:
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        std::string contextMenuName() const;
        /// Force inset into LTR environment if surroundings are RTL
index 2bf3ae722fb1a9c9e5496dd558558c155245cdf2..70050fd5bcfe8968cbf57d7bf7774df419d1224e 100644 (file)
@@ -1090,13 +1090,13 @@ void InsetInclude::addPreview(DocIterator const & /*inset_pos*/,
 }
 
 
-void InsetInclude::addToToc(DocIterator const & cpit) const
+void InsetInclude::addToToc(DocIterator const & cpit, bool output_active) const
 {
        TocBackend & backend = buffer().tocBackend();
 
        if (isListings(params())) {
                if (label_)
-                       label_->addToToc(cpit);
+                       label_->addToToc(cpit, output_active);
 
                InsetListingsParams p(to_utf8(params()["lstparams"]));
                string caption = p.getParamValue("caption");
@@ -1106,7 +1106,7 @@ void InsetInclude::addToToc(DocIterator const & cpit) const
                docstring str = convert<docstring>(toc.size() + 1)
                        + ". " +  from_utf8(caption);
                DocIterator pit = cpit;
-               toc.push_back(TocItem(pit, 0, str));
+               toc.push_back(TocItem(pit, 0, str, output_active));
                return;
        }
        Buffer const * const childbuffer = getChildBuffer();
@@ -1115,10 +1115,10 @@ void InsetInclude::addToToc(DocIterator const & cpit) const
 
        Toc & toc = backend.toc("child");
        docstring str = childbuffer->fileName().displayName();
-       toc.push_back(TocItem(cpit, 0, str));
+       toc.push_back(TocItem(cpit, 0, str, output_active));
 
        TocList & toclist = backend.tocs();
-       childbuffer->tocBackend().update();
+       childbuffer->tocBackend().update(output_active);
        TocList const & childtoclist = childbuffer->tocBackend().tocs();
        TocList::const_iterator it = childtoclist.begin();
        TocList::const_iterator const end = childtoclist.end();
index cbc2db02e7fb7f601e1cfd2810fc8aa8b1220c06..3e283462690a54b62fc7f7c6f26c90dbf6dc3d82 100644 (file)
@@ -102,7 +102,7 @@ public:
        ///
        void addPreview(DocIterator const &, graphics::PreviewLoader &) const;
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        void updateBuffer(ParIterator const &, UpdateType);
        ///
index c754ac0e67071dcc75287f212811ddc42e5d234b..0d2230d5bde08bc4663c3da9a6795899156c28bb 100644 (file)
@@ -347,15 +347,15 @@ void InsetIndex::string2params(string const & in, InsetIndexParams & params)
 }
 
 
-void InsetIndex::addToToc(DocIterator const & cpit) const
+void InsetIndex::addToToc(DocIterator const & cpit, bool output_active) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this)));
        docstring str;
        text().forToc(str, 0);
-       buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str));
+       buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str, output_active));
        // Proceed with the rest of the inset.
-       InsetCollapsable::addToToc(cpit);
+       InsetCollapsable::addToToc(cpit, output_active);
 }
 
 
index 42d67615b907e2535c254bdf7dd873a188a18694..a980a4278143b75fa63966044ac88f87374d7413 100644 (file)
@@ -71,7 +71,7 @@ private:
        /// should paragraph indendation be omitted in any case?
        bool neverIndent() const { return true; }
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
index 557548d84daa807ae50f1d6cbdb7ce4694c65320..c2ef896b866f53ef6aaab7fa1f8655362b0826ed 100644 (file)
@@ -169,15 +169,15 @@ void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype)
 }
 
 
-void InsetLabel::addToToc(DocIterator const & cpit) const
+void InsetLabel::addToToc(DocIterator const & cpit, bool output_active) const
 {
        docstring const & label = getParam("name");
        Toc & toc = buffer().tocBackend().toc("label");
        if (buffer().insetLabel(label) != this) {
-               toc.push_back(TocItem(cpit, 0, screen_label_));
+               toc.push_back(TocItem(cpit, 0, screen_label_, output_active));
                return;
        }
-       toc.push_back(TocItem(cpit, 0, screen_label_));
+       toc.push_back(TocItem(cpit, 0, screen_label_, output_active));
        Buffer::References const & refs = buffer().references(label);
        Buffer::References::const_iterator it = refs.begin();
        Buffer::References::const_iterator end = refs.end();
@@ -185,10 +185,12 @@ void InsetLabel::addToToc(DocIterator const & cpit) const
                DocIterator const ref_pit(it->second);
                if (it->first->lyxCode() == MATH_REF_CODE)
                        toc.push_back(TocItem(ref_pit, 1,
-                               it->first->asInsetMath()->asRefInset()->screenLabel()));
+                               it->first->asInsetMath()->asRefInset()->screenLabel(),
+                               output_active));
                else
                        toc.push_back(TocItem(ref_pit, 1,
-                               static_cast<InsetRef *>(it->first)->screenLabel()));
+                               static_cast<InsetRef *>(it->first)->screenLabel(),
+                         output_active));
        }
 }
 
index c28ef1c0b5aff53cd81656ca8c586a2bcadf566a..3c9bbd05f6b25257c855bbf60fc2ff30cd0d6752 100644 (file)
@@ -57,7 +57,7 @@ public:
        ///
        void updateBuffer(ParIterator const & it, UpdateType);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        //@}
 
        /// \name Static public methods obligated for InsetCommand derived classes
index d7ec180de5b80551d11f91a506f59ca3feaff4a0..9543e8f52749ebe27b1c5e1701cf04a3bde59c4a 100644 (file)
@@ -51,7 +51,7 @@ int InsetMarginal::docbook(odocstream & os,
 }
 
 
-void InsetMarginal::addToToc(DocIterator const & cpit) const
+void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
@@ -59,9 +59,9 @@ void InsetMarginal::addToToc(DocIterator const & cpit) const
        Toc & toc = buffer().tocBackend().toc("marginalnote");
        docstring str;
        text().forToc(str, TOC_ENTRY_LENGTH);
-       toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+       toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
        // Proceed with the rest of the inset.
-       InsetFootlike::addToToc(cpit);
+       InsetFootlike::addToToc(cpit, output_active);
 }
 
 } // namespace lyx
index 8f7c89a52a31fe23f81d5810e80506451abc6f8e..38e1a9c50a067590c3f53ebfe10c726acb9cda7c 100644 (file)
@@ -36,7 +36,7 @@ public:
        ///
        int docbook(odocstream &, OutputParams const & runparams) const;
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
 private:
        ///
        Inset * clone() const { return new InsetMarginal(*this); }
index ea1299720d495c9e63a41d86f66597e2b06cdf73..19f6035e0738e54b7007954109597f49ec6c497e 100644 (file)
@@ -195,18 +195,20 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetNote::addToToc(DocIterator const & cpit) const
+void InsetNote::addToToc(DocIterator const & cpit, bool output_active) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetNote &>(*this)));
-
+       
        Toc & toc = buffer().tocBackend().toc("note");
        InsetLayout const & il = getLayout();
        docstring str = translateIfPossible(il.labelstring()) + from_ascii(": ");
        text().forToc(str, TOC_ENTRY_LENGTH);
-       toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+       toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
+
        // Proceed with the rest of the inset.
-       InsetCollapsable::addToToc(cpit);
+       bool doing_output = output_active && producesOutput();
+       InsetCollapsable::addToToc(cpit, doing_output);
 }
 
 
index 255930fedcae670e8444f2753f5fdb8f42fecbe5..dd580da8a024b8895e1a8933bfddb3bab8df7e4a 100644 (file)
@@ -96,7 +96,7 @@ private:
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
index abfecbae12eed32d9b2883a4b41e800e927f1515..680323cc4a48deec7efdaaaea0a26c70885eb936 100644 (file)
@@ -296,7 +296,7 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType)
 }
 
 
-void InsetRef::addToToc(DocIterator const & cpit) const
+void InsetRef::addToToc(DocIterator const & cpit, bool output_active) const
 {
        docstring const & label = getParam("reference");
        if (buffer().insetLabel(label))
@@ -306,7 +306,7 @@ void InsetRef::addToToc(DocIterator const & cpit) const
        // It seems that this reference does not point to any valid label.
        screen_label_ = _("BROKEN: ") + screen_label_;
        Toc & toc = buffer().tocBackend().toc("label");
-       toc.push_back(TocItem(cpit, 0, screen_label_));
+       toc.push_back(TocItem(cpit, 0, screen_label_, output_active));
 }
 
 
index 09122c1ebea35d6f80de3dce9c8e3f73d2e6c423..21a7ec1c7c5a21514120c5c911001f93665bd285 100644 (file)
@@ -68,7 +68,7 @@ public:
        ///
        void updateBuffer(ParIterator const & it, UpdateType);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        bool forceLTR() const { return true; }
        //@}
index 120eb13d315f06036ae65f94d45beaa55045bb42..379d29634429aaa23685e7bcb1459fdc33acbffb 100644 (file)
@@ -3892,13 +3892,13 @@ void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype)
 }
 
 
-void InsetTabular::addToToc(DocIterator const & cpit) const
+void InsetTabular::addToToc(DocIterator const & cpit, bool output_active) const
 {
        DocIterator dit = cpit;
        dit.forwardPos();
        size_t const end = dit.nargs();
        for ( ; dit.idx() < end; dit.top().forwardIdx())
-               cell(dit.idx())->addToToc(dit);
+               cell(dit.idx())->addToToc(dit, output_active);
 }
 
 
index 2f0ff3b760874bc30a339746a29c5d12f029cde0..e4651a3b8fded091718795daa402de22d03c137c 100644 (file)
@@ -919,7 +919,7 @@ public:
        /// Update the counters of this inset and of its contents
        void updateBuffer(ParIterator const &, UpdateType);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
 
        ///
        bool completionSupported(Cursor const &) const;
index b3baf93ba14aa13e0f3e630f64f528aba11bdf67..df957660f2c611c3d02d2b57f7862bb9df9e03db 100644 (file)
@@ -811,7 +811,7 @@ void InsetText::forToc(docstring & os, size_t maxlen) const
 }
 
 
-void InsetText::addToToc(DocIterator const & cdit) const
+void InsetText::addToToc(DocIterator const & cdit, bool output_active) const
 {
        DocIterator dit = cdit;
        dit.push_back(CursorSlice(const_cast<InsetText &>(*this)));
@@ -819,6 +819,9 @@ void InsetText::addToToc(DocIterator const & cdit) const
 
        BufferParams const & bufparams = buffer_->params();
        int const min_toclevel = bufparams.documentClass().min_toclevel();
+       // we really should have done this before we got here, but it
+       // can't hurt too much to do it again
+       bool const doing_output = output_active && producesOutput();
 
        // For each paragraph, traverse its insets and let them add
        // their toc items
@@ -835,7 +838,7 @@ void InsetText::addToToc(DocIterator const & cdit) const
                        Inset & inset = *it->inset;
                        dit.pos() = it->pos;
                        //lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
-                       inset.addToToc(dit);
+                       inset.addToToc(dit, doing_output);
                        if (inset.lyxCode() == ARG_CODE)
                                arginset = inset.asInsetText();
                }
@@ -853,11 +856,11 @@ void InsetText::addToToc(DocIterator const & cdit) const
                                par.forToc(tocstring, TOC_ENTRY_LENGTH);
                        dit.pos() = 0;
                        toc.push_back(TocItem(dit, toclevel - min_toclevel,
-                               tocstring, tocstring));
+                               tocstring, output_active, tocstring));
                }
                
                // And now the list of changes.
-               par.addChangesToToc(dit, buffer());
+               par.addChangesToToc(dit, buffer(), doing_output);
        }
 }
 
index a77bf92875e8ef05ddd30723a133ad541810b853..e986d3650d947df404b10672606a1386f61914e8 100644 (file)
@@ -174,7 +174,7 @@ public:
        ///
        void forToc(docstring &, size_t) const;
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        Inset * clone() const { return new InsetText(*this); }
        ///
index bbfda5aee526b04e39a1695cf36900944182e6b6..2a47f2035683a563576f458fdf72cc60b1a21892 100644 (file)
@@ -284,7 +284,7 @@ void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype)
 }
 
 
-void InsetMathHull::addToToc(DocIterator const & pit) const
+void InsetMathHull::addToToc(DocIterator const & pit, bool output_active) const
 {
        if (!buffer_) {
                //FIXME: buffer_ should be set at creation for this inset! Problem is
@@ -299,8 +299,8 @@ void InsetMathHull::addToToc(DocIterator const & pit) const
                if (!numbered_[row])
                        continue;
                if (label_[row])
-                       label_[row]->addToToc(pit);
-               toc.push_back(TocItem(pit, 0, nicelabel(row)));
+                       label_[row]->addToToc(pit, output_active);
+               toc.push_back(TocItem(pit, 0, nicelabel(row), output_active));
        }
 }
 
index 3ac17780b89bcedaa505e7151cec4a56b4e6a535..0284e6e43f0f4e00ae4726190b9fbedfc6e87c5b 100644 (file)
@@ -42,7 +42,7 @@ public:
        ///
        void updateBuffer(ParIterator const &, UpdateType);
        ///
-       void addToToc(DocIterator const &) const;
+       void addToToc(DocIterator const & di, bool output_active) const;
        ///
        InsetMathHull & operator=(InsetMathHull const &);
        ///