]> git.lyx.org Git - features.git/commitdiff
* loadChildDocuments(): new function to load all child documents in a given buffer...
authorAbdelrazak Younes <younes@lyx.org>
Mon, 13 Aug 2007 18:11:43 +0000 (18:11 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 13 Aug 2007 18:11:43 +0000 (18:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19515 a592a061-630c-0410-9148-cb99ea01b6c8

src/buffer_funcs.cpp
src/buffer_funcs.h

index 502b8f35e512cb57d7e28b7c7d8851f2739a42d3..39091ed55a7f70a303e36bdaac5c4229e1c961ef 100644 (file)
 #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
index e059314b35d965fd25171dc1e83ec0607111d03a..b2142f81185f9ae6590632c11e68ef916f27055d 100644 (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