2021-04-30 20:12:10 +02:00
|
|
|
// Copyright (C) 2020-2021 Jakub Melka
|
2020-11-17 18:28:34 +01:00
|
|
|
//
|
2021-08-10 19:22:56 +02:00
|
|
|
// This file is part of PDF4QT.
|
2020-11-17 18:28:34 +01:00
|
|
|
//
|
2021-08-10 19:22:56 +02:00
|
|
|
// PDF4QT is free software: you can redistribute it and/or modify
|
2020-11-17 18:28:34 +01:00
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
2021-04-30 20:12:10 +02:00
|
|
|
// with the written consent of the copyright owner, any later version.
|
2020-11-17 18:28:34 +01:00
|
|
|
//
|
2021-08-10 19:22:56 +02:00
|
|
|
// PDF4QT is distributed in the hope that it will be useful,
|
2020-11-17 18:28:34 +01:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
2021-08-10 19:22:56 +02:00
|
|
|
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
2020-11-17 18:28:34 +01:00
|
|
|
|
|
|
|
#ifndef PDFPLUGIN_H
|
|
|
|
#define PDFPLUGIN_H
|
|
|
|
|
|
|
|
#include "pdfdocument.h"
|
2020-12-30 18:26:45 +01:00
|
|
|
#include "pdftextlayout.h"
|
2020-11-17 18:28:34 +01:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
2020-11-19 19:54:33 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class QAction;
|
2021-08-19 17:51:35 +02:00
|
|
|
class QMainWindow;
|
2020-11-19 19:54:33 +01:00
|
|
|
|
2020-11-17 18:28:34 +01:00
|
|
|
namespace pdf
|
|
|
|
{
|
|
|
|
class PDFWidget;
|
2020-12-25 19:01:08 +01:00
|
|
|
class PDFCMSManager;
|
2020-11-17 18:28:34 +01:00
|
|
|
|
2021-08-10 19:22:56 +02:00
|
|
|
struct PDF4QTLIBSHARED_EXPORT PDFPluginInfo
|
2020-11-17 18:28:34 +01:00
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
QString author;
|
|
|
|
QString version;
|
|
|
|
QString license;
|
|
|
|
QString description;
|
2021-04-29 19:33:35 +02:00
|
|
|
QString pluginFile;
|
|
|
|
QString pluginFileWithPath;
|
2020-11-17 18:28:34 +01:00
|
|
|
|
|
|
|
static PDFPluginInfo loadFromJson(const QJsonObject* json);
|
|
|
|
};
|
|
|
|
using PDFPluginInfos = std::vector<PDFPluginInfo>;
|
|
|
|
|
2020-12-29 18:33:25 +01:00
|
|
|
class IPluginDataExchange
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit IPluginDataExchange() = default;
|
|
|
|
virtual ~IPluginDataExchange() = default;
|
|
|
|
|
2021-08-28 16:11:44 +02:00
|
|
|
struct VoiceSettings
|
|
|
|
{
|
|
|
|
QString directory;
|
|
|
|
QString voiceName;
|
|
|
|
double volume = 1.0;
|
|
|
|
double rate = 0.0;
|
|
|
|
double pitch = 0.0;
|
|
|
|
};
|
|
|
|
|
2020-12-29 18:33:25 +01:00
|
|
|
virtual QString getOriginalFileName() const = 0;
|
2020-12-30 18:26:45 +01:00
|
|
|
virtual pdf::PDFTextSelection getSelectedText() const = 0;
|
2021-08-19 17:51:35 +02:00
|
|
|
virtual QMainWindow* getMainWindow() const = 0;
|
2021-08-28 16:11:44 +02:00
|
|
|
virtual VoiceSettings getVoiceSettings() const = 0;
|
2020-12-29 18:33:25 +01:00
|
|
|
};
|
|
|
|
|
2021-08-10 19:22:56 +02:00
|
|
|
class PDF4QTLIBSHARED_EXPORT PDFPlugin : public QObject
|
2020-11-17 18:28:34 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit PDFPlugin(QObject* parent);
|
|
|
|
|
2020-12-29 18:33:25 +01:00
|
|
|
virtual void setDataExchangeInterface(IPluginDataExchange* dataExchangeInterface);
|
2020-11-17 18:28:34 +01:00
|
|
|
virtual void setWidget(PDFWidget* widget);
|
2020-12-25 19:01:08 +01:00
|
|
|
virtual void setCMSManager(PDFCMSManager* manager);
|
2020-11-17 18:28:34 +01:00
|
|
|
virtual void setDocument(const PDFModifiedDocument& document);
|
2020-11-19 19:54:33 +01:00
|
|
|
virtual std::vector<QAction*> getActions() const;
|
|
|
|
|
|
|
|
protected:
|
2020-12-29 18:33:25 +01:00
|
|
|
IPluginDataExchange* m_dataExchangeInterface;
|
2020-11-19 19:54:33 +01:00
|
|
|
PDFWidget* m_widget;
|
2020-12-25 19:01:08 +01:00
|
|
|
PDFCMSManager* m_cmsManager;
|
2020-11-19 19:54:33 +01:00
|
|
|
PDFDocument* m_document;
|
2020-11-17 18:28:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pdf
|
|
|
|
|
|
|
|
#endif // PDFPLUGIN_H
|