#ifndef TOCMODEL_H
#define TOCMODEL_H
-#include "toc.h"
+#include "TocBackend.h"
#include "qt_helpers.h"
#include <QStandardItemModel>
#include <map>
-#include <string>
namespace lyx {
namespace frontend {
-class TocModel: public QStandardItemModel {
+class TocModel : public QStandardItemModel
+{
Q_OBJECT
+
public:
///
TocModel() {}
///
- TocModel(toc::Toc const & toc_list);
+ TocModel(Toc const & toc);
///
~TocModel() {}
///
- TocModel const & operator=(toc::Toc const & toc_list);
+ TocModel const & operator=(Toc const & toc);
///
void clear();
///
- void populate(toc::Toc const & toc_list);
+ void populate(Toc const & toc);
+ ///
+ TocIterator const tocIterator(QModelIndex const & index) const;
///
- toc::TocItem const item(QModelIndex const & index) const;
+ QModelIndex const modelIndex(TocIterator const & it) const;
///
- QModelIndex const index(std::string const & toc_str) const;
+ int modelDepth() const;
private:
///
- void populate(toc::Toc::const_iterator & iter,
- toc::Toc::const_iterator const & end,
+ void populate(TocIterator & it, TocIterator const & end,
QModelIndex const & parent);
-
- typedef std::map<QModelIndex, toc::TocItem> ItemMap;
///
- typedef std::map<std::string, QModelIndex> IndexMap;
+ typedef std::map<QModelIndex, TocIterator> TocMap;
+ ///
+ typedef std::pair<QModelIndex, TocIterator> TocPair;
+ ///
+ typedef std::map<TocIterator, QModelIndex> ModelMap;
+ ///
+ TocMap toc_map_;
+ ///
+ ModelMap model_map_;
///
- ItemMap item_map_;
- IndexMap index_map_;
+ int maxdepth_;
+ int mindepth_;
};
} // namespace frontend