File indexing completed on 2024-05-12 16:06:45
0001 /* 0002 SPDX-FileCopyrightText: 2012 Fabio D 'Urso <fabiodurso@hotmail.it> 0003 0004 Work sponsored by the LiMux project of the city of Munich: 0005 SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef _OKULAR_GENERATOR_PDF_ANNOTS_H_ 0011 #define _OKULAR_GENERATOR_PDF_ANNOTS_H_ 0012 0013 #include <poppler-annotation.h> 0014 #include <poppler-qt6.h> 0015 #include <poppler-version.h> 0016 #define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO)) 0017 0018 #include <QMutex> 0019 0020 #include <unordered_map> 0021 0022 #include "core/annotations.h" 0023 0024 extern Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *popplerAnnotation, const Poppler::Page &popplerPage, bool *doDelete); 0025 0026 class PopplerAnnotationProxy : public Okular::AnnotationProxy 0027 { 0028 public: 0029 PopplerAnnotationProxy(Poppler::Document *doc, QMutex *userMutex, QHash<Okular::Annotation *, Poppler::Annotation *> *annotsOnOpenHash); 0030 ~PopplerAnnotationProxy() override; 0031 0032 bool supports(Capability capability) const override; 0033 void notifyAddition(Okular::Annotation *okl_ann, int page) override; 0034 void notifyModification(const Okular::Annotation *okl_ann, int page, bool appearanceChanged) override; 0035 void notifyRemoval(Okular::Annotation *okl_ann, int page) override; 0036 0037 private: 0038 Poppler::Document *ppl_doc; 0039 QMutex *mutex; 0040 QHash<Okular::Annotation *, Poppler::Annotation *> *annotationsOnOpenHash; 0041 std::unordered_map<Okular::StampAnnotation *, std::unique_ptr<Poppler::AnnotationAppearance>> deletedStampsAnnotationAppearance; 0042 }; 0043 0044 #endif