File indexing completed on 2024-12-29 04:51:01
0001 /* 0002 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <KItinerary/ExtractorDocumentProcessor> 0010 #include <KItinerary/PdfImage> 0011 0012 #include <unordered_set> 0013 0014 namespace KItinerary { 0015 0016 /** PDF document processor. */ 0017 class PdfDocumentProcessor : public ExtractorDocumentProcessor 0018 { 0019 public: 0020 PdfDocumentProcessor(); 0021 ~PdfDocumentProcessor(); 0022 0023 bool canHandleData(const QByteArray &encodedData, QStringView fileName) const override; 0024 ExtractorDocumentNode createNodeFromData(const QByteArray &encodedData) const override; 0025 ExtractorDocumentNode createNodeFromContent(const QVariant &decodedData) const override; 0026 void expandNode(ExtractorDocumentNode &node, const ExtractorEngine *engine) const override; 0027 void postExtract(ExtractorDocumentNode &node, const ExtractorEngine *engine) const override; 0028 QJSValue contentToScriptValue(const ExtractorDocumentNode &node, QJSEngine *engine) const override; 0029 void destroyNode(ExtractorDocumentNode &node) const override; 0030 0031 private: 0032 mutable std::unordered_set<PdfImageRef> m_imageIds; 0033 }; 0034 0035 } 0036