]> git.lyx.org Git - features.git/commitdiff
Pass Buffer arg to Inset::getLabelList, Inset::fillWithBibKeys.
authorAngus Leeming <leeming@lyx.org>
Thu, 18 Sep 2003 20:18:39 +0000 (20:18 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 18 Sep 2003 20:18:39 +0000 (20:18 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7794 a592a061-630c-0410-9148-cb99ea01b6c8

22 files changed:
src/BufferView.C
src/ChangeLog
src/buffer.C
src/insets/ChangeLog
src/insets/insetbase.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/formula.h
src/mathed/math_hullinset.C
src/mathed/math_hullinset.h
src/tabular.C
src/tabular.h

index 54d25dbb15f95c753ee5b433e423e41b9b797cfa..6eab513d2927c3a00c5c56702a92ed3675c606b2 100644 (file)
@@ -324,7 +324,7 @@ void BufferView::gotoLabel(string const & label)
        for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
             it != buffer()->inset_iterator_end(); ++it) {
                vector<string> labels;
-               it->getLabelList(labels);
+               it->getLabelList(*buffer(), labels);
                if (find(labels.begin(),labels.end(),label) != labels.end()) {
                        beforeChange(text);
                        text->setCursor(it.getPar(), it.getPos());
index 240932eb56e2f22af9d828a92381343a9092ea65..6d176fa6dc8cba3d463ab2e69db03c54a34a913a 100644 (file)
@@ -1,3 +1,10 @@
+2003-09-18  Angus Leeming  <leeming@lyx.org>
+
+       * buffer.C:
+       * BufferView.C: pass the buffer when calling Inset::getLabelList,
+       Inset::fillWithBibKeys.
+       * tabular.[Ch] (getLabelList): receive, pass on a Buffer const & arg.
+
 2003-09-18  Angus Leeming  <leeming@lyx.org>
 
        * LaTeXFeatures.[Ch]: append a '_' to the names of all private member
index 8bdf819992019a3d71664d40e1d29d8e97baaf8a..2a080bc442143dce21eaed75a66ac8a432f47fb6 100644 (file)
@@ -2140,7 +2140,7 @@ void Buffer::getLabelList(std::vector<string> & list) const
 
        for (inset_iterator it = inset_const_iterator_begin();
             it != inset_const_iterator_end(); ++it) {
-               it->getLabelList(list);
+               it->getLabelList(*this, list);
        }
 }
 
@@ -2161,14 +2161,19 @@ void Buffer::fillWithBibKeys(std::vector<std::pair<string, string> > & keys) con
 
        for (inset_iterator it = inset_const_iterator_begin();
                it != inset_const_iterator_end(); ++it) {
-               if (it->lyxCode() == InsetOld::BIBTEX_CODE)
-                       static_cast<InsetBibtex &>(*it).fillWithBibKeys(*this, keys);
-               else if (it->lyxCode() == InsetOld::INCLUDE_CODE)
-                       static_cast<InsetInclude &>(*it).fillWithBibKeys(keys);
-               else if (it->lyxCode() == InsetOld::BIBITEM_CODE) {
-                       InsetBibitem & bib = static_cast<InsetBibitem &>(*it);
-                       string const key = bib.getContents();
-                       string const opt = bib.getOptions();
+               if (it->lyxCode() == InsetOld::BIBTEX_CODE) {
+                       InsetBibtex const & inset =
+                               dynamic_cast<InsetBibtex const &>(*it);
+                       inset.fillWithBibKeys(*this, keys);
+               } else if (it->lyxCode() == InsetOld::INCLUDE_CODE) {
+                       InsetInclude const & inset =
+                               dynamic_cast<InsetInclude const &>(*it);
+                       inset.fillWithBibKeys(*this, keys);
+               } else if (it->lyxCode() == InsetOld::BIBITEM_CODE) {
+                       InsetBibitem const & inset =
+                               dynamic_cast<InsetBibitem const &>(*it);
+                       string const key = inset.getContents();
+                       string const opt = inset.getOptions();
                        string const ref; // = pit->asString(this, false);
                        string const info = opt + "TheBibliographyRef" + ref;
                        keys.push_back(pair<string, string>(key, info));
index b4a8d8dad5a636bb99b208ecab7ece9b19a73649..1d19d847666581ffff9d78ccbdbaf21ce388f719 100644 (file)
@@ -1,3 +1,13 @@
+2003-09-18  Angus Leeming  <leeming@lyx.org>
+
+       * insetinsetbase.h (getLabelList):
+       * insetinsetcollapsable.[Ch] (getLabelList):
+       * insetinsetinclude.[Ch] (getLabelList):
+       * insetinsetlabel.[Ch] (getLabelList):
+       * insetinsettabular.[Ch] (getLabelList):
+       * insetinsettext.[Ch] (getLabelList): receive a Buffer const & arg.
+       * insetinsetinclude.[Ch] (fillWithBibKeys): ditto.
+
 2003-09-18  Angus Leeming  <leeming@lyx.org>
 
        * insetinclude.[Ch]: remove Params::operator==, operator!= as they're
index f5eecdbdfa5bef3774fd2e4c72cc4396fa8adede..039c0ebd84f675f0f2be318c352b6d3dd991ff1a 100644 (file)
@@ -17,6 +17,7 @@
 #include <vector>
 #include <memory>
 
+class Buffer;
 class BufferView;
 class FuncRequest;
 class MetricsInfo;
@@ -101,8 +102,9 @@ public:
        virtual BufferView * view() const { return 0; }
        /// request "external features"
        virtual void validate(LaTeXFeatures &) const {}
-       /// fill in all labels in the inset
-       virtual void getLabelList(std::vector<string> &) const {}
+       /// Appends \c list with all labels found within this inset.
+       virtual void getLabelList(Buffer const &,
+                                 std::vector<string> & /* list */) const {}
 };
 
 #endif
index 0745ae1f0a897b2ecf8697b974161022a25da9c8..f6e4ccd06bc5757185531b0a61c7c628dd84fb60 100644 (file)
@@ -435,9 +435,10 @@ void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
 }
 
 
-void InsetCollapsable::getLabelList(std::vector<string> & list) const
+void InsetCollapsable::getLabelList(Buffer const & buffer,
+                                   std::vector<string> & list) const
 {
-       inset.getLabelList(list);
+       inset.getLabelList(buffer, list);
 }
 
 
index 9c0b2f6af3ba1093310d3d6413b377a75c9cb6bd..1ead924b0ab8673ae7a812b20dc7e62533e8594d 100644 (file)
@@ -107,8 +107,8 @@ public:
        LyXText * getLyXText(BufferView const *, bool const recursive) const;
        ///
        void deleteLyXText(BufferView *, bool recursive=true) const;
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &, std::vector<string> & list) const;
        ///
        int scroll(bool recursive=true) const;
        ///
index ce51bc5eb105b229a07d2d15721497c8a419e8df..b638c1958ac60d20a4e59782af4ede2cca0e977b 100644 (file)
@@ -504,7 +504,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
 }
 
 
-void InsetInclude::getLabelList(std::vector<string> & list) const
+void InsetInclude::getLabelList(Buffer const &, std::vector<string> & list) const
 {
        if (loadIfNeeded()) {
                Buffer * tmp = bufferlist.getBuffer(getFileName());
@@ -515,7 +515,8 @@ void InsetInclude::getLabelList(std::vector<string> & list) const
 }
 
 
-void InsetInclude::fillWithBibKeys(std::vector<std::pair<string,string> > & keys) const
+void InsetInclude::fillWithBibKeys(Buffer const &,
+                                  std::vector<std::pair<string,string> > & keys) const
 {
        if (loadIfNeeded()) {
                Buffer * tmp = bufferlist.getBuffer(getFileName());
index 92323646fbaec0fcc4971f140862703fde077d15..b08010c063d3f608e00152dfd7901cab5f8db7a9 100644 (file)
@@ -62,10 +62,19 @@ public:
        virtual std::auto_ptr<InsetBase> clone() const;
        ///
        InsetOld::Code lyxCode() const { return InsetOld::INCLUDE_CODE; }
-       /// This returns the list of labels on the child buffer
-       void getLabelList(std::vector<string> &) const;
-       /// This returns the list of bibkeys on the child buffer
-       void fillWithBibKeys(std::vector<std::pair<string,string> > & keys) const;
+       /** Fills \c list
+        *  \param buffer the Buffer containing this inset.
+        *  \param list the list of labels in the child buffer.
+        */
+       void getLabelList(Buffer const & buffer,
+                         std::vector<string> & list) const;
+       /** Fills \c keys
+        *  \param buffer the Buffer containing this inset.
+        *  \param keys the list of bibkeys in the child buffer.
+        */
+       ///
+       void fillWithBibKeys(Buffer const & buffer,
+               std::vector<std::pair<string,string> > & keys) const;
        ///
        EDITABLE editable() const
        {
@@ -87,15 +96,15 @@ public:
        ///
        void validate(LaTeXFeatures &) const;
 
-       /// return true if the file is or got loaded.
-       bool loadIfNeeded() const;
-
        ///
        void addPreview(lyx::graphics::PreviewLoader &) const;
 
 private:
        friend class InsetIncludeMailer;
 
+       /// return true if the file is or got loaded.
+       bool loadIfNeeded() const;
+
        ///
        void write(std::ostream &) const;
        ///
index fd61661139cfcbe9e907a3920e68d0cac01934fa..0d7e33f04069fbf94ce26a0f835f640940e30e05 100644 (file)
@@ -33,7 +33,7 @@ InsetLabel::~InsetLabel()
 }
 
 
-void InsetLabel::getLabelList(std::vector<string> & list) const
+void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
 {
        list.push_back(getContents());
 }
index 60af5c7f6b26cc7ea73f514311300e700743cc78..805004f0ac00b78a9a552795cf1405338cb59489 100644 (file)
@@ -33,8 +33,8 @@ public:
        EDITABLE editable() const { return IS_EDITABLE; }
        ///
        InsetOld::Code lyxCode() const { return InsetOld::LABEL_CODE; }
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with this label
+       void getLabelList(Buffer const &, std::vector<string> & list) const;
        ///
        int latex(Buffer const &, std::ostream &,
                  LatexRunParams const &) const;
index fb03637610cea7ea100805de13730580636e6bba..9d82512403a1fd12a3e28994644d9d53fa0616aa 100644 (file)
@@ -2185,9 +2185,10 @@ FuncStatus InsetTabular::getStatus(string const & what) const
 }
 
 
-void InsetTabular::getLabelList(std::vector<string> & list) const
+void InsetTabular::getLabelList(Buffer const & buffer,
+                               std::vector<string> & list) const
 {
-       tabular.getLabelList(list);
+       tabular.getLabelList(buffer, list);
 }
 
 
index 372c42efb176a9f2aee0709241dce824bfdd53e0..490885c01b9e91f4fee5061dd31fa6496ed1a26b 100644 (file)
@@ -145,8 +145,8 @@ public:
        bool showInsetDialog(BufferView *) const;
        ///
        FuncStatus getStatus(string const & argument) const;
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &, std::vector<string> & list) const;
        ///
        int scroll(bool recursive=true) const;
        ///
index 83b8baeb8d41cc7ae351c7d73db2b0bc103d1a14..d2872a07b91b7d5b02d49e3c213c068552e030f0 100644 (file)
@@ -1318,7 +1318,8 @@ bool InsetText::showInsetDialog(BufferView * bv) const
 }
 
 
-void InsetText::getLabelList(std::vector<string> & list) const
+void InsetText::getLabelList(Buffer const & buffer,
+                            std::vector<string> & list) const
 {
        ParagraphList::const_iterator pit = paragraphs.begin();
        ParagraphList::const_iterator pend = paragraphs.end();
@@ -1326,7 +1327,7 @@ void InsetText::getLabelList(std::vector<string> & list) const
                InsetList::const_iterator beg = pit->insetlist.begin();
                InsetList::const_iterator end = pit->insetlist.end();
                for (; beg != end; ++beg)
-                       beg->inset->getLabelList(list);
+                       beg->inset->getLabelList(buffer, list);
        }
 }
 
index d110d619cfe3792ba02de20bf2fea7741baf7c6f..9edd348baa0711b3f94c3fe5e60fbcf95d621cf1 100644 (file)
@@ -139,8 +139,8 @@ public:
        void deleteLyXText(BufferView *, bool recursive = true) const;
        ///
        bool showInsetDialog(BufferView *) const;
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &, std::vector<string> & list) const;
        ///
        int scroll(bool recursive = true) const;
        ///
index bbdc3cb0776376f322089ee11da065d80aed200f..877e2eb813d1c30caebc50ab25fb55d11162661b 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-18  Angus Leeming  <leeming@lyx.org>
+
+       * matheformula.[Ch] (getLabelList):
+       * mathemath_hullinset.[Ch] (getLabelList):
+       receive a Buffer const & arg.
+
 2003-09-18  Angus Leeming  <leeming@lyx.org>
 
        * formula.C (latexString): add a Buffer const & arg.
index 36b39d32fda09f2da4968839df002f021d839da3..4e7e118bccb9367b9de32ce7e8a56cbe1be5a41a 100644 (file)
@@ -228,9 +228,10 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-void InsetFormula::getLabelList(vector<string> & res) const
+void InsetFormula::getLabelList(Buffer const & buffer,
+                               vector<string> & res) const
 {
-       par()->getLabelList(res);
+       par()->getLabelList(buffer, res);
 }
 
 
index f2b3e2fe69904c7a9947430936798c6871d8c18a..0af46fa6eb2960ea384b7161ffbf895c4873557e 100644 (file)
@@ -59,8 +59,9 @@ public:
        InsetOld::Code lyxCode() const;
        ///
        bool insetAllowed(InsetOld::Code code) const;
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &,
+                         std::vector<string> & list) const;
        ///
        MathAtom const & par() const { return par_; }
        ///
index 3cf949d4fad09af428bddc2abd539f36034d1fb3..8d0b6b62020a97ab7bd29688a5d5627a9a410441 100644 (file)
@@ -308,7 +308,8 @@ bool MathHullInset::display() const
 }
 
 
-void MathHullInset::getLabelList(std::vector<string> & labels) const
+void MathHullInset::getLabelList(Buffer const &,
+                                std::vector<string> & labels) const
 {
        for (row_type row = 0; row < nrows(); ++row)
                if (!label_[row].empty() && nonum_[row] != 1)
index 6c9237351a8faf37ed5d09b131482d4398791400..4de81929c1c8ad77a469654b17683f4a356f99c1 100644 (file)
@@ -52,8 +52,9 @@ public:
        bool ams() const;
        /// local dispatcher
        dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &,
+                         std::vector<string> & list) const;
        ///
        void validate(LaTeXFeatures & features) const;
        /// identifies MatrixInsets
index ce073eb46309fc921fdeb2d3567f2cad3d07fb6f..006edbd3ea7d40745f1f10b4787375b9b83b57f0 100644 (file)
@@ -2656,11 +2656,12 @@ void LyXTabular::validate(LaTeXFeatures & features) const
 }
 
 
-void LyXTabular::getLabelList(std::vector<string> & list) const
+void LyXTabular::getLabelList(Buffer const & buffer,
+                             std::vector<string> & list) const
 {
        for (int i = 0; i < rows_; ++i)
                for (int j = 0; j < columns_; ++j)
-                       getCellInset(i, j).getLabelList(list);
+                       getCellInset(i, j).getLabelList(buffer, list);
 }
 
 
index c2ac148da6805277dc5041288b0d44e82735ff3f..211daf0b4f627a93221c0dea631c32a9726aef4e 100644 (file)
@@ -377,8 +377,8 @@ public:
        int columns() const { return columns_;}
        ///
        void validate(LaTeXFeatures &) const;
-       ///
-       void getLabelList(std::vector<string> &) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &, std::vector<string> & list) const;
        ///
        /// recalculate the widths/heights only!
        void reinit();