]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/TocModel.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / TocModel.cpp
index 360d70585715af3f32bd917be4aee88fb7b93d2a..1b66b932e0c8711d2beaac2336fc7c4039d65578 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file GuiTocDialog.C
+ * \file TocModel.cpp
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
 
 #include "TocModel.h"
 
-#include "debug.h"
-
-#include <boost/assert.hpp>
+#include "support/debug.h"
 
+#include "support/assert.h"
 #include <climits>
-#include <vector>
-#include <string>
-
-using std::endl;
-using std::pair;
-using std::map;
-using std::vector;
-using std::string;
-using std::make_pair;
-using std::max;
-using std::min;
+
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-
-TocModel::TocModel(Toc const & toc)
-{
-       populate(toc);
-}
-
-
-TocModel const & TocModel::operator=(Toc const & toc)
-{
-       populate(toc);
-       return *this;
-}
+typedef std::pair<QModelIndex, TocIterator> TocPair;
 
 
-TocIterator const TocModel::tocIterator(QModelIndex const & index) const
+TocIterator TocModel::tocIterator(QModelIndex const & index) const
 {
        TocMap::const_iterator map_it = toc_map_.find(index);
-       BOOST_ASSERT(map_it != toc_map_.end());
+       LASSERT(map_it != toc_map_.end(), /**/);
        return map_it->second;
 }
 
 
-QModelIndex const TocModel::modelIndex(TocIterator const & it) const
+QModelIndex TocModel::modelIndex(TocIterator const & it) const
 {
        ModelMap::const_iterator map_it = model_map_.find(it);
-       //BOOST_ASSERT(it != model_map_.end());
+       //LASSERT(it != model_map_.end(), /**/);
 
        if (map_it == model_map_.end())
                return QModelIndex();
@@ -108,10 +87,8 @@ void TocModel::populate(Toc const & toc)
                toc_map_.insert( TocPair(top_level_item, iter) );
                model_map_[iter] = top_level_item;
 
-               LYXERR(Debug::GUI)
-                       << "Toc: at depth " << iter->depth()
-                       << ", added item " << to_utf8(iter->str())
-                       << endl;
+               LYXERR(Debug::GUI, "Toc: at depth " << iter->depth()
+                       << ", added item " << to_utf8(iter->str()));
 
                populate(iter, end, top_level_item);
 
@@ -126,9 +103,8 @@ void TocModel::populate(Toc const & toc)
 }
 
 
-void TocModel::populate(TocIterator & iter,
-                                               TocIterator const & end,
-                                               QModelIndex const & parent)
+void TocModel::populate(TocIterator & iter, TocIterator const & end,
+       QModelIndex const & parent)
 {
        int curdepth = iter->depth() + 1;
 
@@ -166,7 +142,7 @@ void TocModel::populate(TocIterator & iter,
 }
 
 
-int TocModel::modelDepth()
+int TocModel::modelDepth() const
 {
        return maxdepth_ - mindepth_;
 }