1 /* This file is part of the KDE project 2 * Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef TABLEOFCONTENTSSTYLEMODEL_H 21 #define TABLEOFCONTENTSSTYLEMODEL_H 22 23 #include <QAbstractTableModel> 24 25 class KoStyleManager; 26 class KoStyleThumbnailer; 27 class KoTableOfContentsGeneratorInfo; 28 29 class TableOfContentsStyleModel : public QAbstractTableModel 30 { 31 public: 32 TableOfContentsStyleModel(const KoStyleManager *manager, KoTableOfContentsGeneratorInfo *info); 33 34 int rowCount(const QModelIndex &parent) const override; 35 int columnCount(const QModelIndex &parent) const override; 36 QVariant data(const QModelIndex &index, int role) const override; 37 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 38 Qt::ItemFlags flags(const QModelIndex &index) const override; 39 QModelIndex index(int row, int column=0, const QModelIndex &parent = QModelIndex()) const override; 40 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override ; 41 42 void saveData(); 43 44 protected: 45 QList<int> m_styleList; // list of style IDs 46 QList<int> m_outlineLevel; 47 48 private: 49 const KoStyleManager *m_styleManager; 50 KoStyleThumbnailer *m_styleThumbnailer; 51 KoTableOfContentsGeneratorInfo *m_tocInfo; 52 53 int getOutlineLevel(int styleId); 54 void setOutlineLevel(int styleId, int outLineLevel); 55 }; 56 57 #endif // TABLEOFCONTENTSSTYLEMODEL_H 58 59