]> git.lyx.org Git - features.git/commitdiff
* Inset.h (producesOutput): new mvirtual method, returning true by
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 23 Apr 2008 10:55:51 +0000 (10:55 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 23 Apr 2008 10:55:51 +0000 (10:55 +0000)
default
* InsetNote.h (producesOutput): always return false.
* InsetBranch.h (producesOutput):  returns true if the branch is
selected.

* InsetBranch.cpp (updateLabels):
* InsetNote.cpp (updateLabels): remove

* InsetText.cpp (updateLabels): honor producesOutput().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24475 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/Inset.h
src/insets/InsetBranch.cpp
src/insets/InsetBranch.h
src/insets/InsetNote.cpp
src/insets/InsetNote.h
src/insets/InsetText.cpp

index 5d21a0fe1df8606875cc3f173fcf44908cbe8623..be04893b4593eccfc18b2f32faba61da06092dcc 100644 (file)
@@ -361,6 +361,9 @@ public:
        /// Is the width forced to some value?
        virtual bool hasFixedWidth() const { return false; }
 
+       /// Is the content of this inset part of the output document?
+       virtual bool producesOutput() const { return true; }
+
        /// \return Tool tip for this inset.
        /// This default implementation returns an empty string.
        virtual docstring toolTip(BufferView const & bv, int x, int y) const;
index 9a420f016d00ce800b7e6db0489102a3f4251fb0..050a3c9c5d89d53de8e5b32a7275f44736bddfba 100644 (file)
@@ -205,19 +205,6 @@ bool InsetBranch::isBranchSelected() const
 }
 
 
-void InsetBranch::updateLabels(ParIterator const & it)
-{
-       if (isBranchSelected())
-               InsetCollapsable::updateLabels(it);
-       else {
-               DocumentClass const & tclass = buffer().params().documentClass();
-               Counters savecnt = tclass.counters();
-               InsetCollapsable::updateLabels(it);
-               tclass.counters() = savecnt;
-       }
-}
-
-
 int InsetBranch::latex(odocstream & os, OutputParams const & runparams) const
 {
        return isBranchSelected() ?  InsetText::latex(os, runparams) : 0;
index ca24e99980a760c71120b5c292ae85583b886ddf..4d54cfd4df437fc922d1d833696bdb4483f11b68 100644 (file)
@@ -86,11 +86,16 @@ private:
            \c buffer. This handles the case of child documents.
         */
        bool isBranchSelected() const;
+       /*!
+        * Is the content of this inset part of the output document?
+        *
+        * Note that Branch insets are only considered part of the
+        * document when they are selected.
+        */
+       bool producesOutput() const { return isBranchSelected(); }
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///
-       void updateLabels(ParIterator const &);
-       ///
        bool isMacroScope() const;
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
index 5f642a34a5610b5618ddd56f5e3ee42374fa4eb3..133f14d47806c9e00c15bbfffb834e60b7134d7f 100644 (file)
@@ -221,15 +221,6 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetNote::updateLabels(ParIterator const & it)
-{
-       DocumentClass const & tclass = buffer().params().documentClass();
-       Counters savecnt = tclass.counters();
-       InsetCollapsable::updateLabels(it);
-       tclass.counters() = savecnt;
-}
-
-
 void InsetNote::addToToc(ParConstIterator const & cpit) const
 {
        ParConstIterator pit = cpit;
index 15b416a1f8270b124a3a3e37cc6b4ae659b47e24..bf5ca70a3fe0d08c48bee999723d56185231f62b 100644 (file)
@@ -67,6 +67,13 @@ private:
        DisplayType display() const;
        ///
        bool noFontChange() const { return params_.type != InsetNoteParams::Note; }
+       /*!
+        * Is the content of this inset part of the output document?
+        *
+        * Note that Note insets are not considered part of the
+        * document, even in their 'greyed out' incarnation.
+        */
+       bool producesOutput() const { return false; }
        ///
        void write(std::ostream &) const;
        ///
@@ -87,8 +94,6 @@ private:
        void validate(LaTeXFeatures &) const;
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
-       // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &);
        ///
        void addToToc(ParConstIterator const &) const;
        ///
index 410e84c21ff881524bdf39ef2688079b807e2a8b..60abdf79b801f0800ed36e6c17e42e622db5ec54 100644 (file)
@@ -433,7 +433,14 @@ void InsetText::updateLabels(ParIterator const & it)
        ParIterator it2 = it;
        it2.forwardPos();
        LASSERT(&it2.inset() == this && it2.pit() == 0, /**/);
-       lyx::updateLabels(buffer(), it2);
+       if (producesOutput())
+               lyx::updateLabels(buffer(), it2);
+       else {
+               DocumentClass const & tclass = buffer().params().documentClass();
+               Counters const savecnt = tclass.counters();
+               lyx::updateLabels(buffer(), it2);
+               tclass.counters() = savecnt;
+       }
 }