From: Abdelrazak Younes Date: Mon, 13 Aug 2007 18:11:43 +0000 (+0000) Subject: * loadChildDocuments(): new function to load all child documents in a given buffer... X-Git-Tag: 1.6.10~8905 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8bb999b7ee879c841f849b069e51663a1a2d2b62;p=features.git * loadChildDocuments(): new function to load all child documents in a given buffer. This will be used for a new LFUN_LOAD_CHILD_DOCUMENTS and for pre-loading all child documents when certain action (latex export, bibtex parsing, label and reference). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19515 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp index 502b8f35e5..39091ed55a 100644 --- a/src/buffer_funcs.cpp +++ b/src/buffer_funcs.cpp @@ -23,8 +23,10 @@ #include "Floating.h" #include "FloatList.h" #include "gettext.h" +#include "InsetIterator.h" #include "Language.h" #include "LaTeX.h" +#include "LyX.h" #include "TextClass.h" #include "Paragraph.h" #include "paragraph_funcs.h" @@ -614,4 +616,25 @@ void checkBufferStructure(Buffer & buffer, ParIterator const & par_it) } } + +void loadChildDocuments(Buffer const & buf) +{ + bool parse_error = false; + + for (InsetIterator it = inset_iterator_begin(buf.inset()); it; ++it) { + if (it->lyxCode() != Inset::INCLUDE_CODE) + continue; + InsetInclude const & inset = static_cast(*it); + InsetCommandParams const & ip = inset.params(); + Buffer * child = loadIfNeeded(buf, ip); + if (!child) + continue; + parse_error |= !child->errorList("Parse").empty(); + loadChildDocuments(*child); + } + + if (use_gui && buf.getMasterBuffer() == &buf) + updateLabels(buf); +} + } // namespace lyx diff --git a/src/buffer_funcs.h b/src/buffer_funcs.h index e059314b35..b2142f8118 100644 --- a/src/buffer_funcs.h +++ b/src/buffer_funcs.h @@ -71,6 +71,9 @@ void updateLabels(Buffer const &, ParIterator &); /// void checkBufferStructure(Buffer &, ParIterator const &); +/// +void loadChildDocuments(Buffer const & buffer); + } // namespace lyx #endif // BUFFER_FUNCS_H