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>.
Loading...
Searching...
No Matches
QPdfDocumentPrivate Class Reference

#include <qpdfdocument_p.h>

+ Inheritance diagram for QPdfDocumentPrivate:
+ Collaboration diagram for QPdfDocumentPrivate:

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

QPdfDocumentq
 
QPdfPageModelpageModel = nullptr
 
FPDF_AVAIL avail
 
FPDF_DOCUMENT doc
 
bool loadComplete
 
QPointer< QIODevicedevice
 
QScopedPointer< QIODeviceownDevice
 
QBuffer asyncBuffer
 
QPointer< QIODevicesequentialSourceDevice
 
QByteArray password
 
QPdfDocument::Status status
 
QPdfDocument::Error lastError
 
int pageCount
 

Detailed Description

Definition at line 41 of file qpdfdocument_p.h.

Member Enumeration Documentation

◆ QFPDFRotation

Enumerator
Normal 
ClockWise90 
ClockWise180 
CounterClockWise90 

Definition at line 91 of file qpdfdocument_p.h.

Constructor & Destructor Documentation

◆ QPdfDocumentPrivate()

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.

+ Here is the call graph for this function:

◆ ~QPdfDocumentPrivate()

QPdfDocumentPrivate::~QPdfDocumentPrivate ( )

Definition at line 140 of file qpdfdocument.cpp.

References libraryRefCount, lock, and qCDebug.

Member Function Documentation

◆ _q_copyFromSequentialSourceDevice()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkComplete()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPageComplete()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fpdf_AddSegment()

void QPdfDocumentPrivate::fpdf_AddSegment ( struct _FX_DOWNLOADHINTS * pThis,
size_t offset,
size_t size )
static

Definition at line 442 of file qpdfdocument.cpp.

References Q_UNUSED.

Referenced by QPdfDocumentPrivate().

+ Here is the caller graph for this function:

◆ fpdf_GetBlock()

int QPdfDocumentPrivate::fpdf_GetBlock ( void * param,
unsigned long position,
unsigned char * pBuf,
unsigned long size )
static

Definition at line 434 of file qpdfdocument.cpp.

References d, device, position(), qMax(), and QIODevice::seek().

Referenced by QPdfDocumentPrivate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fpdf_IsDataAvail()

FPDF_BOOL QPdfDocumentPrivate::fpdf_IsDataAvail ( struct _FX_FILEAVAIL * pThis,
size_t offset,
size_t size )
static

Definition at line 428 of file qpdfdocument.cpp.

References d.

Referenced by QPdfDocumentPrivate().

+ Here is the caller graph for this function:

◆ getCharBox()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCharPosition()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getText()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hitTest()

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.

+ Here is the call graph for this function:

◆ initiateAsyncLoadWithTotalSizeKnown()

void QPdfDocumentPrivate::initiateAsyncLoadWithTotalSizeKnown ( quint64 totalSize)

Definition at line 301 of file qpdfdocument.cpp.

References avail, and lock.

Referenced by _q_tryLoadingWithSizeFromContentHeader(), and load().

+ Here is the caller graph for this function:

◆ load()

void QPdfDocumentPrivate::load ( QIODevice * device,
bool ownDevice )

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAsync()

void QPdfDocumentPrivate::loadAsync ( QIODevice * device)

◆ mapPageToView() [1/2]

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().

+ Here is the call graph for this function:

◆ mapPageToView() [2/2]

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapViewToPage()

QPointF QPdfDocumentPrivate::mapViewToPage ( FPDF_PAGE pdfPage,
QPointF position ) const

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStatus()

void QPdfDocumentPrivate::setStatus ( QPdfDocument::Status status)

Definition at line 419 of file qpdfdocument.cpp.

References emit, and status.

Referenced by _q_tryLoadingWithSizeFromContentHeader(), checkComplete(), QPdfDocument::close(), QPdfDocument::load(), QPdfDocument::load(), load(), and tryLoadDocument().

+ Here is the caller graph for this function:

◆ toFPDFRotation()

static constexpr QFPDFRotation QPdfDocumentPrivate::toFPDFRotation ( QPdfDocumentRenderOptions::Rotation rotation)
inlinestaticconstexpr

Definition at line 98 of file qpdfdocument_p.h.

References QPdfDocumentRenderOptions::Clockwise180, QPdfDocumentRenderOptions::Clockwise270, QPdfDocumentRenderOptions::Clockwise90, and QPdfDocumentRenderOptions::None.

Referenced by QPdfDocument::render().

+ Here is the caller graph for this function:

◆ tryLoadDocument()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLastError()

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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ asyncBuffer

QBuffer QPdfDocumentPrivate::asyncBuffer

◆ avail

◆ device

QPointer<QIODevice> QPdfDocumentPrivate::device

Definition at line 54 of file qpdfdocument_p.h.

Referenced by fpdf_GetBlock(), and load().

◆ doc

◆ lastError

QPdfDocument::Error QPdfDocumentPrivate::lastError

◆ loadComplete

bool QPdfDocumentPrivate::loadComplete

◆ ownDevice

QScopedPointer<QIODevice> QPdfDocumentPrivate::ownDevice

Definition at line 55 of file qpdfdocument_p.h.

Referenced by load().

◆ pageCount

int QPdfDocumentPrivate::pageCount

◆ pageModel

QPdfPageModel* QPdfDocumentPrivate::pageModel = nullptr

Definition at line 48 of file qpdfdocument_p.h.

◆ password

QByteArray QPdfDocumentPrivate::password

◆ q

QPdfDocument* QPdfDocumentPrivate::q

Definition at line 47 of file qpdfdocument_p.h.

Referenced by QPdfDocument::QPdfDocument().

◆ sequentialSourceDevice

QPointer<QIODevice> QPdfDocumentPrivate::sequentialSourceDevice

◆ status

QPdfDocument::Status QPdfDocumentPrivate::status

Definition at line 60 of file qpdfdocument_p.h.

Referenced by setStatus(), and QPdfDocument::status().


The documentation for this class was generated from the following files: