File indexing completed on 2024-04-28 15:52:00
0001 /* 0002 SPDX-FileCopyrightText: 2004-2006 Albert Astals Cid <aacid@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _OKULAR_TOC_H_ 0008 #define _OKULAR_TOC_H_ 0009 0010 #include "core/document.h" 0011 #include "core/observer.h" 0012 #include <QModelIndex> 0013 #include <qwidget.h> 0014 0015 #include "okularpart_export.h" 0016 0017 class QModelIndex; 0018 class QTreeView; 0019 class KTreeViewSearchLine; 0020 class TOCModel; 0021 0022 namespace Okular 0023 { 0024 class Document; 0025 class PartTest; 0026 } 0027 0028 class OKULARPART_EXPORT TOC : public QWidget, public Okular::DocumentObserver 0029 { 0030 Q_OBJECT 0031 friend class Okular::PartTest; 0032 0033 public: 0034 TOC(QWidget *parent, Okular::Document *document); 0035 ~TOC() override; 0036 0037 // inherited from DocumentObserver 0038 void notifySetup(const QVector<Okular::Page *> &pages, int setupFlags) override; 0039 void notifyCurrentPageChanged(int previous, int current) override; 0040 0041 void reparseConfig(); 0042 0043 void prepareForReload(); 0044 void rollbackReload(); 0045 void finishReload(); 0046 0047 public Q_SLOTS: 0048 void expandRecursively(); 0049 void collapseRecursively(); 0050 void expandAll(); 0051 void collapseAll(); 0052 0053 Q_SIGNALS: 0054 void hasTOC(bool has); 0055 void rightClick(const Okular::DocumentViewport &, const QPoint, const QString &); 0056 0057 private Q_SLOTS: 0058 void slotExecuted(const QModelIndex &); 0059 void saveSearchOptions(); 0060 0061 protected: 0062 void contextMenuEvent(QContextMenuEvent *e) override; 0063 0064 private: 0065 QVector<QModelIndex> expandedNodes(const QModelIndex &parent = QModelIndex()) const; 0066 0067 Okular::Document *m_document; 0068 QTreeView *m_treeView; 0069 KTreeViewSearchLine *m_searchLine; 0070 TOCModel *m_model; 0071 }; 0072 0073 #endif