2021-04-30 20:12:10 +02:00
|
|
|
// Copyright (C) 2020-2021 Jakub Melka
|
2020-10-18 17:49:16 +02:00
|
|
|
//
|
2021-08-10 19:22:56 +02:00
|
|
|
// This file is part of PDF4QT.
|
2020-10-18 17:49:16 +02:00
|
|
|
//
|
2021-08-10 19:22:56 +02:00
|
|
|
// PDF4QT is free software: you can redistribute it and/or modify
|
2020-10-18 17:49:16 +02: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-10-18 17:49:16 +02:00
|
|
|
//
|
2021-08-10 19:22:56 +02:00
|
|
|
// PDF4QT is distributed in the hope that it will be useful,
|
2020-10-18 17:49:16 +02: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-10-18 17:49:16 +02:00
|
|
|
|
|
|
|
#ifndef PDFTOOLAUDIOBOOK_H
|
|
|
|
#define PDFTOOLAUDIOBOOK_H
|
|
|
|
|
|
|
|
#include "pdftoolabstractapplication.h"
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
2020-10-22 18:49:56 +02:00
|
|
|
struct ISpObjectToken;
|
2020-10-18 17:49:16 +02:00
|
|
|
|
2020-10-21 18:32:04 +02:00
|
|
|
namespace pdf
|
|
|
|
{
|
|
|
|
class PDFDocumentTextFlow;
|
|
|
|
}
|
|
|
|
|
2020-10-18 17:49:16 +02:00
|
|
|
namespace pdftool
|
|
|
|
{
|
|
|
|
|
|
|
|
class PDFVoiceInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PDFVoiceInfo() = default;
|
2020-10-22 18:49:56 +02:00
|
|
|
PDFVoiceInfo(std::map<QString, QString> properties, ISpObjectToken* voiceToken);
|
2020-10-18 17:49:16 +02:00
|
|
|
|
|
|
|
PDFVoiceInfo(const PDFVoiceInfo&) = delete;
|
2020-10-22 18:49:56 +02:00
|
|
|
PDFVoiceInfo(PDFVoiceInfo&& other);
|
2020-10-18 17:49:16 +02:00
|
|
|
PDFVoiceInfo& operator=(const PDFVoiceInfo&) = delete;
|
2020-10-22 18:49:56 +02:00
|
|
|
PDFVoiceInfo& operator=(PDFVoiceInfo&&other);
|
2020-10-18 17:49:16 +02:00
|
|
|
|
|
|
|
~PDFVoiceInfo();
|
|
|
|
|
|
|
|
QString getName() const { return getStringValue("Name"); }
|
|
|
|
QString getGender() const { return getStringValue("Gender"); }
|
|
|
|
QString getAge() const { return getStringValue("Age"); }
|
|
|
|
QString getVendor() const { return getStringValue("Vendor"); }
|
|
|
|
QString getLanguage() const { return getStringValue("Language"); }
|
|
|
|
QString getVersion() const { return getStringValue("Version"); }
|
|
|
|
QLocale getLocale() const;
|
|
|
|
|
|
|
|
QString getStringValue(QString key) const;
|
2020-10-22 18:49:56 +02:00
|
|
|
ISpObjectToken* getVoiceToken() const { return m_voiceToken; }
|
2020-10-18 17:49:16 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::map<QString, QString> m_properties;
|
2020-10-22 18:49:56 +02:00
|
|
|
ISpObjectToken* m_voiceToken = nullptr;
|
2020-10-18 17:49:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
using PDFVoiceInfoList = std::vector<PDFVoiceInfo>;
|
|
|
|
|
2020-10-19 18:51:30 +02:00
|
|
|
class PDFToolAudioBookBase : public PDFToolAbstractApplication
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PDFToolAudioBookBase() = default;
|
|
|
|
|
|
|
|
protected:
|
2020-10-22 18:49:56 +02:00
|
|
|
int fillVoices(const PDFToolOptions& options, PDFVoiceInfoList& list, bool fillVoiceTokenPointers);
|
2020-10-19 18:51:30 +02:00
|
|
|
int showVoiceList(const PDFToolOptions& options);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PDFToolAudioBookVoices : public PDFToolAudioBookBase
|
2020-10-18 17:49:16 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual QString getStandardString(StandardString standardString) const override;
|
|
|
|
virtual int execute(const PDFToolOptions& options) override;
|
|
|
|
virtual Options getOptionsFlags() const override;
|
2020-10-19 18:51:30 +02:00
|
|
|
};
|
2020-10-18 17:49:16 +02:00
|
|
|
|
2020-10-19 18:51:30 +02:00
|
|
|
class PDFToolAudioBook : public PDFToolAudioBookBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual QString getStandardString(StandardString standardString) const override;
|
|
|
|
virtual int execute(const PDFToolOptions& options) override;
|
|
|
|
virtual Options getOptionsFlags() const override;
|
2020-10-21 18:32:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
int getDocumentTextFlow(const PDFToolOptions& options, pdf::PDFDocumentTextFlow& flow);
|
|
|
|
int createAudioBook(const PDFToolOptions& options, pdf::PDFDocumentTextFlow& flow);
|
2020-10-18 17:49:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pdftool
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // PDFTOOLAUDIOBOOK_H
|