* 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
This commit is contained in:
Abdelrazak Younes 2007-08-13 18:11:43 +00:00
parent c5ed92e7df
commit 8bb999b7ee
2 changed files with 26 additions and 0 deletions

View File

@ -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<InsetInclude const &>(*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

View File

@ -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