]> git.lyx.org Git - lyx.git/blobdiff - src/InsetList.C
the spellcheck cleanup
[lyx.git] / src / InsetList.C
index 499ab1fea2492232040818cf84c8892d21c670e0..ef21a07310844db2f847a41a67fd987bca28c7eb 100644 (file)
@@ -1,17 +1,31 @@
+/**
+ * \file InsetList.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Martin Vermeer
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
 #include "InsetList.h"
-#include "debug.h"
 
-#include "insets/updatableinset.h"
+#include "buffer.h"
+#include "bufferparams.h"
+#include "BufferView.h"
+#include "debug.h"
 
-#include <algorithm>
+#include "insets/insetbranch.h"
 
 using lyx::pos_type;
 
+using std::endl;
 using std::lower_bound;
 using std::upper_bound;
-using std::endl;
+
 
 namespace {
 
@@ -168,11 +182,29 @@ void InsetList::deleteInsetsLyXText(BufferView * bv)
        List::iterator it = list.begin();
        List::iterator end = list.end();
        for (; it != end; ++it) {
-               if (it->inset) {
-                       if (it->inset->isTextInset()) {
-                               static_cast<UpdatableInset*>
-                                       (it->inset)->deleteLyXText(bv, true);
+               if (it->inset && it->inset->isTextInset()) {
+                       static_cast<UpdatableInset*>
+                               (it->inset)->deleteLyXText(bv, true);
+               }
+       }
+}
+
+
+void InsetList::insetsOpenCloseBranch(BufferView * bv)
+{
+       BufferParams bp = bv->buffer()->params();
+       List::iterator it = list.begin();
+       List::iterator end = list.end();
+       for (; it != end; ++it) {
+               if (it->inset && it->inset->lyxCode() == InsetOld::BRANCH_CODE) {
+                       InsetBranch * inset = static_cast<InsetBranch *>(it->inset);
+                       if (bp.branchlist().selected(inset->params().branch)) {
+                               inset->open(bv);
+                       } else {
+                               inset->close(bv);
                        }
                }
        }
 }
+
+