mirror of
https://invent.kde.org/graphics/okular
synced 2024-11-05 18:34:53 +00:00
8b3dfcb3f4
By using Poppler 20.10 new custom image stamps APIs Instead of the incompatible hack we used before that only worked for Okular. This is done by modifying the update function used by PopplerAnnotationProxy in order to load the image in the correct dimensions and send it to the poppler-Qt5 frontend. We temporarily store the stamp annotation appearance when deleting it so that we can set it again when doing an undo undo.
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2012 Fabio D 'Urso <fabiodurso@hotmail.it>
|
|
|
|
Work sponsored by the LiMux project of the city of Munich:
|
|
SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef _OKULAR_GENERATOR_PDF_ANNOTS_H_
|
|
#define _OKULAR_GENERATOR_PDF_ANNOTS_H_
|
|
|
|
#include <poppler-annotation.h>
|
|
#include <poppler-qt5.h>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include "config-okular-poppler.h"
|
|
#include "core/annotations.h"
|
|
|
|
extern Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *popplerAnnotation, const Poppler::Page &popplerPage, bool *doDelete);
|
|
|
|
class PopplerAnnotationProxy : public Okular::AnnotationProxy
|
|
{
|
|
public:
|
|
PopplerAnnotationProxy(Poppler::Document *doc, QMutex *userMutex, QHash<Okular::Annotation *, Poppler::Annotation *> *annotsOnOpenHash);
|
|
~PopplerAnnotationProxy() override;
|
|
|
|
bool supports(Capability capability) const override;
|
|
void notifyAddition(Okular::Annotation *okl_ann, int page) override;
|
|
void notifyModification(const Okular::Annotation *okl_ann, int page, bool appearanceChanged) override;
|
|
void notifyRemoval(Okular::Annotation *okl_ann, int page) override;
|
|
|
|
private:
|
|
Poppler::Document *ppl_doc;
|
|
QMutex *mutex;
|
|
QHash<Okular::Annotation *, Poppler::Annotation *> *annotationsOnOpenHash;
|
|
#ifdef HAVE_POPPLER_21_10
|
|
std::unordered_map<Okular::StampAnnotation *, std::unique_ptr<Poppler::AnnotationAppearance>> deletedStampsAnnotationAppearance;
|
|
#endif
|
|
};
|
|
|
|
#endif
|