mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Text layouts for every page
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
|
||||
#include "pdfrenderer.h"
|
||||
#include "pdfpainter.h"
|
||||
#include "pdftextlayout.h"
|
||||
|
||||
#include <QCache>
|
||||
#include <QFuture>
|
||||
@ -72,6 +73,11 @@ public:
|
||||
/// \param compile Compile the page, if it is not found in the cache
|
||||
const PDFPrecompiledPage* getCompiledPage(PDFInteger pageIndex, bool compile);
|
||||
|
||||
/// Returns text layout of the page. If page index is invalid,
|
||||
/// then empty text layout is returned.
|
||||
/// \param pageIndex Page index
|
||||
PDFTextLayout getTextLayout(PDFInteger pageIndex);
|
||||
|
||||
signals:
|
||||
void pageImageChanged(bool all, const std::vector<PDFInteger>& pages);
|
||||
void renderingError(PDFInteger pageIndex, const QList<PDFRenderError>& errors);
|
||||
@ -79,6 +85,9 @@ signals:
|
||||
private:
|
||||
void onPageCompiled();
|
||||
|
||||
/// Returns text layouts for all pages
|
||||
PDFTextLayoutStorage getTextLayoutsImpl();
|
||||
|
||||
struct CompileTask
|
||||
{
|
||||
QFuture<PDFPrecompiledPage> taskFuture;
|
||||
@ -89,6 +98,7 @@ private:
|
||||
State m_state = State::Inactive;
|
||||
QCache<PDFInteger, PDFPrecompiledPage> m_cache;
|
||||
std::map<PDFInteger, CompileTask> m_tasks;
|
||||
PDFCachedItem<PDFTextLayoutStorage> m_textLayouts;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
Reference in New Issue
Block a user