File indexing completed on 2024-04-28 15:51:41

0001 /*
0002     SPDX-FileCopyrightText: 2006 Chu Xiaodong <xiaodongchu@gmail.com>
0003     SPDX-FileCopyrightText: 2006 Pino Toscano <pino@kde.org>
0004 
0005     Work sponsored by the LiMux project of the city of Munich:
0006     SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef _ANNOTWINDOW_H_
0012 #define _ANNOTWINDOW_H_
0013 
0014 #include <QColor>
0015 #include <QFrame>
0016 
0017 namespace Okular
0018 {
0019 class Annotation;
0020 class Document;
0021 }
0022 
0023 namespace GuiUtils
0024 {
0025 class LatexRenderer;
0026 }
0027 
0028 class KTextEdit;
0029 class MovableTitle;
0030 class QMenu;
0031 
0032 class AnnotWindow : public QFrame
0033 {
0034     Q_OBJECT
0035 public:
0036     AnnotWindow(QWidget *parent, Okular::Annotation *annot, Okular::Document *document, int page);
0037     ~AnnotWindow() override;
0038 
0039     void reloadInfo();
0040 
0041     Okular::Annotation *annotation() const;
0042     int pageNumber() const;
0043 
0044     void updateAnnotation(Okular::Annotation *a);
0045 
0046 private:
0047     MovableTitle *m_title;
0048     KTextEdit *textEdit;
0049     QColor m_color;
0050     GuiUtils::LatexRenderer *m_latexRenderer;
0051     Okular::Annotation *m_annot;
0052     Okular::Document *m_document;
0053     int m_page;
0054     int m_prevCursorPos;
0055     int m_prevAnchorPos;
0056 
0057 public Q_SLOTS:
0058     void renderLatex(bool render);
0059 
0060 protected:
0061     void showEvent(QShowEvent *event) override;
0062     bool eventFilter(QObject *obj, QEvent *event) override;
0063 
0064 private Q_SLOTS:
0065     void slotUpdateUndoAndRedoInContextMenu(QMenu *menu);
0066     void slotOptionBtn();
0067     void slotsaveWindowText();
0068     void slotHandleContentsChangedByUndoRedo(Okular::Annotation *annot, const QString &contents, int cursorPos, int anchorPos);
0069 
0070 Q_SIGNALS:
0071     void containsLatex(bool);
0072 };
0073 
0074 #endif