Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <qpdfdocument_p.h>
Classes | |
struct | TextPosition |
Public Types | |
enum | QFPDFRotation { Normal = 0 , ClockWise90 = 1 , ClockWise180 = 2 , CounterClockWise90 = 3 } |
Public Member Functions | |
QPdfDocumentPrivate () | |
~QPdfDocumentPrivate () | |
void | clear () |
void | load (QIODevice *device, bool ownDevice) |
void | loadAsync (QIODevice *device) |
void | _q_tryLoadingWithSizeFromContentHeader () |
void | initiateAsyncLoadWithTotalSizeKnown (quint64 totalSize) |
void | _q_copyFromSequentialSourceDevice () |
void | tryLoadDocument () |
void | checkComplete () |
bool | checkPageComplete (int page) |
void | setStatus (QPdfDocument::Status status) |
void | updateLastError () |
QString | getText (FPDF_TEXTPAGE textPage, int startIndex, int count) const |
QPointF | getCharPosition (FPDF_PAGE pdfPage, FPDF_TEXTPAGE textPage, int charIndex) const |
QRectF | getCharBox (FPDF_PAGE pdfPage, FPDF_TEXTPAGE textPage, int charIndex) const |
QPointF | mapPageToView (FPDF_PAGE pdfPage, double x, double y) const |
QRectF | mapPageToView (FPDF_PAGE pdfPage, double left, double top, double right, double bottom) const |
QPointF | mapViewToPage (FPDF_PAGE pdfPage, QPointF position) const |
TextPosition | hitTest (int page, QPointF position) |
Static Public Member Functions | |
static FPDF_BOOL | fpdf_IsDataAvail (struct _FX_FILEAVAIL *pThis, size_t offset, size_t size) |
static int | fpdf_GetBlock (void *param, unsigned long position, unsigned char *pBuf, unsigned long size) |
static void | fpdf_AddSegment (struct _FX_DOWNLOADHINTS *pThis, size_t offset, size_t size) |
static constexpr QFPDFRotation | toFPDFRotation (QPdfDocumentRenderOptions::Rotation rotation) |
Public Attributes | |
QPdfDocument * | q |
QPdfPageModel * | pageModel = nullptr |
FPDF_AVAIL | avail |
FPDF_DOCUMENT | doc |
bool | loadComplete |
QPointer< QIODevice > | device |
QScopedPointer< QIODevice > | ownDevice |
QBuffer | asyncBuffer |
QPointer< QIODevice > | sequentialSourceDevice |
QByteArray | password |
QPdfDocument::Status | status |
QPdfDocument::Error | lastError |
int | pageCount |
Definition at line 41 of file qpdfdocument_p.h.
Enumerator | |
---|---|
Normal | |
ClockWise90 | |
ClockWise180 | |
CounterClockWise90 |
Definition at line 91 of file qpdfdocument_p.h.
QPdfDocumentPrivate::QPdfDocumentPrivate | ( | ) |
Definition at line 106 of file qpdfdocument.cpp.
References asyncBuffer, fpdf_AddSegment(), fpdf_GetBlock(), fpdf_IsDataAvail(), libraryRefCount, lock, QBuffer::open(), QByteArray(), qCDebug, QIODeviceBase::ReadWrite, QBuffer::setData(), QTimer::start(), and timer.
QPdfDocumentPrivate::~QPdfDocumentPrivate | ( | ) |
Definition at line 140 of file qpdfdocument.cpp.
References libraryRefCount, lock, and qCDebug.
void QPdfDocumentPrivate::_q_copyFromSequentialSourceDevice | ( | ) |
Definition at line 311 of file qpdfdocument.cpp.
References asyncBuffer, QIODevice::bytesAvailable(), checkComplete(), loadComplete, QIODevice::read(), QBuffer::seek(), sequentialSourceDevice, QBuffer::size(), and QIODevice::write().
Referenced by _q_tryLoadingWithSizeFromContentHeader().
void QPdfDocumentPrivate::_q_tryLoadingWithSizeFromContentHeader | ( | ) |
Definition at line 276 of file qpdfdocument.cpp.
References _q_copyFromSequentialSourceDevice(), avail, QIODevice::bytesAvailable(), QObject::connect(), QNetworkRequest::ContentLengthHeader, QPdfDocument::Error, QNetworkReply::header(), initiateAsyncLoadWithTotalSizeKnown(), QVariant::isValid(), sequentialSourceDevice, setStatus(), SIGNAL, SLOT, and QVariant::toULongLong().
Referenced by load().
void QPdfDocumentPrivate::checkComplete | ( | ) |
Definition at line 360 of file qpdfdocument.cpp.
References avail, doc, emit, i, loadComplete, lock, pageCount, QPdfDocument::Ready, setStatus(), and tryLoadDocument().
Referenced by _q_copyFromSequentialSourceDevice().
bool QPdfDocumentPrivate::checkPageComplete | ( | int | page | ) |
Definition at line 399 of file qpdfdocument.cpp.
References avail, loadComplete, lock, page, pageCount, and updateLastError().
Referenced by load(), QPdfDocument::pagePointSize(), and QPdfDocument::render().
void QPdfDocumentPrivate::clear | ( | ) |
Definition at line 152 of file qpdfdocument.cpp.
References asyncBuffer, avail, QBuffer::close(), QObject::disconnect(), doc, emit, loadComplete, lock, QBuffer::open(), pageCount, QByteArray(), QIODeviceBase::ReadWrite, sequentialSourceDevice, and QBuffer::setData().
Referenced by QPdfDocument::close().
|
static |
Definition at line 442 of file qpdfdocument.cpp.
References Q_UNUSED.
Referenced by QPdfDocumentPrivate().
|
static |
Definition at line 434 of file qpdfdocument.cpp.
References d, device, position(), qMax(), and QIODevice::seek().
Referenced by QPdfDocumentPrivate().
|
static |
Definition at line 428 of file qpdfdocument.cpp.
References d.
Referenced by QPdfDocumentPrivate().
QRectF QPdfDocumentPrivate::getCharBox | ( | FPDF_PAGE | pdfPage, |
FPDF_TEXTPAGE | textPage, | ||
int | charIndex ) const |
Definition at line 467 of file qpdfdocument.cpp.
References mapPageToView().
Referenced by QPdfDocument::getSelection(), and hitTest().
QPointF QPdfDocumentPrivate::getCharPosition | ( | FPDF_PAGE | pdfPage, |
FPDF_TEXTPAGE | textPage, | ||
int | charIndex ) const |
Definition at line 458 of file qpdfdocument.cpp.
References mapPageToView(), and qMin().
Referenced by QPdfDocument::getSelectionAtIndex(), and hitTest().
QString QPdfDocumentPrivate::getText | ( | FPDF_TEXTPAGE | textPage, |
int | startIndex, | ||
int | count ) const |
Definition at line 449 of file qpdfdocument.cpp.
References QString::fromUtf16(), and Q_ASSERT.
Referenced by QPdfDocument::getAllText(), QPdfDocument::getSelection(), and QPdfDocument::getSelectionAtIndex().
QPdfDocumentPrivate::TextPosition QPdfDocumentPrivate::hitTest | ( | int | page, |
QPointF | position ) |
Definition at line 527 of file qpdfdocument.cpp.
References CharacterHitTolerance, doc, getCharBox(), getCharPosition(), lock, mapViewToPage(), page, position(), qAbs(), and qCDebug.
Definition at line 301 of file qpdfdocument.cpp.
Referenced by _q_tryLoadingWithSizeFromContentHeader(), and load().
Definition at line 206 of file qpdfdocument.cpp.
References _q_tryLoadingWithSizeFromContentHeader(), asyncBuffer, avail, QIODevice::bytesAvailable(), checkPageComplete(), QObject::connect(), QNetworkRequest::ContentLengthHeader, device, doc, emit, QNetworkReply::error(), QPdfDocument::Error, QNetworkReply::finished(), QNetworkReply::header(), initiateAsyncLoadWithTotalSizeKnown(), QNetworkReply::isFinished(), QVariant::isValid(), lock, QNetworkReply::NoError, ownDevice, pageCount, qWarning, QPdfDocument::Ready, reply, QScopedPointer< T, Cleanup >::reset(), sequentialSourceDevice, setStatus(), SIGNAL, QIODevice::size(), SLOT, tryLoadDocument(), and updateLastError().
Referenced by QPdfDocument::load(), and QPdfDocument::load().
QRectF QPdfDocumentPrivate::mapPageToView | ( | FPDF_PAGE | pdfPage, |
double | left, | ||
double | top, | ||
double | right, | ||
double | bottom ) const |
Convert the bounding box defined by left top right and bottom to the usual 1x (pixels = points) 4th-quadrant "view" coordinate system that we use for rendering things on top of the page image. Some PDF files have internal transforms that make this coordinate system different from "page coordinates", so we cannot just subtract from page height to invert the y coordinates, in general.
Definition at line 500 of file qpdfdocument.cpp.
References qRound().
QPointF QPdfDocumentPrivate::mapPageToView | ( | FPDF_PAGE | pdfPage, |
double | x, | ||
double | y ) const |
Convert the point x , y to the usual 1x (pixels = points) 4th-quadrant "view" coordinate system relative to the top-left corner of the rendered page. Some PDF files have internal transforms that make this coordinate system different from "page coordinates", so we cannot just subtract from page height to invert the y coordinates, in general.
Definition at line 482 of file qpdfdocument.cpp.
References qRound(), rx(), and ry().
Referenced by QPdfSearchModelPrivate::doSearch(), QPdfDocument::getAllText(), getCharBox(), getCharPosition(), QPdfDocument::getSelection(), QPdfDocument::getSelectionAtIndex(), and QPdfLinkModelPrivate::update().
Convert the point x , y from the usual 1x (pixels = points) 4th-quadrant "view" coordinate system relative to the top-left corner of the rendered page, to "page coordinates" suited to the given pdfPage, which may have arbitrary internal transforms.
Definition at line 517 of file qpdfdocument.cpp.
References position(), qRound(), rx(), and ry().
Referenced by QPdfDocument::getSelection(), and hitTest().
void QPdfDocumentPrivate::setStatus | ( | QPdfDocument::Status | status | ) |
Definition at line 419 of file qpdfdocument.cpp.
Referenced by _q_tryLoadingWithSizeFromContentHeader(), checkComplete(), QPdfDocument::close(), QPdfDocument::load(), QPdfDocument::load(), load(), and tryLoadDocument().
|
inlinestaticconstexpr |
Definition at line 98 of file qpdfdocument_p.h.
References QPdfDocumentRenderOptions::Clockwise180, QPdfDocumentRenderOptions::Clockwise270, QPdfDocumentRenderOptions::Clockwise90, and QPdfDocumentRenderOptions::None.
Referenced by QPdfDocument::render().
void QPdfDocumentPrivate::tryLoadDocument | ( | ) |
Definition at line 326 of file qpdfdocument.cpp.
References avail, QPdfDocument::DataNotYetAvailable, doc, emit, QPdfDocument::Error, QPdfDocument::IncorrectPassword, lastError, lock, QPdfDocument::None, password, Q_ASSERT, qCDebug, setStatus(), and updateLastError().
Referenced by checkComplete(), and load().
void QPdfDocumentPrivate::updateLastError | ( | ) |
Definition at line 181 of file qpdfdocument.cpp.
References doc, error, QPdfDocument::FileNotFound, QPdfDocument::IncorrectPassword, QPdfDocument::InvalidFileFormat, lastError, lock, QPdfDocument::None, qCDebug, QPdfDocument::Unknown, and QPdfDocument::UnsupportedSecurityScheme.
Referenced by checkPageComplete(), load(), and tryLoadDocument().
QBuffer QPdfDocumentPrivate::asyncBuffer |
Definition at line 56 of file qpdfdocument_p.h.
Referenced by QPdfDocumentPrivate(), _q_copyFromSequentialSourceDevice(), clear(), and load().
FPDF_AVAIL QPdfDocumentPrivate::avail |
Definition at line 50 of file qpdfdocument_p.h.
Referenced by _q_tryLoadingWithSizeFromContentHeader(), checkComplete(), checkPageComplete(), clear(), initiateAsyncLoadWithTotalSizeKnown(), load(), and tryLoadDocument().
Definition at line 54 of file qpdfdocument_p.h.
Referenced by fpdf_GetBlock(), and load().
FPDF_DOCUMENT QPdfDocumentPrivate::doc |
Definition at line 51 of file qpdfdocument_p.h.
Referenced by checkComplete(), clear(), QPdfDocument::close(), QPdfSearchModelPrivate::doSearch(), QPdfDocument::getAllText(), QPdfDocument::getSelection(), QPdfDocument::getSelectionAtIndex(), hitTest(), load(), QPdfDocument::metaData(), QPdfDocument::pageLabel(), QPdfDocument::pagePointSize(), QPdfBookmarkModelPrivate::rebuild(), QPdfDocument::render(), tryLoadDocument(), QPdfLinkModelPrivate::update(), and updateLastError().
QPdfDocument::Error QPdfDocumentPrivate::lastError |
Definition at line 61 of file qpdfdocument_p.h.
Referenced by QPdfDocument::error(), QPdfDocument::load(), tryLoadDocument(), and updateLastError().
bool QPdfDocumentPrivate::loadComplete |
Definition at line 52 of file qpdfdocument_p.h.
Referenced by _q_copyFromSequentialSourceDevice(), checkComplete(), checkPageComplete(), and clear().
QScopedPointer<QIODevice> QPdfDocumentPrivate::ownDevice |
Definition at line 55 of file qpdfdocument_p.h.
Referenced by load().
int QPdfDocumentPrivate::pageCount |
Definition at line 62 of file qpdfdocument_p.h.
Referenced by checkComplete(), checkPageComplete(), clear(), load(), QPdfDocument::pageCount(), and QPdfDocument::pageIndexForLabel().
QPdfPageModel* QPdfDocumentPrivate::pageModel = nullptr |
Definition at line 48 of file qpdfdocument_p.h.
QByteArray QPdfDocumentPrivate::password |
Definition at line 58 of file qpdfdocument_p.h.
Referenced by QPdfDocument::close(), QPdfDocument::password(), QPdfDocument::setPassword(), and tryLoadDocument().
QPdfDocument* QPdfDocumentPrivate::q |
Definition at line 47 of file qpdfdocument_p.h.
Referenced by QPdfDocument::QPdfDocument().
Definition at line 57 of file qpdfdocument_p.h.
Referenced by _q_copyFromSequentialSourceDevice(), _q_tryLoadingWithSizeFromContentHeader(), clear(), and load().
QPdfDocument::Status QPdfDocumentPrivate::status |
Definition at line 60 of file qpdfdocument_p.h.
Referenced by setStatus(), and QPdfDocument::status().