diff options
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h')
-rw-r--r-- | Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h index accf19d82ef..56ecd958c21 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h @@ -11,11 +11,10 @@ #include <aconf.h> -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - #include <stdlib.h> +#ifndef PDF_PARSER_ONLY +#include <atomic> +#endif #include "SplashTypes.h" #include "CharTypes.h" #include "DisplayState.h" @@ -31,7 +30,6 @@ class Links; class LinkDest; class LinkAction; class Annot; -class Annots; class AcroFormField; class TextPage; class HighlightFile; @@ -77,6 +75,34 @@ struct FindResult { }; //------------------------------------------------------------------------ +// AsyncFindAll +//------------------------------------------------------------------------ +#ifndef PDF_PARSER_ONLY +class AsyncFindAll { +public: + + AsyncFindAll(PDFCore *coreA): core(coreA), canceled(gFalse) {} + + void reset() { canceled = false; } + + // Run the search, returning a list of FindResults -- same as + // PDFCore::findAll(). This can be run on a separate thread. If + // cancel() is called while the search is running, this function + // returns null. + GList *run(PDFDoc *doc, Unicode *u, int len, GBool caseSensitive, + GBool wholeWord, int firstPage, int lastPage); + + // Cancel a running search, causing run() to return null. + void cancel() { canceled = true; } + +private: + + PDFCore *core; + std::atomic<bool> canceled; +}; +#endif + +//------------------------------------------------------------------------ // PDFCore //------------------------------------------------------------------------ @@ -256,7 +282,6 @@ public: LinkAction *findLink(int pg, double x, double y); Annot *findAnnot(int pg, double x, double y); int findAnnotIdx(int pg, double x, double y); - Annot *getAnnot(int idx); AcroFormField *findFormField(int pg, double x, double y); int findFormFieldIdx(int pg, double x, double y); AcroFormField *getFormField(int idx); @@ -288,6 +313,11 @@ protected: //--- callbacks to PDFCore subclass + // Subclasses can return true here to force PDFCore::finishUpdate() + // to always invalidate the window. This is necessary to avoid + // flickering on some backends. + virtual GBool alwaysInvalidateOnUpdate() { return gFalse; } + // Invalidate the specified rectangle (in window coordinates). virtual void invalidate(int x, int y, int w, int h) = 0; @@ -304,13 +334,17 @@ protected: // This is called just after a PDF file is loaded. virtual void postLoad() {} + // This is called just before deleting the PDFDoc. The PDFCore + // subclass must shut down any secondary threads that are using the + // PDFDoc pointer. + virtual void aboutToDeleteDoc() {} + //--- internal int loadFile2(PDFDoc *newDoc); void addToHistory(); void clearPage(); void loadLinks(int pg); - void loadAnnots(int pg); void loadText(int pg); void getSelectionBBox(int *wxMin, int *wyMin, int *wxMax, int *wyMax); void getSelectRectListBBox(GList *rects, int *wxMin, int *wyMin, @@ -318,14 +352,13 @@ protected: void checkInvalidate(int x, int y, int w, int h); void invalidateWholeWindow(); + friend class AsyncFindAll; + PDFDoc *doc; int linksPage; // cached links for one page Links *links; - int annotsPage; // cached annotations for one page - Annots *annots; - int textPage; // cached extracted text for one page double textDPI; int textRotate; |