mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2024-12-28 01:00:40 +01:00
101 lines
3.2 KiB
C++
101 lines
3.2 KiB
C++
// Copyright (C) 2020-2021 Jakub Melka
|
|
//
|
|
// This file is part of Pdf4Qt.
|
|
//
|
|
// Pdf4Qt is free software: you can redistribute it and/or modify
|
|
// 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
|
|
// with the written consent of the copyright owner, any later version.
|
|
//
|
|
// Pdf4Qt is distributed in the hope that it will be useful,
|
|
// 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
|
|
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#ifndef PDFTOOLAUDIOBOOK_H
|
|
#define PDFTOOLAUDIOBOOK_H
|
|
|
|
#include "pdftoolabstractapplication.h"
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
struct ISpObjectToken;
|
|
|
|
namespace pdf
|
|
{
|
|
class PDFDocumentTextFlow;
|
|
}
|
|
|
|
namespace pdftool
|
|
{
|
|
|
|
class PDFVoiceInfo
|
|
{
|
|
public:
|
|
PDFVoiceInfo() = default;
|
|
PDFVoiceInfo(std::map<QString, QString> properties, ISpObjectToken* voiceToken);
|
|
|
|
PDFVoiceInfo(const PDFVoiceInfo&) = delete;
|
|
PDFVoiceInfo(PDFVoiceInfo&& other);
|
|
PDFVoiceInfo& operator=(const PDFVoiceInfo&) = delete;
|
|
PDFVoiceInfo& operator=(PDFVoiceInfo&&other);
|
|
|
|
~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;
|
|
ISpObjectToken* getVoiceToken() const { return m_voiceToken; }
|
|
|
|
private:
|
|
std::map<QString, QString> m_properties;
|
|
ISpObjectToken* m_voiceToken = nullptr;
|
|
};
|
|
|
|
using PDFVoiceInfoList = std::vector<PDFVoiceInfo>;
|
|
|
|
class PDFToolAudioBookBase : public PDFToolAbstractApplication
|
|
{
|
|
public:
|
|
PDFToolAudioBookBase() = default;
|
|
|
|
protected:
|
|
int fillVoices(const PDFToolOptions& options, PDFVoiceInfoList& list, bool fillVoiceTokenPointers);
|
|
int showVoiceList(const PDFToolOptions& options);
|
|
};
|
|
|
|
class PDFToolAudioBookVoices : public PDFToolAudioBookBase
|
|
{
|
|
public:
|
|
virtual QString getStandardString(StandardString standardString) const override;
|
|
virtual int execute(const PDFToolOptions& options) override;
|
|
virtual Options getOptionsFlags() const override;
|
|
};
|
|
|
|
class PDFToolAudioBook : public PDFToolAudioBookBase
|
|
{
|
|
public:
|
|
virtual QString getStandardString(StandardString standardString) const override;
|
|
virtual int execute(const PDFToolOptions& options) override;
|
|
virtual Options getOptionsFlags() const override;
|
|
|
|
private:
|
|
int getDocumentTextFlow(const PDFToolOptions& options, pdf::PDFDocumentTextFlow& flow);
|
|
int createAudioBook(const PDFToolOptions& options, pdf::PDFDocumentTextFlow& flow);
|
|
};
|
|
|
|
} // namespace pdftool
|
|
|
|
#endif
|
|
|
|
#endif // PDFTOOLAUDIOBOOK_H
|