]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Streamlining CollapseStatus stuff
[lyx.git] / src / Buffer.cpp
index 987605cb695ffd47f5252b3e8206ce55e30ec7c3..ed969f83034bb6ecb5320d2f591a3bf0d12bfd0f 100644 (file)
@@ -13,6 +13,7 @@
 #include "Buffer.h"
 
 #include "Author.h"
+#include "Biblio.h"
 #include "BranchList.h"
 #include "buffer_funcs.h"
 #include "BufferList.h"
@@ -1058,6 +1059,8 @@ void Buffer::writeLaTeXSource(odocstream & os,
                params().parentname.erase();
        }
 
+       loadChildDocuments(*this);
+
        // the real stuff
        latexParagraphs(*this, paragraphs(), os, texrow(), runparams);
 
@@ -1209,6 +1212,8 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
 
        params().getTextClass().counters().reset();
 
+       loadChildDocuments(*this);
+
        sgml::openTag(os, top);
        os << '\n';
        docbookParagraphs(paragraphs(), *this, os, runparams);
@@ -1298,6 +1303,8 @@ void Buffer::validate(LaTeXFeatures & features) const
        if (params().use_esint == BufferParams::package_on)
                features.require("esint");
 
+       loadChildDocuments(*this);
+
        for_each(paragraphs().begin(), paragraphs().end(),
                 boost::bind(&Paragraph::validate, _1, boost::ref(features)));
 
@@ -1345,45 +1352,18 @@ void Buffer::getLabelList(vector<docstring> & list) const
                return;
        }
 
+       loadChildDocuments(*this);
+
        for (InsetIterator it = inset_iterator_begin(inset()); it; ++it)
                it.nextInset()->getLabelList(*this, list);
 }
 
 
 // This is also a buffer property (ale)
-void Buffer::fillWithBibKeys(vector<pair<string, docstring> > & keys)
+void Buffer::fillWithBibKeys(biblio::BibKeyList & keys)
        const
 {
-       /// if this is a child document and the parent is already loaded
-       /// use the parent's list instead  [ale990412]
-       Buffer const * tmp = getMasterBuffer();
-       BOOST_ASSERT(tmp);
-       if (tmp != this) {
-               tmp->fillWithBibKeys(keys);
-               return;
-       }
-
-       for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
-               if (it->lyxCode() == Inset::BIBTEX_CODE) {
-                       InsetBibtex const & inset =
-                               static_cast<InsetBibtex const &>(*it);
-                       inset.fillWithBibKeys(*this, keys);
-               } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
-                       InsetInclude const & inset =
-                               static_cast<InsetInclude const &>(*it);
-                       inset.fillWithBibKeys(*this, keys);
-               } else if (it->lyxCode() == Inset::BIBITEM_CODE) {
-                       InsetBibitem const & inset =
-                               static_cast<InsetBibitem const &>(*it);
-                       // FIXME UNICODE
-                       string const key = to_utf8(inset.getParam("key"));
-                       docstring const label = inset.getParam("label");
-                       DocIterator doc_it(it); doc_it.forwardPos();
-                       docstring const ref = doc_it.paragraph().asString(*this, false);
-                       docstring const info = label + "TheBibliographyRef" + ref;
-                       keys.push_back(pair<string, docstring>(key, info));
-               }
-       }
+       biblio::fillWithBibKeys(this, keys);
 }
 
 
@@ -1751,10 +1731,10 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
        vector<docstring> labels;
 
        if (code == Inset::CITE_CODE) {
-               vector<pair<string, docstring> > keys;
+               biblio::BibKeyList keys;
                fillWithBibKeys(keys);
-               vector<pair<string, docstring> >::const_iterator bit  = keys.begin();
-               vector<pair<string, docstring> >::const_iterator bend = keys.end();
+               biblio::BibKeyList::const_iterator bit  = keys.begin();
+               biblio::BibKeyList::const_iterator bend = keys.end();
 
                for (; bit != bend; ++bit)
                        // FIXME UNICODE