xpdf
4.04
About: Xpdf is a PDF viewer for X.
![]() ![]() |
A PDF viewer widget class for Qt. More...
#include <XpdfWidget.h>
Public Types | |
enum | ErrorCode { pdfOk = 0 , pdfErrOpenFile = 1 , pdfErrBadCatalog = 2 , pdfErrDamaged = 3 , pdfErrEncrypted = 4 , pdfErrHighlightFile = 5 , pdfErrBadPrinter = 6 , pdfErrPrinting = 7 , pdfErrPermission = 8 , pdfErrBadPageNum = 9 , pdfErrFileIO = 10 , pdfErrNoHandle = 1001 , pdfErrOutOfMemory = 1002 , pdfErrBusy = 1003 , pdfErrBadArg = 1004 } |
Error codes returned by certain XpdfViewer functions. More... | |
enum | DisplayMode { pdfDisplaySingle , pdfDisplayContinuous , pdfDisplaySideBySideSingle , pdfDisplaySideBySideContinuous , pdfDisplayHorizontalContinuous } |
Display modes, to be passed to XpdfWidget::setDisplayMode(). More... | |
Static Public Attributes | |
Zoom values | |
Special values for XpdfWidget::setZoom() / XpdfWidget::getZoom() | |
static const int | zoomToPage = -1 |
zoom to fit whole page More... | |
static const int | zoomToWidth = -2 |
zoom to fit page width More... | |
static const int | zoomToHeight = -3 |
zoom to fit page height More... | |
Find flags | |
Flags to be passed to XpdfWidget::find() | |
static const int | findBackward = 0x00000001 |
search backward from the starting point More... | |
static const int | findCaseSensitive = 0x00000002 |
perform a case-sensitive search (default is case-insensitive) More... | |
static const int | findNext = 0x00000004 |
start searching from the previous search result More... | |
static const int | findOnePageOnly = 0x00000008 |
limit the search to the current page More... | |
static const int | findWholeWord = 0x00000010 |
limit the search to whole words More... | |
class | XpdfViewer |
static QMutex | initMutex |
QtPDFCore * | core |
double | scaleFactor |
bool | keyPassthrough |
bool | mousePassthrough |
int | lastMousePressX [3] |
int | lastMousePressY [3] |
ulong | lastMousePressTime [3] |
bool | lastMouseEventWasPress |
bool | touchPanEnabled |
bool | touchZoomEnabled |
double | pinchZoomStart |
QTimer * | tickTimer |
static void | init (const QString &configFileName=QString()) |
static void | setConfig (const QString &command) |
XpdfWidget (const QColor &paperColor=QColor(0xff, 0xff, 0xff), const QColor &matteColor=QColor(0x80, 0x80, 0x80), bool reverseVideo=false, QWidget *parentA=0) | |
XpdfWidget (QWidget *parentA, const QColor &paperColor=QColor(0xff, 0xff, 0xff), const QColor &matteColor=QColor(0x80, 0x80, 0x80), bool reverseVideo=false) | |
virtual | ~XpdfWidget () |
Destroys the XpdfWidget. More... | |
void | enableHyperlinks (bool on) |
void | enableExternalHyperlinks (bool on) |
void | enableSelect (bool on) |
void | enablePan (bool on) |
void | enableTouchPan (bool on) |
void | enableTouchZoom (bool on) |
void | setKeyPassthrough (bool on) |
void | setMousePassthrough (bool on) |
void | showPasswordDialog (bool showDlg) |
void | setMatteColor (const QColor &matteColor) |
void | setReverseVideo (bool reverse) |
Turn reverse video mode on/off. The default is off. More... | |
void | setCursor (const QCursor &cursor) |
void | unsetCursor () |
Reset to the default cursor. More... | |
ErrorCode | loadFile (const QString &fileName, const QString &password="") |
ErrorCode | loadMem (const char *buffer, unsigned int bufferLength, const QString &password="") |
ErrorCode | readDoc (XpdfDocHandle *docPtr, const QString &fileName, const QString &password="") |
Load a PDF file and return a handle. More... | |
ErrorCode | loadDoc (XpdfDocHandle doc) |
void | freeDoc (XpdfDocHandle doc) |
ErrorCode | reload () |
void | closeFile () |
ErrorCode | saveAs (const QString &fileName) |
QString | getFileName () const |
Get the file name of the currently open PDF file. More... | |
bool | hasOpenDocument () const |
Returns true if there is currently a PDF file open. More... | |
int | getNumPages () const |
int | getCurrentPage () const |
int | getMidPage () const |
void | gotoPage (int pageNum) |
Display the specified page. More... | |
void | gotoFirstPage () |
void | gotoLastPage () |
void | gotoNextPage (bool scrollToTop=true) |
Display the next page. More... | |
void | gotoPreviousPage (bool scrollToTop=true) |
Display the previous page. More... | |
bool | gotoNamedDestination (const QString &dest) |
Go to a named destination. More... | |
void | goForward () |
Go forward along the history list. More... | |
void | goBackward () |
Go backward along the history list. More... | |
void | scrollPageUp () |
Scroll one screen up. More... | |
void | scrollPageDown () |
Scroll one screen down. More... | |
void | scrollTo (int xx, int yy) |
void | scrollBy (int dx, int dy) |
int | getScrollX () const |
Return the current scroll position x coordinate. More... | |
int | getScrollY () const |
Return the current scroll position y coordinate. More... | |
void | setZoom (double zoom) |
double | getZoom () const |
double | getZoomPercent (int page=1) const |
void | zoomToRect (int page, double xMin, double yMin, double xMax, double yMax) |
void | zoomCentered (double zoom) |
void | zoomToCurrentWidth () |
void | setRotate (int rotate) |
int | getRotate () const |
void | setContinuousMode (bool continuous) |
bool | getContinuousMode () const |
void | setDisplayMode (DisplayMode mode) |
Set the display mode. More... | |
DisplayMode | getDisplayMode () |
Return the current display mode. More... | |
bool | mouseOverLink () |
Returns true if the mouse is currently over a hyperlink. More... | |
bool | onLink (int page, double xx, double yy) |
QString | getLinkInfo (int page, double xx, double yy) |
QString | getMouseLinkInfo () |
bool | gotoLinkAt (int page, double xx, double yy) |
XpdfAnnotHandle | onAnnot (int page, double xx, double yy) |
QString | getAnnotType (XpdfAnnotHandle annot) |
Get the annotation type. More... | |
QString | getAnnotContent (XpdfAnnotHandle annot) |
XpdfFormFieldHandle | onFormField (int page, double xx, double yy) |
QString | getFormFieldType (XpdfFormFieldHandle field) |
Get the form field's type. More... | |
QString | getFormFieldName (XpdfFormFieldHandle field) |
Get the form field's name. More... | |
QString | getFormFieldValue (XpdfFormFieldHandle field) |
void | getFormFieldBBox (XpdfFormFieldHandle field, int *pageNum, double *xMin, double *yMin, double *xMax, double *yMax) |
Get the form field's bounding box. More... | |
bool | convertWindowToPDFCoords (int winX, int winY, int *page, double *pdfX, double *pdfY) |
void | convertPDFToWindowCoords (int page, double pdfX, double pdfY, int *winX, int *winY) |
Convert PDF coordinates to window coordinates. More... | |
void | enableRedraw (bool enable) |
void | getPageBox (int page, const QString &box, double *xMin, double *yMin, double *xMax, double *yMax) const |
double | getPageWidth (int page) const |
double | getPageHeight (int page) const |
int | getPageRotation (int page) const |
bool | hasSelection () |
bool | getCurrentSelection (int *page, double *x0, double *y0, double *x1, double *y1) const |
void | setCurrentSelection (int page, double x0, double y0, double x1, double y1) |
void | clearSelection () |
Clear the selection. More... | |
bool | isBlockSelectMode () |
bool | isLinearSelectMode () |
void | setBlockSelectMode () |
void | setLinearSelectMode () |
void | setSelectionColor (const QColor &selectionColor) |
Set the selection color. More... | |
void | forceRedraw () |
Force a complete redraw. More... | |
QImage | convertPageToImage (int page, double dpi, bool transparent=false) |
QImage | convertRegionToImage (int page, double x0, double y0, double x1, double y1, double dpi, bool transparent=false) |
QImage | getThumbnail (int page) |
bool | okToExtractText () const |
void | setTextEncoding (const QString &encodingName) |
QString | extractText (int page, double x0, double y0, double x1, double y1) |
QString | getSelectedText () |
void | copySelection () |
Copy the current selection to the clipboard. More... | |
bool | find (const QString &text, int flags=0) |
QVector< XpdfFindResult > | findAll (const QString &text, int firstPage, int lastPage, int flags=0) |
bool | hasPageLabels () |
QString | getPageLabelFromPageNum (int pageNum) |
int | getPageNumFromPageLabel (QString pageLabel) |
int | getOutlineNumChildren (XpdfOutlineHandle outline) |
XpdfOutlineHandle | getOutlineChild (XpdfOutlineHandle outline, int idx) |
XpdfOutlineHandle | getOutlineParent (XpdfOutlineHandle outline) |
QString | getOutlineTitle (XpdfOutlineHandle outline) |
bool | getOutlineStartsOpen (XpdfOutlineHandle outline) |
Return true if the specified outline entry starts open. More... | |
int | getOutlineTargetPage (XpdfOutlineHandle outline) |
Return the target page number for the specified outline entry. More... | |
void | gotoOutlineTarget (XpdfOutlineHandle outline) |
Jump to the target of the specified outline entry. More... | |
int | getNumLayers () const |
XpdfLayerHandle | getLayer (int idx) const |
QString | getLayerName (XpdfLayerHandle layer) const |
bool | getLayerVisibility (XpdfLayerHandle layer) const |
void | setLayerVisibility (XpdfLayerHandle layer, bool visibility) |
int | getLayerViewState (XpdfLayerHandle layer) const |
int | getLayerPrintState (XpdfLayerHandle layer) const |
XpdfLayerOrderHandle | getLayerOrderRoot () const |
Get the root of the layer display order tree. More... | |
bool | getLayerOrderIsName (XpdfLayerOrderHandle order) const |
QString | getLayerOrderName (XpdfLayerOrderHandle order) const |
XpdfLayerHandle | getLayerOrderLayer (XpdfLayerOrderHandle order) |
Get the layer associated with a layer display order tree node. More... | |
int | getLayerOrderNumChildren (XpdfLayerOrderHandle order) |
XpdfLayerOrderHandle | getLayerOrderChild (XpdfLayerOrderHandle order, int idx) |
Returns the idx 'th child of a layer display order tree node. More... | |
XpdfLayerOrderHandle | getLayerOrderParent (XpdfLayerOrderHandle order) |
int | getNumEmbeddedFiles () |
Return the number of embedded files in the current PDF file. More... | |
QString | getEmbeddedFileName (int idx) |
Return the name of the idx 'th embedded file. More... | |
bool | saveEmbeddedFile (int idx, QString fileName) |
void | pageChange (int pageNum) |
void | midPageChange (int pageNum) |
void | preLoad () |
This signal is emitted just before a PDF file is loaded. More... | |
void | postLoad () |
This signal is emitted just after a PDF file is loaded. More... | |
void | keyPress (QKeyEvent *e) |
This signal is emitted whenever a key is pressed. More... | |
void | mousePress (QMouseEvent *e) |
This signal is emitted whenever a mouse button is pressed. More... | |
void | mouseRelease (QMouseEvent *e) |
This signal is emitted whenever a mouse button is released. More... | |
void | mouseClick (QMouseEvent *e) |
void | mouseDoubleClick (QMouseEvent *e) |
void | mouseTripleClick (QMouseEvent *e) |
void | mouseMove (QMouseEvent *e) |
This signal is emitted whenever the mouse pointer is moved. More... | |
void | mouseWheel (QWheelEvent *e) |
This signal is emitted whenever a mouse wheel is clicked. More... | |
void | linkClick (const QString &linkType, const QString &dest, int page) |
void | selectDone () |
void | paintDone (bool finished) |
void | resized () |
This signal is emitted when the widget is resized. More... | |
void | tick () |
void | setup (const QColor &paperColor, const QColor &matteColor, bool reverseVideo) |
bool | getLinkTarget (int page, double xx, double yy, QString &targetFileName, int &targetPage, QString &targetDest) |
static void | updateCbk (void *data, GString *fileName, int pageNum, int numPages, const char *linkLabel) |
static void | midPageChangedCbk (void *data, int pageNum) |
static void | preLoadCbk (void *data) |
static void | postLoadCbk (void *data) |
static void | linkCbk (void *data, const char *type, const char *dest, int page) |
static void | selectDoneCbk (void *data) |
static void | paintDoneCbk (void *data, bool finished) |
static void | tileDoneCbk (void *data) |
A PDF viewer widget class for Qt.
Definition at line 86 of file XpdfWidget.h.
Display modes, to be passed to XpdfWidget::setDisplayMode().
Definition at line 113 of file XpdfWidget.h.
Error codes returned by certain XpdfViewer functions.
Definition at line 92 of file XpdfWidget.h.
XpdfWidget::XpdfWidget | ( | const QColor & | paperColor = QColor(0xff, 0xff, 0xff) , |
const QColor & | matteColor = QColor(0x80, 0x80, 0x80) , |
||
bool | reverseVideo = false , |
||
QWidget * | parentA = 0 |
||
) |
The XpdfWidget constructor.
paperColor | the paper background color (which should generally be left as white) |
matteColor | the matte color displayed between pages, and around pages that are smaller than the window |
reverseVideo | sets reverse video at startup |
parentA | the parent QWidget |
Definition at line 64 of file XpdfWidget.cc.
References setup().
XpdfWidget::XpdfWidget | ( | QWidget * | parentA, |
const QColor & | paperColor = QColor(0xff, 0xff, 0xff) , |
||
const QColor & | matteColor = QColor(0x80, 0x80, 0x80) , |
||
bool | reverseVideo = false |
||
) |
The XpdfWidget constructor.
paperColor | the paper background color (which should generally be left as white) |
matteColor | the matte color displayed between pages, and around pages that are smaller than the window |
reverseVideo | sets reverse video at startup |
parentA | the parent QWidget This version has the parent argument first so it works correctly with Qt Designer. |
Definition at line 71 of file XpdfWidget.cc.
References setup().
|
virtual |
Destroys the XpdfWidget.
Definition at line 132 of file XpdfWidget.cc.
void XpdfWidget::clearSelection | ( | ) |
Clear the selection.
Definition at line 1142 of file XpdfWidget.cc.
References PDFCore::clearSelection(), and core.
void XpdfWidget::closeFile | ( | ) |
Close the currently open PDF file (if any). Calling this function is optional - the current PDF file will be automatically closed if XpdfWidget::loadFile or XpdfWidget::loadMem is called.
Definition at line 434 of file XpdfWidget.cc.
References PDFCore::clear(), and core.
Referenced by XpdfViewer::closeTab().
QImage XpdfWidget::convertPageToImage | ( | int | page, |
double | dpi, | ||
bool | transparent = false |
||
) |
Convert a page to a color image. This function converts the page number page to a 24-bit RGB bitmap, at a resolution of dpi dots per inch. If transparent is true, the returned image will be 32-bit ARGB instead, and will include an alpha channel.
Definition at line 1269 of file XpdfWidget.cc.
References core, PDFDoc::displayPage(), doc, SplashBitmap::getAlphaPtr(), SplashOutputDev::getBitmap(), SplashBitmap::getDataPtr(), PDFCore::getDoc(), SplashBitmap::getHeight(), PDFDoc::getNumPages(), PDFCore::getRotate(), SplashBitmap::getWidth(), PDFDoc::getXRef(), gFalse, gTrue, SplashOutputDev::setNoComposite(), splashModeRGB8, and SplashOutputDev::startDoc().
Referenced by XpdfViewer::execSaveImageDialog().
void XpdfWidget::convertPDFToWindowCoords | ( | int | page, |
double | pdfX, | ||
double | pdfY, | ||
int * | winX, | ||
int * | winY | ||
) |
Convert PDF coordinates to window coordinates.
Definition at line 1019 of file XpdfWidget.cc.
References core, and PDFCore::cvtUserToWindow().
QImage XpdfWidget::convertRegionToImage | ( | int | page, |
double | x0, | ||
double | y0, | ||
double | x1, | ||
double | y1, | ||
double | dpi, | ||
bool | transparent = false |
||
) |
Convert a rectangular region of a page to a color image. This function converts a rectangular region, defined by corners (x0,y0) and (x1,y1), of page number page to a 24-bit RGB bitmap, at a resolution of dpi dots per inch. If transparent is true, the returned image will be 32-bit ARGB instead, and will include an alpha channel.
Definition at line 1326 of file XpdfWidget.cc.
References core, PDFDoc::displayPageSlice(), doc, SplashBitmap::getAlphaPtr(), SplashOutputDev::getBitmap(), PDFDoc::getCatalog(), Page::getCropBox(), SplashBitmap::getDataPtr(), PDFCore::getDoc(), SplashBitmap::getHeight(), PDFDoc::getNumPages(), Catalog::getPage(), PDFDoc::getPageRotate(), PDFCore::getRotate(), SplashBitmap::getWidth(), PDFDoc::getXRef(), gFalse, gTrue, SplashOutputDev::setNoComposite(), splashModeRGB8, SplashOutputDev::startDoc(), PDFRectangle::x1, PDFRectangle::x2, PDFRectangle::y1, and PDFRectangle::y2.
Referenced by XpdfViewer::execSaveImageDialog().
bool XpdfWidget::convertWindowToPDFCoords | ( | int | winX, |
int | winY, | ||
int * | page, | ||
double * | pdfX, | ||
double * | pdfY | ||
) |
Convert window coordinates to PDF coordinates. Returns true if successful, i.e., if the specified point falls on a PDF page.
Definition at line 1009 of file XpdfWidget.cc.
References core, and PDFCore::cvtWindowToUser().
Referenced by XpdfViewer::cmdRun(), XpdfViewer::followLink(), XpdfViewer::mouseMove(), and mouseOverLink().
void XpdfWidget::copySelection | ( | ) |
Copy the current selection to the clipboard.
Definition at line 1559 of file XpdfWidget.cc.
References QtPDFCore::copySelection(), core, and gTrue.
Referenced by XpdfViewer::cmdCopy().
void XpdfWidget::enableExternalHyperlinks | ( | bool | on | ) |
Control handling of external hyperlinks. This setting allows disabling external hyperlinks (links that open another PDF file, or that involve a URL), independent of internal hyperlinks (links to locations within the same PDF file). This setting is ignored if all hyperlinks are disabled (enableHyperlinks(false)). The default is enabled.
Definition at line 214 of file XpdfWidget.cc.
References core, and QtPDFCore::enableExternalHyperlinks().
void XpdfWidget::enableHyperlinks | ( | bool | on | ) |
Control handling of hyperlinks. If enabled, the viewer will follow hyperlinks when clicked with the left mouse button. If disabled, the viewer will ignore left mouse button clicks on hyperlinks. The default is enabled.
Definition at line 207 of file XpdfWidget.cc.
References core, and QtPDFCore::enableHyperlinks().
Referenced by XpdfViewer::addTab().
void XpdfWidget::enablePan | ( | bool | on | ) |
Control mouse panning. If enabled, dragging with the middle mouse button pressed will pan the page. If disabled, the middle button is ignored. The default is enabled.
Definition at line 228 of file XpdfWidget.cc.
References core, and QtPDFCore::enablePan().
void XpdfWidget::enableRedraw | ( | bool | enable | ) |
Enable or disable window redraws. This is useful, e.g., for avoiding extra redraws during window resizing. Deprecated – this just calls setUpdatesEnabled().
Definition at line 1027 of file XpdfWidget.cc.
void XpdfWidget::enableSelect | ( | bool | on | ) |
Control handling of text selection. If enabled, the viewer will allow the user to select rectangular regions of text when the user drags with the left mouse button. If disabled, dragging with the left mouse button is ignored. The default is enabled.
Definition at line 221 of file XpdfWidget.cc.
References core, and QtPDFCore::enableSelect().
void XpdfWidget::enableTouchPan | ( | bool | on | ) |
Control touchscreen panning. If enabled, QPanGestures are recognized and used to pan the PDF view.
Definition at line 235 of file XpdfWidget.cc.
References touchPanEnabled.
void XpdfWidget::enableTouchZoom | ( | bool | on | ) |
Control touchscreen zooming. If enabled QPinchGestures are recognized and used to pinch-zoom the PDF view.
Definition at line 244 of file XpdfWidget.cc.
References touchZoomEnabled.
QString XpdfWidget::extractText | ( | int | page, |
double | x0, | ||
double | y0, | ||
double | x1, | ||
double | y1 | ||
) |
Extract text from a region of a page. This function extracts and returns text from the rectangular region, defined by corners (x0,y0) and (x1,y1), of page number page. The coordinates returned by XpdfWidget::getCurrentSelection may be passed directly to this function. Returns an empty string if no file is open or if text extraction is not allowed.
Definition at line 1519 of file XpdfWidget.cc.
References GString::append(), GString::cmp(), core, PDFCore::extractText(), GString::getChar(), GString::getCString(), PDFCore::getDoc(), GString::getLength(), GlobalParams::getTextEncodingName(), and globalParams.
bool XpdfWidget::find | ( | const QString & | text, |
int | flags = 0 |
||
) |
Find a text string. This function searches for a Unicode text string. Starts searching after (before, if searching backward) the current selection (if there is a selection), or at the top (bottom, if searching backward) of the current page (if there is no selection). The flags argument consists of zero or more of the following, or-ed together:
findBackward
- search backward from the starting pointfindCaseSensitive
- perform a case-sensitive search (default is case-insensitive)findNext
- start searching from the previous search resultfindOnePageOnly
- limit the search to the current pagefindWholeWord
- limit the search to whole words Definition at line 1566 of file XpdfWidget.cc.
References core, findBackward, findCaseSensitive, findNext, findOnePageOnly, QtPDFCore::findU(), findWholeWord, PDFCore::getDoc(), gFalse, gfree(), gmallocn(), gTrue, and u.
Referenced by XpdfViewer::cmdFindFirst(), XpdfViewer::cmdFindNext(), and XpdfViewer::cmdFindPrevious().
QVector< XpdfFindResult > XpdfWidget::findAll | ( | const QString & | text, |
int | firstPage, | ||
int | lastPage, | ||
int | flags = 0 |
||
) |
Find all occurrences of a text string. This function searches for a Unicode text string, in pages firstPage .. lastPage. The flags argument consists of zero or more of the following, or-ed together:
findCaseSensitive
- perform a case-sensitive search (default is case-insensitive)findWholeWord
- limit the search to whole words Returns a list of search results. Definition at line 1593 of file XpdfWidget.cc.
References core, deleteGList, PDFCore::findAll(), findCaseSensitive, findWholeWord, firstPage, GList::get(), PDFCore::getDoc(), GList::getLength(), gFalse, gfree(), gmallocn(), gTrue, lastPage, FindResult::page, u, FindResult::xMax, FindResult::xMin, FindResult::yMax, and FindResult::yMin.
void XpdfWidget::forceRedraw | ( | ) |
Force a complete redraw.
Definition at line 1192 of file XpdfWidget.cc.
References core, and PDFCore::forceRedraw().
void XpdfWidget::freeDoc | ( | XpdfDocHandle | doc | ) |
Free a PDF document. This function frees a PDF document handle created by XpdfWidget::readDoc. It should only be called if the document is not going to be displayed. That is: after calling XpdfWidget::readDoc, you should call either XpdfWidget::loadDoc or XpdfWidget::freeDoc. The document handle should not be used for anything else after calling this function.
Definition at line 419 of file XpdfWidget.cc.
References doc.
QString XpdfWidget::getAnnotContent | ( | XpdfAnnotHandle | annot | ) |
Get the annotation's content. Usage of this depends on the annotation type.
Definition at line 921 of file XpdfWidget.cc.
References Object::dictLookup(), Object::free(), TextString::getLength(), Object::getString(), TextString::getUnicode(), Object::isString(), and u.
QString XpdfWidget::getAnnotType | ( | XpdfAnnotHandle | annot | ) |
Get the annotation type.
Definition at line 913 of file XpdfWidget.cc.
bool XpdfWidget::getContinuousMode | ( | ) | const |
Return true if the viewer is in continuous view mode, or false if it is in any other mode. Deprecated: see getDisplayMode().
Definition at line 703 of file XpdfWidget.cc.
References core, displayContinuous, and PDFCore::getDisplayMode().
int XpdfWidget::getCurrentPage | ( | ) | const |
Return the currently displayed page number. Returns -1 if no file is open.
Definition at line 494 of file XpdfWidget.cc.
References core, and PDFCore::getPageNum().
bool XpdfWidget::getCurrentSelection | ( | int * | page, |
double * | x0, | ||
double * | y0, | ||
double * | x1, | ||
double * | y1 | ||
) | const |
Returns the current selection. If there is a currently active selection, sets *page, (*x0,*y0), and (*x1,*y1) to the page number and upper-left and lower-right coordinates, respectively, and returns true. If there is no selection, returns false.
Definition at line 1115 of file XpdfWidget.cc.
References core, and PDFCore::getSelection().
Referenced by XpdfViewer::cmdRun(), XpdfViewer::cmdZoomToSelection(), and XpdfViewer::execSaveImageDialog().
XpdfWidget::DisplayMode XpdfWidget::getDisplayMode | ( | ) |
Return the current display mode.
Definition at line 718 of file XpdfWidget.cc.
References core, PDFCore::getDisplayMode(), and pdfDisplaySingle.
Referenced by XpdfViewer::cmdSaveTabState(), XpdfViewer::cmdToggleContinuousMode(), XpdfViewer::enterFullScreenMode(), XpdfViewer::getContext(), and XpdfViewer::updateModeInfo().
QString XpdfWidget::getEmbeddedFileName | ( | int | idx | ) |
Return the name of the idx 'th embedded file.
Definition at line 1977 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), PDFDoc::getEmbeddedFileName(), PDFDoc::getEmbeddedFileNameLength(), PDFDoc::getNumEmbeddedFiles(), and name.
Referenced by XpdfViewer::fillAttachmentList().
QString XpdfWidget::getFileName | ( | ) | const |
Get the file name of the currently open PDF file.
Definition at line 468 of file XpdfWidget.cc.
References core, GString::getCString(), PDFCore::getDoc(), and PDFDoc::getFileName().
Referenced by XpdfViewer::checkOpen(), XpdfViewer::close(), XpdfViewer::closeTab(), XpdfViewer::cmdOpen(), XpdfViewer::cmdOpenIn(), XpdfViewer::cmdRun(), XpdfViewer::cmdSaveAs(), XpdfViewer::cmdSaveTabState(), XpdfViewer::open(), XpdfViewer::updateDocInfo(), and XpdfViewer::updateDocumentInfoDialog().
void XpdfWidget::getFormFieldBBox | ( | XpdfFormFieldHandle | field, |
int * | pageNum, | ||
double * | xMin, | ||
double * | yMin, | ||
double * | xMax, | ||
double * | yMax | ||
) |
Get the form field's bounding box.
Definition at line 999 of file XpdfWidget.cc.
QString XpdfWidget::getFormFieldName | ( | XpdfFormFieldHandle | field | ) |
QString XpdfWidget::getFormFieldType | ( | XpdfFormFieldHandle | field | ) |
Get the form field's type.
Definition at line 957 of file XpdfWidget.cc.
QString XpdfWidget::getFormFieldValue | ( | XpdfFormFieldHandle | field | ) |
Get the form field's content. Usage of this depends on the field type.
Definition at line 982 of file XpdfWidget.cc.
XpdfLayerHandle XpdfWidget::getLayer | ( | int | idx | ) | const |
Get a layer handle. This function returns a handle for the idx 'th layer.
Definition at line 1791 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), OptionalContent::getNumOCGs(), OptionalContent::getOCG(), and PDFDoc::getOptionalContent().
QString XpdfWidget::getLayerName | ( | XpdfLayerHandle | layer | ) | const |
Get the name of a layer. This function returns the title of layer.
Definition at line 1804 of file XpdfWidget.cc.
References name.
Referenced by LayerModel::data().
XpdfLayerOrderHandle XpdfWidget::getLayerOrderChild | ( | XpdfLayerOrderHandle | order, |
int | idx | ||
) |
Returns the idx 'th child of a layer display order tree node.
Definition at line 1939 of file XpdfWidget.cc.
Referenced by LayerModel::getOrderRow(), and LayerModel::index().
bool XpdfWidget::getLayerOrderIsName | ( | XpdfLayerOrderHandle | order | ) | const |
Check the type of a layer display order tree node. Returns true if the specified node of the layer display order tree is a name; false if the node is a layer.
Definition at line 1886 of file XpdfWidget.cc.
Referenced by LayerModel::data().
XpdfLayerHandle XpdfWidget::getLayerOrderLayer | ( | XpdfLayerOrderHandle | order | ) |
Get the layer associated with a layer display order tree node.
Definition at line 1917 of file XpdfWidget.cc.
Referenced by LayerModel::data(), and LayerModel::setData().
QString XpdfWidget::getLayerOrderName | ( | XpdfLayerOrderHandle | order | ) | const |
Get the name of a layer display order tree node. This should only be called if getLayerOrderIsName returns true.
Definition at line 1897 of file XpdfWidget.cc.
References name.
Referenced by LayerModel::data().
int XpdfWidget::getLayerOrderNumChildren | ( | XpdfLayerOrderHandle | order | ) |
Returns the number of children attached to a layer display order tree node.
Definition at line 1928 of file XpdfWidget.cc.
Referenced by LayerModel::getOrderRow(), LayerModel::index(), and LayerModel::rowCount().
XpdfLayerOrderHandle XpdfWidget::getLayerOrderParent | ( | XpdfLayerOrderHandle | order | ) |
Return the parent of a layer display order tree node. This function returns the parent of node order, or NULL if order is the root node.
Definition at line 1954 of file XpdfWidget.cc.
Referenced by LayerModel::getOrderRow(), and LayerModel::parent().
XpdfLayerOrderHandle XpdfWidget::getLayerOrderRoot | ( | ) | const |
Get the root of the layer display order tree.
Definition at line 1874 of file XpdfWidget.cc.
References core, OptionalContent::getDisplayRoot(), PDFCore::getDoc(), and PDFDoc::getOptionalContent().
Referenced by LayerModel::index(), and LayerModel::rowCount().
int XpdfWidget::getLayerPrintState | ( | XpdfLayerHandle | layer | ) | const |
Get the suggested state for this layer in printing mode. This function returns one of:
Definition at line 1860 of file XpdfWidget.cc.
References ocUsageOff, and ocUsageOn.
int XpdfWidget::getLayerViewState | ( | XpdfLayerHandle | layer | ) | const |
Get the suggested state for this layer in viewing mode. This function returns one of:
Definition at line 1846 of file XpdfWidget.cc.
References ocUsageOff, and ocUsageOn.
bool XpdfWidget::getLayerVisibility | ( | XpdfLayerHandle | layer | ) | const |
Get the visibility state of a layer. Returns true if the layer is currently visible, false if not.
Definition at line 1824 of file XpdfWidget.cc.
Referenced by LayerModel::data(), and LayerModel::setData().
QString XpdfWidget::getLinkInfo | ( | int | page, |
double | xx, | ||
double | yy | ||
) |
Get destination information for the hyperlink at the specified page and coordinates. If there is a link at the specified point, returns a string suitable for displaying to a user; otherwise returns an empty string. Note: This function expects PDF coordinates, not window coordinates.
Definition at line 760 of file XpdfWidget.cc.
References core, PDFCore::findLink(), PDFCore::getDoc(), QtPDFCore::getLinkInfo(), and PDFDoc::getNumPages().
Referenced by XpdfViewer::followLink(), and XpdfViewer::mouseMove().
|
private |
Definition at line 810 of file XpdfWidget.cc.
References actionGoTo, actionGoToR, actionLaunch, appendToPath(), core, PDFCore::findLink(), PDFDoc::findPage(), Ref::gen, GString::getCString(), PDFCore::getDoc(), PDFDoc::getFileName(), LinkAction::getKind(), GString::getLength(), PDFDoc::getNumPages(), LinkDest::getPageNum(), LinkDest::getPageRef(), grabPath(), isAbsolutePath(), LinkDest::isPageRef(), and Ref::num.
Referenced by XpdfViewer::followLink().
int XpdfWidget::getMidPage | ( | ) | const |
Return the page number corresponding to the middle of the window.
Definition at line 502 of file XpdfWidget.cc.
References core, and PDFCore::getMidPageNum().
Referenced by XpdfViewer::checkOpen(), XpdfViewer::close(), XpdfViewer::closeTab(), XpdfViewer::cmdRun(), XpdfViewer::cmdSaveTabState(), XpdfViewer::cmdViewPageLabels(), XpdfViewer::cmdViewPageNumbers(), XpdfViewer::cmdZoomIn(), XpdfViewer::cmdZoomOut(), XpdfViewer::execSaveImageDialog(), XpdfViewer::open(), XpdfViewer::updateDocInfo(), and XpdfViewer::updateZoomInfo().
QString XpdfWidget::getMouseLinkInfo | ( | ) |
Get destination information for the hyperlink under the mouse. If the mouse is currently over a hyperlink, return an info string (same as with getLinkInfo()); otherwise return an empty string.
Definition at line 779 of file XpdfWidget.cc.
References core, QtPDFCore::getLinkAction(), and QtPDFCore::getLinkInfo().
int XpdfWidget::getNumEmbeddedFiles | ( | ) |
Return the number of embedded files in the current PDF file.
Definition at line 1966 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), and PDFDoc::getNumEmbeddedFiles().
Referenced by XpdfViewer::fillAttachmentList().
int XpdfWidget::getNumLayers | ( | ) | const |
Return the number of layers in the PDF file. Note that a PDF file can have zero or more layers.
Definition at line 1780 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), OptionalContent::getNumOCGs(), and PDFDoc::getOptionalContent().
int XpdfWidget::getNumPages | ( | ) | const |
Return the number of pages in the currently open PDF file. Returns -1 if no file is open.
Definition at line 483 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), and PDFDoc::getNumPages().
Referenced by XpdfViewer::cmdGotoPage(), XpdfViewer::execSaveImageDialog(), and XpdfViewer::updateDocInfo().
XpdfOutlineHandle XpdfWidget::getOutlineChild | ( | XpdfOutlineHandle | outline, |
int | idx | ||
) |
Return a child of an outline tree node. This function returns the idx 'th child of node outline, or the idx 'th root entry if outline is NULL
.
Definition at line 1693 of file XpdfWidget.cc.
References core, GList::get(), PDFCore::getDoc(), Outline::getItems(), GList::getLength(), and PDFDoc::getOutline().
Referenced by OutlineModel::getItemRow(), and OutlineModel::index().
int XpdfWidget::getOutlineNumChildren | ( | XpdfOutlineHandle | outline | ) |
Return the number of children of an outline tree node. This function returns the number of children of node outline, or the number of root outline entries if outline is NULL
.
Definition at line 1671 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), Outline::getItems(), GList::getLength(), and PDFDoc::getOutline().
Referenced by OutlineModel::getItemRow(), OutlineModel::index(), and OutlineModel::rowCount().
XpdfOutlineHandle XpdfWidget::getOutlineParent | ( | XpdfOutlineHandle | outline | ) |
Return the parent of an outline tree node. This function returns the parent of node outline, or NULL if outline is a root item.
Definition at line 1719 of file XpdfWidget.cc.
Referenced by OutlineModel::getItemRow(), and OutlineModel::parent().
bool XpdfWidget::getOutlineStartsOpen | ( | XpdfOutlineHandle | outline | ) |
Return true if the specified outline entry starts open.
Definition at line 1746 of file XpdfWidget.cc.
Referenced by XpdfViewer::setOutlineOpenItems().
int XpdfWidget::getOutlineTargetPage | ( | XpdfOutlineHandle | outline | ) |
Return the target page number for the specified outline entry.
Definition at line 1757 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), and PDFDoc::getOutlineTargetPage().
Referenced by OutlineModel::findPageIndex().
QString XpdfWidget::getOutlineTitle | ( | XpdfOutlineHandle | outline | ) |
Get the title of an outline tree node. This function returns the title of node outline.
Definition at line 1726 of file XpdfWidget.cc.
Referenced by OutlineModel::data().
void XpdfWidget::getPageBox | ( | int | page, |
const QString & | box, | ||
double * | xMin, | ||
double * | yMin, | ||
double * | xMax, | ||
double * | yMax | ||
) | const |
Return the coordinates of the specified page box.
page | the page number |
box | the requested page box - one of "media", "crop", "bleed", "trim", or "art" (box is not case-sensitive) |
*xMin | returns the minimum x coordinate of the box |
*yMin | returns the minimum y coordinate of the box |
*xMax | returns the maximum x coordinate of the box |
*yMax | returns the maximum y coordinate of the box |
All coordinates are in points (1 point = 1/72 inch).
Definition at line 1031 of file XpdfWidget.cc.
References core, Page::getArtBox(), Page::getBleedBox(), PDFDoc::getCatalog(), Page::getCropBox(), PDFCore::getDoc(), Page::getMediaBox(), PDFDoc::getNumPages(), Catalog::getPage(), Page::getTrimBox(), PDFRectangle::x1, PDFRectangle::x2, PDFRectangle::y1, and PDFRectangle::y2.
double XpdfWidget::getPageHeight | ( | int | page | ) | const |
Return the height of the specified page. This function returns the crop box height, measured in points (1 point = 1/72 inch).
Definition at line 1079 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), PDFDoc::getNumPages(), and PDFDoc::getPageCropHeight().
QString XpdfWidget::getPageLabelFromPageNum | ( | int | pageNum | ) |
Convert a page number to a page label. Return the page label for page number pageNum. Returns an empty string if the page number is invalid or if the PDF file doesn't have page labels.
Definition at line 1633 of file XpdfWidget.cc.
References core, PDFDoc::getCatalog(), PDFCore::getDoc(), TextString::getLength(), Catalog::getPageLabel(), TextString::getUnicode(), and u.
Referenced by XpdfViewer::updatePageNumberOrLabel().
int XpdfWidget::getPageNumFromPageLabel | ( | QString | pageLabel | ) |
Convert a page label to a page number. Return the page number for pageLabel. Returns -1 if there is no matching page label or if the PDF file doesn't have page labels.
Definition at line 1654 of file XpdfWidget.cc.
References TextString::append(), core, PDFDoc::getCatalog(), PDFCore::getDoc(), and Catalog::getPageNumFromPageLabel().
Referenced by XpdfViewer::pageNumberChanged().
int XpdfWidget::getPageRotation | ( | int | page | ) | const |
Get the default rotation for the specified page. This is the default viewing rotation specified in the PDF file - it will be one of 0, 90, 180, or 270.
Definition at line 1093 of file XpdfWidget.cc.
References core, PDFDoc::getCatalog(), PDFCore::getDoc(), PDFDoc::getNumPages(), Catalog::getPage(), and Page::getRotate().
double XpdfWidget::getPageWidth | ( | int | page | ) | const |
Return the width of the specified page. This function returns the crop box width, measured in points (1 point = 1/72 inch).
Definition at line 1065 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), PDFDoc::getNumPages(), and PDFDoc::getPageCropWidth().
int XpdfWidget::getRotate | ( | ) | const |
Return the current page rotation. The angle can be 0, 90, 180, or 270.
Definition at line 687 of file XpdfWidget.cc.
References core, and PDFCore::getRotate().
Referenced by XpdfViewer::cmdRotateCCW(), XpdfViewer::cmdRotateCW(), and XpdfViewer::cmdSaveTabState().
int XpdfWidget::getScrollX | ( | ) | const |
Return the current scroll position x coordinate.
Definition at line 606 of file XpdfWidget.cc.
References core, and PDFCore::getScrollX().
Referenced by XpdfViewer::cmdSaveTabState().
int XpdfWidget::getScrollY | ( | ) | const |
Return the current scroll position y coordinate.
Definition at line 614 of file XpdfWidget.cc.
References core, and PDFCore::getScrollY().
Referenced by XpdfViewer::cmdSaveTabState().
QString XpdfWidget::getSelectedText | ( | ) |
Get the currently selected text. Returns an empty string if there is no selection (or if there is no text in the selected region).
Definition at line 1551 of file XpdfWidget.cc.
References core, and QtPDFCore::getSelectedTextQString().
QImage XpdfWidget::getThumbnail | ( | int | page | ) |
Retrieve an embedded thumbnail image. This function returns the embedded thumbnail image for the specified page, or a null image if there is no embedded thumbnail. This function does not do any rasterization – it only returns a non-null image if there is an embedded thumbnail in the PDF file.
Definition at line 1420 of file XpdfWidget.cc.
References core, Object::free(), PDFDoc::getCatalog(), PDFCore::getDoc(), Object::getInt(), ImageStream::getLine(), GfxColorSpace::getNComps(), PDFDoc::getNumPages(), Catalog::getPage(), GfxImageColorMap::getRGBByteLine(), Object::getStream(), Page::getThumbnail(), gfree(), gfxRenderingIntentPerceptual, gmallocn(), Object::isInt(), Object::isStream(), Dict::lookup(), GfxColorSpace::parse(), ImageStream::reset(), and Object::streamGetDict().
double XpdfWidget::getZoom | ( | ) | const |
Return the current zoom factor. This can be a percentage factor or one of the special values, XpdfWidget::zoomToPage or XpdfWidget::zoomToWidth.
Definition at line 629 of file XpdfWidget.cc.
References core, and PDFCore::getZoom().
Referenced by XpdfViewer::cmdSaveTabState(), XpdfViewer::enterFullScreenMode(), and XpdfViewer::updateZoomInfo().
double XpdfWidget::getZoomPercent | ( | int | page = 1 | ) | const |
Return the current zoom factor as a percentage. If the zoom is set to XpdfWidget::zoomToPage or XpdfWidget::zoomToWidth, returns the computed zoom percentage for the specified page, based on the current window size.
Definition at line 637 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), PDFDoc::getNumPages(), PDFCore::getZoom(), PDFCore::getZoomDPI(), and zoom.
Referenced by XpdfViewer::cmdZoomIn(), XpdfViewer::cmdZoomOut(), XpdfViewer::cmdZoomToSelection(), XpdfViewer::execSaveImageDialog(), and XpdfViewer::updateZoomInfo().
void XpdfWidget::goBackward | ( | ) |
Go backward along the history list.
Definition at line 571 of file XpdfWidget.cc.
References core, and PDFCore::goBackward().
Referenced by XpdfViewer::cmdGoBackward().
void XpdfWidget::goForward | ( | ) |
Go forward along the history list.
Definition at line 564 of file XpdfWidget.cc.
References core, and PDFCore::goForward().
Referenced by XpdfViewer::cmdGoForward().
void XpdfWidget::gotoFirstPage | ( | ) |
Display the first page. This is equivalent to
Definition at line 517 of file XpdfWidget.cc.
References core, PDFCore::displayPage(), gFalse, and gTrue.
void XpdfWidget::gotoLastPage | ( | ) |
Display the last page. This is equivalent to
Definition at line 524 of file XpdfWidget.cc.
References core, PDFCore::displayPage(), PDFCore::getDoc(), PDFDoc::getNumPages(), gFalse, and gTrue.
Referenced by XpdfViewer::cmdGotoLastPage().
bool XpdfWidget::gotoLinkAt | ( | int | page, |
double | xx, | ||
double | yy | ||
) |
Activate the link (if any) at the specified page and coordinates. Returns true if successful. Note: This function expects PDF coordinates, not window coordinates.
Definition at line 790 of file XpdfWidget.cc.
References core, QtPDFCore::doAction(), PDFCore::findLink(), PDFCore::getDoc(), and PDFDoc::getNumPages().
Referenced by XpdfViewer::followLink().
bool XpdfWidget::gotoNamedDestination | ( | const QString & | dest | ) |
Go to a named destination.
Definition at line 548 of file XpdfWidget.cc.
References core, and PDFCore::gotoNamedDestination().
Referenced by XpdfViewer::checkOpen(), XpdfViewer::cmdGotoDest(), and XpdfViewer::open().
void XpdfWidget::gotoNextPage | ( | bool | scrollToTop = true | ) |
Display the next page.
Definition at line 534 of file XpdfWidget.cc.
References core, and PDFCore::gotoNextPage().
Referenced by XpdfViewer::cmdNextPage(), and XpdfViewer::cmdNextPageNoScroll().
void XpdfWidget::gotoOutlineTarget | ( | XpdfOutlineHandle | outline | ) |
Jump to the target of the specified outline entry.
Definition at line 1768 of file XpdfWidget.cc.
References core, and QtPDFCore::doAction().
Referenced by XpdfViewer::outlineItemClicked().
void XpdfWidget::gotoPage | ( | int | pageNum | ) |
Display the specified page.
Definition at line 510 of file XpdfWidget.cc.
References core, PDFCore::displayPage(), gFalse, and gTrue.
Referenced by XpdfViewer::checkOpen(), XpdfViewer::cmdGotoPage(), and XpdfViewer::open().
void XpdfWidget::gotoPreviousPage | ( | bool | scrollToTop = true | ) |
Display the previous page.
Definition at line 541 of file XpdfWidget.cc.
References core, gFalse, and PDFCore::gotoPrevPage().
Referenced by XpdfViewer::cmdPrevPage(), and XpdfViewer::cmdPrevPageNoScroll().
bool XpdfWidget::hasOpenDocument | ( | ) | const |
Returns true if there is currently a PDF file open.
Definition at line 460 of file XpdfWidget.cc.
References core, and PDFCore::getDoc().
Referenced by XpdfViewer::checkOpen(), XpdfViewer::cmdLoadTabState(), XpdfViewer::cmdShowDocumentInfo(), XpdfViewer::execCmd(), XpdfViewer::open(), XpdfViewer::updateDocInfo(), XpdfViewer::updateDocumentInfoDialog(), and XpdfViewer::updateZoomInfo().
bool XpdfWidget::hasPageLabels | ( | ) |
Check if the PDF file has page labels. Return true if the currently open PDF file has page labels.
Definition at line 1622 of file XpdfWidget.cc.
References core, PDFDoc::getCatalog(), PDFCore::getDoc(), and Catalog::hasPageLabels().
Referenced by XpdfViewer::pageNumberChanged().
bool XpdfWidget::hasSelection | ( | ) |
Check to see if there is a selection. Returns true if there is a currently active selection.
Definition at line 1107 of file XpdfWidget.cc.
References core, and PDFCore::hasSelection().
Referenced by XpdfViewer::execSaveImageDialog(), and XpdfViewer::followLink().
|
static |
Initialize the XpdfWidget class, reading a configuration file. If configFileName is non-empty, the specified file is tried first. If configFileName is empty, or the file doesn't exist, the default location is tried (<exe-dir>/xpdfrc
on Windows; ~/
on Unix)..xpdfrc
This function must be called before any other XpdfWidget functions (including the constructor). It will be called automatically (with a NULL configFileName) if it hasn't already been called when the first XpdfWidget function is used.
Definition at line 141 of file XpdfWidget.cc.
References appendToPath(), GString::copy(), GString::getCString(), globalParams, grabPath(), gTrue, initMutex, GlobalParams::setBaseDir(), GlobalParams::setErrQuiet(), GlobalParams::setupBaseFonts(), and xpdfSysConfigFile.
Referenced by setConfig(), setTextEncoding(), and setup().
bool XpdfWidget::isBlockSelectMode | ( | ) |
Check for block selection mode. Returns true if the current selection mode is block.
Definition at line 1149 of file XpdfWidget.cc.
References core, PDFCore::getSelectMode(), and selectModeBlock.
Referenced by XpdfViewer::cmdToggleSelectMode(), and XpdfViewer::updateSelectModeInfo().
bool XpdfWidget::isLinearSelectMode | ( | ) |
Check for linear selection mode. Returns true if the current selection mode is linear.
Definition at line 1157 of file XpdfWidget.cc.
References core, PDFCore::getSelectMode(), and selectModeLinear.
|
signal |
This signal is emitted whenever a key is pressed.
|
staticprivate |
|
signal |
This signal is emitted whenever the user clicks on a hyperlink.
linkType | the type of link - one of:
|
dest | destination string |
page | destination page number |
Referenced by linkCbk().
XpdfWidget::ErrorCode XpdfWidget::loadDoc | ( | XpdfDocHandle | doc | ) |
Load a PDF document and display its first page. This function displays a PDF document handle created by XpdfWidget::readDoc. The document handle should not be used for anything else after calling this function.
pdfOk
if successful; an error code, otherwise Definition at line 410 of file XpdfWidget.cc.
References core, PDFCore::displayPage(), doc, gFalse, gTrue, QtPDFCore::loadDoc(), pdfErrNoHandle, and pdfOk.
XpdfWidget::ErrorCode XpdfWidget::loadFile | ( | const QString & | fileName, |
const QString & | password = "" |
||
) |
Load a PDF file and display its first page.
fileName | the PDF file to load |
password | a string to be tried first as the owner password and then as the user password |
pdfOk
if successful; an error code, otherwise Definition at line 287 of file XpdfWidget.cc.
References core, PDFCore::displayPage(), gFalse, gfree(), gmallocn(), gTrue, QtPDFCore::loadFile(), and pdfErrOutOfMemory.
Referenced by XpdfViewer::checkOpen(), and XpdfViewer::open().
XpdfWidget::ErrorCode XpdfWidget::loadMem | ( | const char * | buffer, |
unsigned int | bufferLength, | ||
const QString & | password = "" |
||
) |
Load a PDF file from a memory buffer and display its first page.
buffer | the PDF file in memory |
bufferLength | length of buffer |
password | a string to be tried first as the owner password and then as the user password |
pdfOk
if successful; an error code otherwise Definition at line 331 of file XpdfWidget.cc.
References core, PDFCore::displayPage(), gFalse, gTrue, Object::initNull(), QtPDFCore::loadFile(), and pdfErrOutOfMemory.
|
signal |
This signal is emitted whenever the page shown at the middle of the window changes. It is similar to XpdfWidget::pageChange, except that it reflects the page shown at the middle of the window (instead of the page at the top of the window).
Referenced by midPageChangedCbk().
|
staticprivate |
|
signal |
This signal is emitted whenever a mouse button is clicked. A click is defined as a button press and release within a short distance of each other (a few pixels). The sequence of signals is: mousePress, possibly a few mouseMoves, mouseRelease, and then mouseClick.
|
signal |
This signal is emitted whenever a mouse button is double-clicked. Double clicks are two clicks within a few pixels of each other, and within a certain time of each other. The sequence of signals is: mousePress, mouseRelease, mouseClick, mousePress, mouseRelease, mouseDoubleClick. There may also be mouseMoves between the presses and releases.
|
signal |
This signal is emitted whenever the mouse pointer is moved.
bool XpdfWidget::mouseOverLink | ( | ) |
Returns true if the mouse is currently over a hyperlink.
Definition at line 726 of file XpdfWidget.cc.
References convertWindowToPDFCoords(), core, PDFCore::findLink(), QtPDFCore::getHyperlinksEnabled(), and QtPDFCore::getLinkAction().
Referenced by XpdfViewer::getContext().
|
signal |
This signal is emitted whenever a mouse button is pressed.
|
signal |
This signal is emitted whenever a mouse button is released.
|
signal |
This signal is emitted whenever a mouse button is triple-clicked. Triple clicks are three clicks within a few pixels of each other, and within a certain time of each other. The sequence of signals is: mousePress, mouseRelease, mouseClick, mousePress, mouseRelease, mouseDoubleClick, mousePress, mouseRelease, mouseTripleClick. There may also be mouseMoves between the presses and releases.
|
signal |
This signal is emitted whenever a mouse wheel is clicked.
bool XpdfWidget::okToExtractText | ( | ) | const |
Checks to see if text extraction is allowed. This function returns false if the currently displayed PDF file is encrypted and does not allow extraction of text (or if no PDF file is currently open). The owner password can be used to circumvent this: if a valid owner password was supplied to XpdfWidget::loadFile, this function will always return true. If this function returns false, the text extraction functions will not return any text.
Definition at line 1500 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), and PDFDoc::okToCopy().
Referenced by XpdfViewer::cmdCopy().
XpdfAnnotHandle XpdfWidget::onAnnot | ( | int | page, |
double | xx, | ||
double | yy | ||
) |
Check for an annotation containing the specified point. Returns NULL if there is no annotation at this point. Note: This function expects PDF coordinates, not window coordinates.
Definition at line 902 of file XpdfWidget.cc.
References core, PDFCore::findAnnot(), and PDFCore::getDoc().
XpdfFormFieldHandle XpdfWidget::onFormField | ( | int | page, |
double | xx, | ||
double | yy | ||
) |
Check for a form field containing the specified point. Returns NULL if there is no annotation at this point. Note: This function expects PDF coordinates, not window coordinates.
Definition at line 946 of file XpdfWidget.cc.
References core, PDFCore::findFormField(), and PDFCore::getDoc().
bool XpdfWidget::onLink | ( | int | page, |
double | xx, | ||
double | yy | ||
) |
Returns true if the specified coordinates are inside a hyperlink. Note: This function expects PDF coordinates, not window coordinates.
Definition at line 746 of file XpdfWidget.cc.
References core, PDFCore::findLink(), PDFCore::getDoc(), and PDFDoc::getNumPages().
|
signal |
This signal is emitted whenever the viewer displays a new page. It can be triggered by user actions (e.g., the PageDown button), or program control (e.g., the gotoNextPage function).
pageNum | - the new page number |
Referenced by updateCbk().
|
signal |
This signal is emitted whenever the widget is repainted. finished is true if the painted view is complete, or false if this was an incremental update, i.e., if the view is still being rendered.
Referenced by paintDoneCbk().
|
staticprivate |
|
signal |
This signal is emitted just after a PDF file is loaded.
Referenced by postLoadCbk().
|
staticprivate |
|
signal |
This signal is emitted just before a PDF file is loaded.
Referenced by preLoadCbk().
|
staticprivate |
XpdfWidget::ErrorCode XpdfWidget::readDoc | ( | XpdfDocHandle * | docPtr, |
const QString & | fileName, | ||
const QString & | password = "" |
||
) |
Load a PDF file and return a handle.
This function can be safely called from a non-GUI thread. Use XpdfWidget::loadDoc (on the GUI thread) to load the document handle into the viewer. The handle returned in *docPtr
should be passed to either XpdfWidget::loadDoc or XpdfWidget::freeDoc.
Calling XpdfWidget::readDoc + XpdfWidget::loadDoc is equivalent to calling XpdfWidget::loadFile. The difference is that readDoc can be called on a background thread to avoid stalling the user interface.
docPtr | the PDF document handle will be returned her |
fileName | the PDF file to load |
password | a string to be tried first as the owner password and then as the user password |
pdfOk
if successful; an error code, otherwise Definition at line 360 of file XpdfWidget.cc.
References core, doc, PDFDoc::getErrorCode(), gfree(), gmallocn(), PDFDoc::isOk(), pdfErrOutOfMemory, and pdfOk.
XpdfWidget::ErrorCode XpdfWidget::reload | ( | ) |
Reload the current PDF file. This reloads the current PDF file, maintaining the zoom and scroll position (if possible). This only works if the PDF file was loaded from a file (i.e., with XpdfWidget::loadFile, not with XpdfWidget::loadMem).
pdfOk
if successful; an error code otherwise Definition at line 426 of file XpdfWidget.cc.
References core, pdfErrOutOfMemory, and QtPDFCore::reload().
Referenced by XpdfViewer::cmdReload().
|
signal |
This signal is emitted when the widget is resized.
XpdfWidget::ErrorCode XpdfWidget::saveAs | ( | const QString & | fileName | ) |
Save the PDF file with another name.
fileName | the file to be written |
pdfOk
if successful; an error code otherwise Definition at line 441 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), pdfErrNoHandle, pdfErrOpenFile, pdfErrOutOfMemory, pdfOk, and PDFDoc::saveAs().
Referenced by XpdfViewer::cmdSaveAs().
bool XpdfWidget::saveEmbeddedFile | ( | int | idx, |
QString | fileName | ||
) |
Save the idx 'th embedded file with the specified file name. Returns true if successful.
Definition at line 1999 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), PDFDoc::getNumEmbeddedFiles(), and PDFDoc::saveEmbeddedFile().
Referenced by XpdfViewer::attachmentSaveClicked().
void XpdfWidget::scrollBy | ( | int | dx, |
int | dy | ||
) |
Scroll the page by (dx,dy) pixels. If dx is positive, scrolls right; if dx is negative, scrolls left. Similarly, positive and negative values of dy scroll down and up, respectively.
Definition at line 599 of file XpdfWidget.cc.
References core, PDFCore::getScrollX(), PDFCore::getScrollY(), and PDFCore::scrollTo().
Referenced by XpdfViewer::cmdScrollDown(), XpdfViewer::cmdScrollLeft(), XpdfViewer::cmdScrollRight(), and XpdfViewer::cmdScrollUp().
void XpdfWidget::scrollPageDown | ( | ) |
Scroll one screen down.
Definition at line 585 of file XpdfWidget.cc.
References core, and PDFCore::scrollPageDown().
Referenced by XpdfViewer::cmdPageDown().
void XpdfWidget::scrollPageUp | ( | ) |
Scroll one screen up.
Definition at line 578 of file XpdfWidget.cc.
References core, and PDFCore::scrollPageUp().
Referenced by XpdfViewer::cmdPageUp().
void XpdfWidget::scrollTo | ( | int | xx, |
int | yy | ||
) |
Scroll the page so that the top-left corner of the window is (xx,yy) pixels from the top-left corner of the PDF page.
Definition at line 592 of file XpdfWidget.cc.
References core, and PDFCore::scrollTo().
Referenced by XpdfViewer::cmdLoadTabState().
|
signal |
This signal is emitted when the user selects an area. Use XpdfWidget::getCurrentSelection to retrieve the selection.
Referenced by selectDoneCbk().
|
staticprivate |
void XpdfWidget::setBlockSelectMode | ( | ) |
Set block selection mode. In this mode, the selection is a simple rectangle. Any part of the page can be selected, regardless of the content on the page.
Definition at line 1165 of file XpdfWidget.cc.
References core, selectModeBlock, and PDFCore::setSelectMode().
Referenced by XpdfViewer::addTab(), XpdfViewer::cmdBlockSelectMode(), and XpdfViewer::cmdToggleSelectMode().
|
static |
Process a configuration command, i.e., one line of an xpdfrc file. Note that this applies globally to all XpdfWidget instances.
Definition at line 194 of file XpdfWidget.cc.
References globalParams, init(), and GlobalParams::parseLine().
void XpdfWidget::setContinuousMode | ( | bool | continuous | ) |
Set continuous or single-page view mode. Deprecated: this is equivalent to calling setDisplayMode() with pdfDisplaySingle or pdfDisplayContinuous.
continuous | true for continous view mode, false for single-page view mode |
Definition at line 695 of file XpdfWidget.cc.
References core, displayContinuous, displaySingle, and PDFCore::setDisplayMode().
void XpdfWidget::setCurrentSelection | ( | int | page, |
double | x0, | ||
double | y0, | ||
double | x1, | ||
double | y1 | ||
) |
Set the selection. Sets the current selection to the rectangle with upper-left corner (x0,y0) and lower-right corner (x1,y1) on page.
Definition at line 1124 of file XpdfWidget.cc.
References core, PDFCore::cvtUserToDev(), and PDFCore::setSelection().
Referenced by XpdfViewer::cmdSetSelection().
void XpdfWidget::setCursor | ( | const QCursor & | cursor | ) |
Set the cursor. The requested cursor will only be displayed in the viewport (not in the scrollbars).
Definition at line 279 of file XpdfWidget.cc.
References core, and QtPDFCore::doSetCursor().
Referenced by XpdfViewer::mouseMove().
void XpdfWidget::setDisplayMode | ( | XpdfWidget::DisplayMode | mode | ) |
Set the display mode.
Definition at line 711 of file XpdfWidget.cc.
References core, and PDFCore::setDisplayMode().
Referenced by XpdfViewer::cmdContinuousMode(), XpdfViewer::cmdHorizontalContinuousMode(), XpdfViewer::cmdLoadTabState(), XpdfViewer::cmdSideBySideContinuousMode(), XpdfViewer::cmdSideBySideSingleMode(), XpdfViewer::cmdSinglePageMode(), XpdfViewer::cmdToggleContinuousMode(), XpdfViewer::enterFullScreenMode(), and XpdfViewer::exitFullScreenMode().
|
inline |
Control keypress passthrough. If enabled, XpdfWidget will pass keypress events through to the keyPress signal, with no other processing. If disabled, XpdfWidget will implement some built-in key bindings. The default is disabled.
Definition at line 229 of file XpdfWidget.h.
References keyPassthrough.
Referenced by XpdfViewer::addTab().
void XpdfWidget::setLayerVisibility | ( | XpdfLayerHandle | layer, |
bool | visibility | ||
) |
Set the visibility state of a layer.
layer | the layer handle |
visibility | the new state - true for visible, false for not visible |
Definition at line 1835 of file XpdfWidget.cc.
References core, PDFCore::getDoc(), and PDFCore::setOCGState().
Referenced by LayerModel::setData().
void XpdfWidget::setLinearSelectMode | ( | ) |
Set linear selection mode. In this mode, the selection follows text. Non-text regions cannot be selected.
Definition at line 1172 of file XpdfWidget.cc.
References core, selectModeLinear, and PDFCore::setSelectMode().
Referenced by XpdfViewer::addTab(), XpdfViewer::cmdLinearSelectMode(), and XpdfViewer::cmdToggleSelectMode().
void XpdfWidget::setMatteColor | ( | const QColor & | matteColor | ) |
Set the matte color, i.e., the color used for background outside the actual page area. The default is a medium gray.
Definition at line 260 of file XpdfWidget.cc.
References core, and PDFCore::setMatteColor().
Referenced by XpdfViewer::enterFullScreenMode(), and XpdfViewer::exitFullScreenMode().
|
inline |
Control mouse event passthrough. If enabled, XpdfWidget will pass mouse events through to the mousePress/mouseRelease signals, with no other processing. If disabled, XpdfWidget will implement some built-in mouse handling (in addition to sending the signals). The default is disabled.
Definition at line 236 of file XpdfWidget.h.
References mousePassthrough.
Referenced by XpdfViewer::addTab().
void XpdfWidget::setReverseVideo | ( | bool | reverse | ) |
Turn reverse video mode on/off. The default is off.
Definition at line 272 of file XpdfWidget.cc.
References core, and PDFCore::setReverseVideo().
void XpdfWidget::setRotate | ( | int | rotate | ) |
Change the page rotation.
rotate | rotation angle in degrees - must be 0, 90, 180, or 270 |
Definition at line 677 of file XpdfWidget.cc.
References core, rotate, and PDFCore::setRotate().
Referenced by XpdfViewer::cmdLoadTabState(), XpdfViewer::cmdRotateCCW(), XpdfViewer::cmdRotateCW(), and XpdfViewer::open().
void XpdfWidget::setSelectionColor | ( | const QColor & | selectionColor | ) |
Set the selection color.
Definition at line 1179 of file XpdfWidget.cc.
References core, and PDFCore::setSelectionColor().
Referenced by XpdfViewer::addTab().
void XpdfWidget::setTextEncoding | ( | const QString & | encodingName | ) |
Set the encoding to use for text extraction. The following encodings are predefined:
"Latin1"
: ISO-8859-1 (this is the default value)"ASCII7"
: 7-bit ASCII"UTF-8"
: Unicode in UTF-8 format"UCS-2"
: Unicode in UCS-2 formatAdditional encodings can be defined via the xpdfrc config file.
Definition at line 1511 of file XpdfWidget.cc.
References globalParams, init(), and GlobalParams::setTextEncoding().
|
private |
Definition at line 78 of file XpdfWidget.cc.
References core, QtPDFCore::getScaleFactor(), incrementalUpdateInterval, init(), keyPassthrough, lastMouseEventWasPress, lastMousePressTime, lastMousePressX, lastMousePressY, linkCbk(), midPageChangedCbk(), mousePassthrough, paintDoneCbk(), pinchZoomStart, postLoadCbk(), preLoadCbk(), scaleFactor, selectDoneCbk(), QtPDFCore::setLinkCbk(), QtPDFCore::setMidPageChangedCbk(), QtPDFCore::setPaintDoneCbk(), QtPDFCore::setPostLoadCbk(), QtPDFCore::setPreLoadCbk(), QtPDFCore::setSelectDoneCbk(), PDFCore::setTileDoneCbk(), QtPDFCore::setUpdateCbk(), tick(), tickTimer, tileDoneCbk(), touchPanEnabled, touchZoomEnabled, and updateCbk().
Referenced by XpdfWidget().
void XpdfWidget::setZoom | ( | double | zoom | ) |
Change the zoom factor. This can be a percentage factor (where 100 means 72 dpi) or one of the special values, XpdfWidget::zoomToPage or XpdfWidget::zoomToWidth.
Definition at line 622 of file XpdfWidget.cc.
References core, PDFCore::setZoom(), and zoom.
Referenced by XpdfViewer::cmdLoadTabState(), XpdfViewer::enterFullScreenMode(), and XpdfViewer::exitFullScreenMode().
void XpdfWidget::showPasswordDialog | ( | bool | showDlg | ) |
Control the password dialog. If enabled, the viewer will show a password dialog for encrypted files; if disabled, it will simply return pdfErrEncrypted
unless the correct password is passed to pdfLoadFileWithPassword
. The default is enabled.
Definition at line 253 of file XpdfWidget.cc.
References core, and QtPDFCore::setShowPasswordDialog().
|
privateslot |
Definition at line 2254 of file XpdfWidget.cc.
References core, and QtPDFCore::tick().
Referenced by setup().
|
staticprivate |
Definition at line 2075 of file XpdfWidget.cc.
Referenced by setup().
void XpdfWidget::unsetCursor | ( | ) |
Reset to the default cursor.
Definition at line 283 of file XpdfWidget.cc.
References core, and QtPDFCore::doUnsetCursor().
Referenced by XpdfViewer::mouseMove(), and XpdfViewer::updateDocInfo().
|
staticprivate |
void XpdfWidget::zoomCentered | ( | double | zoom | ) |
Set the zoom factor, while maintaining the current center. Accepts the same zoom values as XpdfWidget::setZoom.
Definition at line 663 of file XpdfWidget.cc.
References core, zoom, and PDFCore::zoomCentered().
Referenced by XpdfViewer::cmdZoomFitPage(), XpdfViewer::cmdZoomFitWidth(), XpdfViewer::cmdZoomIn(), XpdfViewer::cmdZoomOut(), and XpdfViewer::cmdZoomPercent().
void XpdfWidget::zoomToCurrentWidth | ( | ) |
Zoom so that the current page(s) fill the window width. Maintains the vertical center.
Definition at line 670 of file XpdfWidget.cc.
References core, and PDFCore::zoomToCurrentWidth().
void XpdfWidget::zoomToRect | ( | int | page, |
double | xMin, | ||
double | yMin, | ||
double | xMax, | ||
double | yMax | ||
) |
Zoom in to the specified rectangle. The coordinate system is the same one used by XpdfWidget::getCurrentSelection. This function will set the zoom factor and scroll position so that the specified rectangle just fits in the window.
Definition at line 655 of file XpdfWidget.cc.
References core, and PDFCore::zoomToRect().
Referenced by XpdfViewer::cmdZoomToSelection().
|
friend |
Definition at line 999 of file XpdfWidget.h.
|
private |
Definition at line 1013 of file XpdfWidget.h.
Referenced by clearSelection(), closeFile(), convertPageToImage(), convertPDFToWindowCoords(), convertRegionToImage(), convertWindowToPDFCoords(), copySelection(), enableExternalHyperlinks(), enableHyperlinks(), enablePan(), enableSelect(), extractText(), find(), findAll(), forceRedraw(), getContinuousMode(), getCurrentPage(), getCurrentSelection(), getDisplayMode(), getEmbeddedFileName(), getFileName(), getLayer(), getLayerOrderRoot(), getLinkInfo(), getLinkTarget(), getMidPage(), getMouseLinkInfo(), getNumEmbeddedFiles(), getNumLayers(), getNumPages(), getOutlineChild(), getOutlineNumChildren(), getOutlineTargetPage(), getPageBox(), getPageHeight(), getPageLabelFromPageNum(), getPageNumFromPageLabel(), getPageRotation(), getPageWidth(), getRotate(), getScrollX(), getScrollY(), getSelectedText(), getThumbnail(), getZoom(), getZoomPercent(), goBackward(), goForward(), gotoFirstPage(), gotoLastPage(), gotoLinkAt(), gotoNamedDestination(), gotoNextPage(), gotoOutlineTarget(), gotoPage(), gotoPreviousPage(), hasOpenDocument(), hasPageLabels(), hasSelection(), isBlockSelectMode(), isLinearSelectMode(), loadDoc(), loadFile(), loadMem(), mouseOverLink(), okToExtractText(), onAnnot(), onFormField(), onLink(), readDoc(), reload(), saveAs(), saveEmbeddedFile(), scrollBy(), scrollPageDown(), scrollPageUp(), scrollTo(), setBlockSelectMode(), setContinuousMode(), setCurrentSelection(), setCursor(), setDisplayMode(), setLayerVisibility(), setLinearSelectMode(), setMatteColor(), setReverseVideo(), setRotate(), setSelectionColor(), setup(), setZoom(), showPasswordDialog(), tick(), unsetCursor(), zoomCentered(), zoomToCurrentWidth(), zoomToRect(), and ~XpdfWidget().
|
static |
search backward from the starting point
Definition at line 133 of file XpdfWidget.h.
Referenced by XpdfViewer::cmdFindPrevious(), and find().
|
static |
perform a case-sensitive search (default is case-insensitive)
Definition at line 135 of file XpdfWidget.h.
Referenced by XpdfViewer::cmdFindFirst(), XpdfViewer::cmdFindNext(), XpdfViewer::cmdFindPrevious(), find(), and findAll().
|
static |
start searching from the previous search result
Definition at line 137 of file XpdfWidget.h.
Referenced by XpdfViewer::cmdFindNext(), XpdfViewer::cmdFindPrevious(), and find().
|
static |
limit the search to the current page
Definition at line 139 of file XpdfWidget.h.
Referenced by find().
|
static |
limit the search to whole words
Definition at line 141 of file XpdfWidget.h.
Referenced by XpdfViewer::cmdFindFirst(), XpdfViewer::cmdFindNext(), XpdfViewer::cmdFindPrevious(), find(), and findAll().
|
staticprivate |
Definition at line 1011 of file XpdfWidget.h.
Referenced by init().
|
private |
Definition at line 1016 of file XpdfWidget.h.
Referenced by setKeyPassthrough(), and setup().
|
private |
Definition at line 1020 of file XpdfWidget.h.
Referenced by setup().
|
private |
Definition at line 1019 of file XpdfWidget.h.
Referenced by setup().
|
private |
Definition at line 1018 of file XpdfWidget.h.
Referenced by setup().
|
private |
Definition at line 1018 of file XpdfWidget.h.
Referenced by setup().
|
private |
Definition at line 1017 of file XpdfWidget.h.
Referenced by setMousePassthrough(), and setup().
|
private |
Definition at line 1024 of file XpdfWidget.h.
Referenced by setup().
|
private |
Definition at line 1014 of file XpdfWidget.h.
Referenced by setup().
|
private |
Definition at line 1026 of file XpdfWidget.h.
Referenced by setup(), and ~XpdfWidget().
|
private |
Definition at line 1022 of file XpdfWidget.h.
Referenced by enableTouchPan(), and setup().
|
private |
Definition at line 1023 of file XpdfWidget.h.
Referenced by enableTouchZoom(), and setup().
|
static |
zoom to fit page height
Definition at line 126 of file XpdfWidget.h.
|
static |
zoom to fit whole page
Definition at line 124 of file XpdfWidget.h.
Referenced by XpdfViewer::cmdZoomFitPage(), XpdfViewer::enterFullScreenMode(), and XpdfViewer::updateZoomInfo().
|
static |
zoom to fit page width
Definition at line 125 of file XpdfWidget.h.
Referenced by XpdfViewer::cmdZoomFitWidth(), and XpdfViewer::updateZoomInfo().