mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
AudioBook Plugin: create audio book stream
This commit is contained in:
@ -974,6 +974,27 @@ PDFDocumentTextFlowEditor::PageIndicesMappingRange PDFDocumentTextFlowEditor::ge
|
||||
return std::equal_range(m_pageIndicesMapping.cbegin(), m_pageIndicesMapping.cend(), std::make_pair(pageIndex, size_t(0)), comparator);
|
||||
}
|
||||
|
||||
PDFDocumentTextFlow PDFDocumentTextFlowEditor::createEditedTextFlow() const
|
||||
{
|
||||
PDFDocumentTextFlow::Items items;
|
||||
items.reserve(getItemCount());
|
||||
|
||||
const size_t size = getItemCount();
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
if (isRemoved(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PDFDocumentTextFlow::Item item = *getOriginalItem(i);
|
||||
item.text = getText(i);
|
||||
items.emplace_back(std::move(item));
|
||||
}
|
||||
|
||||
return PDFDocumentTextFlow(std::move(items));
|
||||
}
|
||||
|
||||
void PDFDocumentTextFlowEditor::createPageMapping()
|
||||
{
|
||||
m_pageIndicesMapping.clear();
|
||||
|
@ -261,6 +261,11 @@ public:
|
||||
|
||||
const EditedItem* getEditedItem(size_t index) const { return &m_editedTextFlow.at(index); }
|
||||
|
||||
/// Creates text flow from active edited items. If item is removed,
|
||||
/// then it is not added into this text flow. User text modification
|
||||
/// is applied to a text flow.
|
||||
PDFDocumentTextFlow createEditedTextFlow() const;
|
||||
|
||||
private:
|
||||
void createPageMapping();
|
||||
void createEditedFromOriginalTextFlow();
|
||||
|
@ -54,9 +54,19 @@ public:
|
||||
explicit IPluginDataExchange() = default;
|
||||
virtual ~IPluginDataExchange() = default;
|
||||
|
||||
struct VoiceSettings
|
||||
{
|
||||
QString directory;
|
||||
QString voiceName;
|
||||
double volume = 1.0;
|
||||
double rate = 0.0;
|
||||
double pitch = 0.0;
|
||||
};
|
||||
|
||||
virtual QString getOriginalFileName() const = 0;
|
||||
virtual pdf::PDFTextSelection getSelectedText() const = 0;
|
||||
virtual QMainWindow* getMainWindow() const = 0;
|
||||
virtual VoiceSettings getVoiceSettings() const = 0;
|
||||
};
|
||||
|
||||
class PDF4QTLIBSHARED_EXPORT PDFPlugin : public QObject
|
||||
|
Reference in New Issue
Block a user