mNativePagesPtr = new ArrayMap<>();
- public boolean hasPage(int index){ return mNativePagesPtr.containsKey(index); }
+
+ public boolean hasPage(int index) {
+ return mNativePagesPtr.containsKey(index);
+ }
}
diff --git a/src/main/java/com/shockwave/pdfium/PdfPasswordException.java b/src/main/java/com/shockwave/pdfium/PdfPasswordException.java
new file mode 100644
index 00000000..2d3ec707
--- /dev/null
+++ b/src/main/java/com/shockwave/pdfium/PdfPasswordException.java
@@ -0,0 +1,13 @@
+package com.shockwave.pdfium;
+
+import java.io.IOException;
+
+public class PdfPasswordException extends IOException {
+ public PdfPasswordException() {
+ super();
+ }
+
+ public PdfPasswordException(String detailMessage) {
+ super(detailMessage);
+ }
+}
diff --git a/src/main/java/com/shockwave/pdfium/PdfiumCore.java b/src/main/java/com/shockwave/pdfium/PdfiumCore.java
index f312d65b..0b2421e6 100644
--- a/src/main/java/com/shockwave/pdfium/PdfiumCore.java
+++ b/src/main/java/com/shockwave/pdfium/PdfiumCore.java
@@ -1,53 +1,112 @@
package com.shockwave.pdfium;
import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Point;
+import android.graphics.RectF;
+import android.os.ParcelFileDescriptor;
import android.util.Log;
import android.view.Surface;
+import com.shockwave.pdfium.util.Size;
+
import java.io.FileDescriptor;
+import java.io.IOException;
import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
public class PdfiumCore {
private static final String TAG = PdfiumCore.class.getName();
+ private static final Class FD_CLASS = FileDescriptor.class;
+ private static final String FD_FIELD_NAME = "descriptor";
- static{
- System.loadLibrary("jniPdfium");
+ static {
+ try {
+ System.loadLibrary("c++_shared");
+ System.loadLibrary("modpng");
+ System.loadLibrary("modft2");
+ System.loadLibrary("modpdfium");
+ System.loadLibrary("jniPdfium");
+ } catch (UnsatisfiedLinkError e) {
+ Log.e(TAG, "Native libraries failed to load - " + e);
+ }
}
- private native long nativeOpenDocument(int fd);
+ private native long nativeOpenDocument(int fd, String password);
+
+ private native long nativeOpenMemDocument(byte[] data, String password);
+
private native void nativeCloseDocument(long docPtr);
+
private native int nativeGetPageCount(long docPtr);
+
private native long nativeLoadPage(long docPtr, int pageIndex);
+
private native long[] nativeLoadPages(long docPtr, int fromIndex, int toIndex);
+
private native void nativeClosePage(long pagePtr);
+
private native void nativeClosePages(long[] pagesPtr);
+
private native int nativeGetPageWidthPixel(long pagePtr, int dpi);
+
private native int nativeGetPageHeightPixel(long pagePtr, int dpi);
+
+ private native int nativeGetPageWidthPoint(long pagePtr);
+
+ private native int nativeGetPageHeightPoint(long pagePtr);
+
//private native long nativeGetNativeWindow(Surface surface);
//private native void nativeRenderPage(long pagePtr, long nativeWindowPtr);
private native void nativeRenderPage(long pagePtr, Surface surface, int dpi,
int startX, int startY,
- int drawSizeHor, int drawSizeVer);
+ int drawSizeHor, int drawSizeVer,
+ boolean renderAnnot);
- private static final Class FD_CLASS = FileDescriptor.class;
- private static final String FD_FIELD_NAME = "descriptor";
- private static Field mFdField = null;
+ private native void nativeRenderPageBitmap(long pagePtr, Bitmap bitmap, int dpi,
+ int startX, int startY,
+ int drawSizeHor, int drawSizeVer,
+ boolean renderAnnot);
- private int mCurrentDpi;
+ private native String nativeGetDocumentMetaText(long docPtr, String tag);
- public PdfiumCore(Context ctx){
- mCurrentDpi = ctx.getResources().getDisplayMetrics().densityDpi;
- }
+ private native Long nativeGetFirstChildBookmark(long docPtr, Long bookmarkPtr);
+
+ private native Long nativeGetSiblingBookmark(long docPtr, long bookmarkPtr);
+
+ private native String nativeGetBookmarkTitle(long bookmarkPtr);
+
+ private native long nativeGetBookmarkDestIndex(long docPtr, long bookmarkPtr);
+
+ private native Size nativeGetPageSizeByIndex(long docPtr, int pageIndex, int dpi);
+
+ private native long[] nativeGetPageLinks(long pagePtr);
+
+ private native Integer nativeGetDestPageIndex(long docPtr, long linkPtr);
- public static int getNumFd(FileDescriptor fdObj){
- try{
- if(mFdField == null){
+ private native String nativeGetLinkURI(long docPtr, long linkPtr);
+
+ private native RectF nativeGetLinkRect(long linkPtr);
+
+ private native Point nativePageCoordsToDevice(long pagePtr, int startX, int startY, int sizeX,
+ int sizeY, int rotate, double pageX, double pageY);
+
+
+ /* synchronize native methods */
+ private static final Object lock = new Object();
+ private static Field mFdField = null;
+ private int mCurrentDpi;
+
+ public static int getNumFd(ParcelFileDescriptor fdObj) {
+ try {
+ if (mFdField == null) {
mFdField = FD_CLASS.getDeclaredField(FD_FIELD_NAME);
mFdField.setAccessible(true);
}
- return mFdField.getInt(fdObj);
- }catch(NoSuchFieldException e){
+ return mFdField.getInt(fdObj.getFileDescriptor());
+ } catch (NoSuchFieldException e) {
e.printStackTrace();
return -1;
} catch (IllegalAccessException e) {
@@ -56,33 +115,69 @@ public static int getNumFd(FileDescriptor fdObj){
}
}
- public PdfDocument newDocument(FileDescriptor fd){
+
+ /** Context needed to get screen density */
+ public PdfiumCore(Context ctx) {
+ mCurrentDpi = ctx.getResources().getDisplayMetrics().densityDpi;
+ Log.d(TAG, "Starting PdfiumAndroid " + BuildConfig.VERSION_NAME);
+ }
+
+ /** Create new document from file */
+ public PdfDocument newDocument(ParcelFileDescriptor fd) throws IOException {
+ return newDocument(fd, null);
+ }
+
+ /** Create new document from file with password */
+ public PdfDocument newDocument(ParcelFileDescriptor fd, String password) throws IOException {
PdfDocument document = new PdfDocument();
+ document.parcelFileDescriptor = fd;
+ synchronized (lock) {
+ document.mNativeDocPtr = nativeOpenDocument(getNumFd(fd), password);
+ }
- document.mNativeDocPtr = nativeOpenDocument(getNumFd(fd));
- if(document.mNativeDocPtr <= 0) Log.e(TAG, "Open document failed");
+ return document;
+ }
+
+ /** Create new document from bytearray */
+ public PdfDocument newDocument(byte[] data) throws IOException {
+ return newDocument(data, null);
+ }
+ /** Create new document from bytearray with password */
+ public PdfDocument newDocument(byte[] data, String password) throws IOException {
+ PdfDocument document = new PdfDocument();
+ synchronized (lock) {
+ document.mNativeDocPtr = nativeOpenMemDocument(data, password);
+ }
return document;
}
- public int getPageCount(PdfDocument doc){
- synchronized (doc.Lock){
+
+ /** Get total numer of pages in document */
+ public int getPageCount(PdfDocument doc) {
+ synchronized (lock) {
return nativeGetPageCount(doc.mNativeDocPtr);
}
}
- public long openPage(PdfDocument doc, int pageIndex){
- synchronized (doc.Lock){
- long pagePtr = nativeLoadPage(doc.mNativeDocPtr, pageIndex);
+ /** Open page and store native pointer in {@link PdfDocument} */
+ public long openPage(PdfDocument doc, int pageIndex) {
+ long pagePtr;
+ synchronized (lock) {
+ pagePtr = nativeLoadPage(doc.mNativeDocPtr, pageIndex);
doc.mNativePagesPtr.put(pageIndex, pagePtr);
return pagePtr;
}
+
}
- public long[] openPage(PdfDocument doc, int fromIndex, int toIndex){
- synchronized (doc.Lock){
- long[] pagesPtr = nativeLoadPages(doc.mNativeDocPtr, fromIndex, toIndex);
+
+ /** Open range of pages and store native pointers in {@link PdfDocument} */
+ public long[] openPage(PdfDocument doc, int fromIndex, int toIndex) {
+ long[] pagesPtr;
+ synchronized (lock) {
+ pagesPtr = nativeLoadPages(doc.mNativeDocPtr, fromIndex, toIndex);
int pageIndex = fromIndex;
- for(long page : pagesPtr){
- if(pageIndex > toIndex) break;
+ for (long page : pagesPtr) {
+ if (pageIndex > toIndex) break;
doc.mNativePagesPtr.put(pageIndex, page);
pageIndex++;
}
@@ -90,50 +185,265 @@ public long[] openPage(PdfDocument doc, int fromIndex, int toIndex){
return pagesPtr;
}
}
- public int getPageWidth(PdfDocument doc, int index){
- synchronized (doc.Lock){
+
+ /**
+ * Get page width in pixels.
+ * This method requires page to be opened.
+ */
+ public int getPageWidth(PdfDocument doc, int index) {
+ synchronized (lock) {
Long pagePtr;
- if( (pagePtr = doc.mNativePagesPtr.get(index)) != null ){
+ if ((pagePtr = doc.mNativePagesPtr.get(index)) != null) {
return nativeGetPageWidthPixel(pagePtr, mCurrentDpi);
}
return 0;
}
}
- public int getPageHeight(PdfDocument doc, int index){
- synchronized (doc.Lock){
+
+ /**
+ * Get page height in pixels.
+ * This method requires page to be opened.
+ */
+ public int getPageHeight(PdfDocument doc, int index) {
+ synchronized (lock) {
Long pagePtr;
- if( (pagePtr = doc.mNativePagesPtr.get(index)) != null ){
+ if ((pagePtr = doc.mNativePagesPtr.get(index)) != null) {
return nativeGetPageHeightPixel(pagePtr, mCurrentDpi);
}
return 0;
}
}
+ /**
+ * Get page width in PostScript points (1/72th of an inch).
+ * This method requires page to be opened.
+ */
+ public int getPageWidthPoint(PdfDocument doc, int index) {
+ synchronized (lock) {
+ Long pagePtr;
+ if ((pagePtr = doc.mNativePagesPtr.get(index)) != null) {
+ return nativeGetPageWidthPoint(pagePtr);
+ }
+ return 0;
+ }
+ }
+
+ /**
+ * Get page height in PostScript points (1/72th of an inch).
+ * This method requires page to be opened.
+ */
+ public int getPageHeightPoint(PdfDocument doc, int index) {
+ synchronized (lock) {
+ Long pagePtr;
+ if ((pagePtr = doc.mNativePagesPtr.get(index)) != null) {
+ return nativeGetPageHeightPoint(pagePtr);
+ }
+ return 0;
+ }
+ }
+
+ /**
+ * Get size of page in pixels.
+ * This method does not require given page to be opened.
+ */
+ public Size getPageSize(PdfDocument doc, int index) {
+ synchronized (lock) {
+ return nativeGetPageSizeByIndex(doc.mNativeDocPtr, index, mCurrentDpi);
+ }
+ }
+
+ /**
+ * Render page fragment on {@link Surface}.
+ * Page must be opened before rendering.
+ */
public void renderPage(PdfDocument doc, Surface surface, int pageIndex,
- int startX, int startY, int drawSizeX, int drawSizeY){
- synchronized (doc.Lock){
- try{
+ int startX, int startY, int drawSizeX, int drawSizeY) {
+ renderPage(doc, surface, pageIndex, startX, startY, drawSizeX, drawSizeY, false);
+ }
+
+ /**
+ * Render page fragment on {@link Surface}. This method allows to render annotations.
+ * Page must be opened before rendering.
+ */
+ public void renderPage(PdfDocument doc, Surface surface, int pageIndex,
+ int startX, int startY, int drawSizeX, int drawSizeY,
+ boolean renderAnnot) {
+ synchronized (lock) {
+ try {
//nativeRenderPage(doc.mNativePagesPtr.get(pageIndex), surface, mCurrentDpi);
nativeRenderPage(doc.mNativePagesPtr.get(pageIndex), surface, mCurrentDpi,
- startX, startY, drawSizeX, drawSizeY);
- }catch(NullPointerException e){
+ startX, startY, drawSizeX, drawSizeY, renderAnnot);
+ } catch (NullPointerException e) {
Log.e(TAG, "mContext may be null");
e.printStackTrace();
- }catch(Exception e){
+ } catch (Exception e) {
Log.e(TAG, "Exception throw from native");
e.printStackTrace();
}
}
}
- public void closeDocument(PdfDocument doc){
- synchronized (doc.Lock){
- for(Integer index : doc.mNativePagesPtr.keySet()){
+ /**
+ * Render page fragment on {@link Bitmap}.
+ * Page must be opened before rendering.
+ *
+ * Supported bitmap configurations:
+ *
+ * - ARGB_8888 - best quality, high memory usage, higher possibility of OutOfMemoryError
+ *
- RGB_565 - little worse quality, twice less memory usage
+ *
+ */
+ public void renderPageBitmap(PdfDocument doc, Bitmap bitmap, int pageIndex,
+ int startX, int startY, int drawSizeX, int drawSizeY) {
+ renderPageBitmap(doc, bitmap, pageIndex, startX, startY, drawSizeX, drawSizeY, false);
+ }
+
+ /**
+ * Render page fragment on {@link Bitmap}. This method allows to render annotations.
+ * Page must be opened before rendering.
+ *
+ * For more info see {@link PdfiumCore#renderPageBitmap(PdfDocument, Bitmap, int, int, int, int, int)}
+ */
+ public void renderPageBitmap(PdfDocument doc, Bitmap bitmap, int pageIndex,
+ int startX, int startY, int drawSizeX, int drawSizeY,
+ boolean renderAnnot) {
+ synchronized (lock) {
+ try {
+ nativeRenderPageBitmap(doc.mNativePagesPtr.get(pageIndex), bitmap, mCurrentDpi,
+ startX, startY, drawSizeX, drawSizeY, renderAnnot);
+ } catch (NullPointerException e) {
+ Log.e(TAG, "mContext may be null");
+ e.printStackTrace();
+ } catch (Exception e) {
+ Log.e(TAG, "Exception throw from native");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /** Release native resources and opened file */
+ public void closeDocument(PdfDocument doc) {
+ synchronized (lock) {
+ for (Integer index : doc.mNativePagesPtr.keySet()) {
nativeClosePage(doc.mNativePagesPtr.get(index));
}
doc.mNativePagesPtr.clear();
nativeCloseDocument(doc.mNativeDocPtr);
+
+ if (doc.parcelFileDescriptor != null) { //if document was loaded from file
+ try {
+ doc.parcelFileDescriptor.close();
+ } catch (IOException e) {
+ /* ignore */
+ }
+ doc.parcelFileDescriptor = null;
+ }
+ }
+ }
+
+ /** Get metadata for given document */
+ public PdfDocument.Meta getDocumentMeta(PdfDocument doc) {
+ synchronized (lock) {
+ PdfDocument.Meta meta = new PdfDocument.Meta();
+ meta.title = nativeGetDocumentMetaText(doc.mNativeDocPtr, "Title");
+ meta.author = nativeGetDocumentMetaText(doc.mNativeDocPtr, "Author");
+ meta.subject = nativeGetDocumentMetaText(doc.mNativeDocPtr, "Subject");
+ meta.keywords = nativeGetDocumentMetaText(doc.mNativeDocPtr, "Keywords");
+ meta.creator = nativeGetDocumentMetaText(doc.mNativeDocPtr, "Creator");
+ meta.producer = nativeGetDocumentMetaText(doc.mNativeDocPtr, "Producer");
+ meta.creationDate = nativeGetDocumentMetaText(doc.mNativeDocPtr, "CreationDate");
+ meta.modDate = nativeGetDocumentMetaText(doc.mNativeDocPtr, "ModDate");
+
+ return meta;
+ }
+ }
+
+ /** Get table of contents (bookmarks) for given document */
+ public List getTableOfContents(PdfDocument doc) {
+ synchronized (lock) {
+ List topLevel = new ArrayList<>();
+ Long first = nativeGetFirstChildBookmark(doc.mNativeDocPtr, null);
+ if (first != null) {
+ recursiveGetBookmark(topLevel, doc, first);
+ }
+ return topLevel;
}
}
+
+ private void recursiveGetBookmark(List tree, PdfDocument doc, long bookmarkPtr) {
+ PdfDocument.Bookmark bookmark = new PdfDocument.Bookmark();
+ bookmark.mNativePtr = bookmarkPtr;
+ bookmark.title = nativeGetBookmarkTitle(bookmarkPtr);
+ bookmark.pageIdx = nativeGetBookmarkDestIndex(doc.mNativeDocPtr, bookmarkPtr);
+ tree.add(bookmark);
+
+ Long child = nativeGetFirstChildBookmark(doc.mNativeDocPtr, bookmarkPtr);
+ if (child != null) {
+ recursiveGetBookmark(bookmark.getChildren(), doc, child);
+ }
+
+ Long sibling = nativeGetSiblingBookmark(doc.mNativeDocPtr, bookmarkPtr);
+ if (sibling != null) {
+ recursiveGetBookmark(tree, doc, sibling);
+ }
+ }
+
+ /** Get all links from given page */
+ public List getPageLinks(PdfDocument doc, int pageIndex) {
+ synchronized (lock) {
+ List links = new ArrayList<>();
+ Long nativePagePtr = doc.mNativePagesPtr.get(pageIndex);
+ if (nativePagePtr == null) {
+ return links;
+ }
+ long[] linkPtrs = nativeGetPageLinks(nativePagePtr);
+ for (long linkPtr : linkPtrs) {
+ Integer index = nativeGetDestPageIndex(doc.mNativeDocPtr, linkPtr);
+ String uri = nativeGetLinkURI(doc.mNativeDocPtr, linkPtr);
+
+ RectF rect = nativeGetLinkRect(linkPtr);
+ if (rect != null && (index != null || uri != null)) {
+ links.add(new PdfDocument.Link(rect, index, uri));
+ }
+
+ }
+ return links;
+ }
+ }
+
+ /**
+ * Map page coordinates to device screen coordinates
+ *
+ * @param doc pdf document
+ * @param pageIndex index of page
+ * @param startX left pixel position of the display area in device coordinates
+ * @param startY top pixel position of the display area in device coordinates
+ * @param sizeX horizontal size (in pixels) for displaying the page
+ * @param sizeY vertical size (in pixels) for displaying the page
+ * @param rotate page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+ * 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)
+ * @param pageX X value in page coordinates
+ * @param pageY Y value in page coordinate
+ * @return mapped coordinates
+ */
+ public Point mapPageCoordsToDevice(PdfDocument doc, int pageIndex, int startX, int startY, int sizeX,
+ int sizeY, int rotate, double pageX, double pageY) {
+ long pagePtr = doc.mNativePagesPtr.get(pageIndex);
+ return nativePageCoordsToDevice(pagePtr, startX, startY, sizeX, sizeY, rotate, pageX, pageY);
+ }
+
+ /**
+ * @return mapped coordinates
+ * @see PdfiumCore#mapPageCoordsToDevice(PdfDocument, int, int, int, int, int, int, double, double)
+ */
+ public RectF mapRectToDevice(PdfDocument doc, int pageIndex, int startX, int startY, int sizeX,
+ int sizeY, int rotate, RectF coords) {
+
+ Point leftTop = mapPageCoordsToDevice(doc, pageIndex, startX, startY, sizeX, sizeY, rotate,
+ coords.left, coords.top);
+ Point rightBottom = mapPageCoordsToDevice(doc, pageIndex, startX, startY, sizeX, sizeY, rotate,
+ coords.right, coords.bottom);
+ return new RectF(leftTop.x, leftTop.y, rightBottom.x, rightBottom.y);
+ }
}
diff --git a/src/main/java/com/shockwave/pdfium/util/Size.java b/src/main/java/com/shockwave/pdfium/util/Size.java
new file mode 100644
index 00000000..2cd11b32
--- /dev/null
+++ b/src/main/java/com/shockwave/pdfium/util/Size.java
@@ -0,0 +1,45 @@
+package com.shockwave.pdfium.util;
+
+public class Size {
+ private final int width;
+ private final int height;
+
+ public Size(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Size) {
+ Size other = (Size) obj;
+ return width == other.width && height == other.height;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return width + "x" + height;
+ }
+
+ @Override
+ public int hashCode() {
+ // assuming most sizes are <2^16, doing a rotate will give us perfect hashing
+ return height ^ ((width << (Integer.SIZE / 2)) | (width >>> (Integer.SIZE / 2)));
+ }
+}
diff --git a/src/main/java/com/shockwave/pdfium/util/SizeF.java b/src/main/java/com/shockwave/pdfium/util/SizeF.java
new file mode 100644
index 00000000..3f6161ab
--- /dev/null
+++ b/src/main/java/com/shockwave/pdfium/util/SizeF.java
@@ -0,0 +1,48 @@
+package com.shockwave.pdfium.util;
+
+public class SizeF {
+ private final float width;
+ private final float height;
+
+ public SizeF(float width, float height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public float getWidth() {
+ return width;
+ }
+
+ public float getHeight() {
+ return height;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof SizeF) {
+ final SizeF other = (SizeF) obj;
+ return width == other.width && height == other.height;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return width + "x" + height;
+ }
+
+ @Override
+ public int hashCode() {
+ return Float.floatToIntBits(width) ^ Float.floatToIntBits(height);
+ }
+
+ public Size toSize() {
+ return new Size((int) width, (int) height);
+ }
+}
diff --git a/src/main/jni/Android.mk b/src/main/jni/Android.mk
index 7254f271..131211ee 100644
--- a/src/main/jni/Android.mk
+++ b/src/main/jni/Android.mk
@@ -5,18 +5,34 @@ include $(CLEAR_VARS)
LOCAL_MODULE := aospPdfium
ARCH_PATH = $(TARGET_ARCH_ABI)
-ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
- ARCH_PATH = armeabi
-endif
-ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
- ARCH_PATH = arm64
-endif
+LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libmodpdfium.so
-LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libpdfium.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+#c++_shared
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmodc++_shared
+
+LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libc++_shared.so
include $(PREBUILT_SHARED_LIBRARY)
+#libmodft2
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmodft2
+
+LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libmodft2.so
+
+include $(PREBUILT_SHARED_LIBRARY)
+
+#libmodpng
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmodpng
+
+LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libmodpng.so
+
+include $(PREBUILT_SHARED_LIBRARY)
#Main JNI library
include $(CLEAR_VARS)
@@ -25,7 +41,7 @@ LOCAL_MODULE := jniPdfium
LOCAL_CFLAGS += -DHAVE_PTHREADS
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES += aospPdfium
-LOCAL_LDLIBS += -llog -landroid
+LOCAL_LDLIBS += -llog -landroid -ljnigraphics
LOCAL_SRC_FILES := $(LOCAL_PATH)/src/mainJNILib.cpp
diff --git a/src/main/jni/Application.mk b/src/main/jni/Application.mk
index fc45dc15..df5c5088 100644
--- a/src/main/jni/Application.mk
+++ b/src/main/jni/Application.mk
@@ -1,12 +1,12 @@
-APP_STL := gnustl_static
+APP_STL := c++_shared
APP_CPPFLAGS += -fexceptions
#For ANativeWindow support
-APP_PLATFORM = android-9
+APP_PLATFORM = android-14
-APP_ABI := armeabi \
- armeabi-v7a \
+APP_ABI := armeabi-v7a \
arm64-v8a \
mips \
+ mips64 \
x86 \
x86_64
\ No newline at end of file
diff --git a/src/main/jni/include/cpp/fpdf_deleters.h b/src/main/jni/include/cpp/fpdf_deleters.h
new file mode 100644
index 00000000..55b85d9e
--- /dev/null
+++ b/src/main/jni/include/cpp/fpdf_deleters.h
@@ -0,0 +1,86 @@
+// Copyright 2017 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
+#define PUBLIC_CPP_FPDF_DELETERS_H_
+
+#include "../fpdf_annot.h"
+#include "../fpdf_dataavail.h"
+#include "../fpdf_edit.h"
+#include "../fpdf_formfill.h"
+#include "../fpdf_javascript.h"
+#include "../fpdf_structtree.h"
+#include "../fpdf_text.h"
+#include "../fpdf_transformpage.h"
+#include "../fpdfview.h"
+
+// Custom deleters for using FPDF_* types with std::unique_ptr<>.
+
+struct FPDFAnnotationDeleter {
+ inline void operator()(FPDF_ANNOTATION annot) { FPDFPage_CloseAnnot(annot); }
+};
+
+struct FPDFAvailDeleter {
+ inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); }
+};
+
+struct FPDFBitmapDeleter {
+ inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); }
+};
+
+struct FPDFClipPathDeleter {
+ inline void operator()(FPDF_CLIPPATH clip_path) {
+ FPDF_DestroyClipPath(clip_path);
+ }
+};
+
+struct FPDFDocumentDeleter {
+ inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); }
+};
+
+struct FPDFFontDeleter {
+ inline void operator()(FPDF_FONT font) { FPDFFont_Close(font); }
+};
+
+struct FPDFFormHandleDeleter {
+ inline void operator()(FPDF_FORMHANDLE form) {
+ FPDFDOC_ExitFormFillEnvironment(form);
+ }
+};
+
+struct FPDFJavaScriptActionDeleter {
+ inline void operator()(FPDF_JAVASCRIPT_ACTION javascript) {
+ FPDFDoc_CloseJavaScriptAction(javascript);
+ }
+};
+
+struct FPDFPageDeleter {
+ inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); }
+};
+
+struct FPDFPageLinkDeleter {
+ inline void operator()(FPDF_PAGELINK pagelink) {
+ FPDFLink_CloseWebLinks(pagelink);
+ }
+};
+
+struct FPDFPageObjectDeleter {
+ inline void operator()(FPDF_PAGEOBJECT object) {
+ FPDFPageObj_Destroy(object);
+ }
+};
+
+struct FPDFStructTreeDeleter {
+ inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); }
+};
+
+struct FPDFTextFindDeleter {
+ inline void operator()(FPDF_SCHHANDLE handle) { FPDFText_FindClose(handle); }
+};
+
+struct FPDFTextPageDeleter {
+ inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); }
+};
+
+#endif // PUBLIC_CPP_FPDF_DELETERS_H_
diff --git a/src/main/jni/include/cpp/fpdf_scopers.h b/src/main/jni/include/cpp/fpdf_scopers.h
new file mode 100644
index 00000000..34cf9c46
--- /dev/null
+++ b/src/main/jni/include/cpp/fpdf_scopers.h
@@ -0,0 +1,67 @@
+// Copyright 2018 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_CPP_FPDF_SCOPERS_H_
+#define PUBLIC_CPP_FPDF_SCOPERS_H_
+
+#include
+#include
+
+#include "fpdf_deleters.h"
+
+// Versions of FPDF types that clean up the object at scope exit.
+
+using ScopedFPDFAnnotation =
+ std::unique_ptr::type,
+ FPDFAnnotationDeleter>;
+
+using ScopedFPDFAvail =
+ std::unique_ptr::type, FPDFAvailDeleter>;
+
+using ScopedFPDFBitmap =
+ std::unique_ptr::type, FPDFBitmapDeleter>;
+
+using ScopedFPDFClipPath =
+ std::unique_ptr::type,
+ FPDFClipPathDeleter>;
+
+using ScopedFPDFDocument =
+ std::unique_ptr::type,
+ FPDFDocumentDeleter>;
+
+using ScopedFPDFFont =
+ std::unique_ptr::type, FPDFFontDeleter>;
+
+using ScopedFPDFFormHandle =
+ std::unique_ptr::type,
+ FPDFFormHandleDeleter>;
+
+using ScopedFPDFJavaScriptAction =
+ std::unique_ptr::type,
+ FPDFJavaScriptActionDeleter>;
+
+using ScopedFPDFPage =
+ std::unique_ptr::type, FPDFPageDeleter>;
+
+using ScopedFPDFPageLink =
+ std::unique_ptr::type,
+ FPDFPageLinkDeleter>;
+
+using ScopedFPDFPageObject =
+ std::unique_ptr::type,
+ FPDFPageObjectDeleter>;
+
+using ScopedFPDFStructTree =
+ std::unique_ptr::type,
+ FPDFStructTreeDeleter>;
+
+using ScopedFPDFTextFind =
+ std::unique_ptr::type,
+ FPDFTextFindDeleter>;
+
+using ScopedFPDFTextPage =
+ std::unique_ptr::type,
+ FPDFTextPageDeleter>;
+
+#endif // PUBLIC_CPP_FPDF_SCOPERS_H_
diff --git a/src/main/jni/include/formfiller/FFL_CBA_Fontmap.h b/src/main/jni/include/formfiller/FFL_CBA_Fontmap.h
deleted file mode 100644
index 50f51604..00000000
--- a/src/main/jni/include/formfiller/FFL_CBA_Fontmap.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _RAO_FONTMAP_H_
-#define _RAO_FONTMAP_H_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-class CPDFSDK_Annot;
-
-class CBA_FontMap : public CPWL_FontMap
-{
-public:
- CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
- CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler);
-
- virtual ~CBA_FontMap();
-
- virtual void Initial(FX_LPCSTR fontname = NULL);
-
-public:
- void SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName);
-
- void Reset();
- void SetAPType(const CFX_ByteString& sAPType);
-
-protected:
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);
- virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
- virtual CPDF_Document* GetDocument();
-private:
- CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,
- FX_INT32 nCharset);
- CPDF_Font* GetAnnotDefaultFont(CFX_ByteString &csNameTag);
- void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
-
-private:
- CPDF_Document* m_pDocument;
- CPDF_Dictionary* m_pAnnotDict;
- CPDF_Font* m_pDefaultFont;
- CFX_ByteString m_sDefaultFontName;
-
- CFX_ByteString m_sAPType;
-};
-
-#endif // _RAO_FONTMAP_H_
diff --git a/src/main/jni/include/formfiller/FFL_CheckBox.h b/src/main/jni/include/formfiller/FFL_CheckBox.h
deleted file mode 100644
index 9aaf7fe5..00000000
--- a/src/main/jni/include/formfiller/FFL_CheckBox.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_CHECKBOX_H_
-#define _FFL_CHECKBOX_H_
-
-class CFFL_CheckBox : public CFFL_Button
-{
-public:
- CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget);
- virtual ~CFFL_CheckBox();
-
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-};
-
-#endif //_FFL_CHECKBOX_H_
-
diff --git a/src/main/jni/include/formfiller/FFL_ComboBox.h b/src/main/jni/include/formfiller/FFL_ComboBox.h
deleted file mode 100644
index 6df8347a..00000000
--- a/src/main/jni/include/formfiller/FFL_ComboBox.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_COMBOBOX_H_
- #define _FFL_COMBOBOX_H_
-
-struct FFL_ComboBoxState
-{
- int nIndex;
- int nStart;
- int nEnd;
- CFX_WideString sValue;
-};
-class CBA_FontMap;
-
-class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
-{
-public:
- CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
- virtual ~CFFL_ComboBox();
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa);
- virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew);
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
- virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag);
-
-public:
- virtual void OnSetFocus(CPWL_Wnd* pWnd);
- virtual void OnKillFocus(CPWL_Wnd* pWnd);
-
-public:
- virtual void OnAddUndo(CPWL_Edit* pEdit);
-
-public:
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
-private:
- CFX_WideString GetSelectExportText();
-
-private:
- CBA_FontMap* m_pFontMap;
- FFL_ComboBoxState m_State;
- //CFFL_IM_BOX m_IMBox;
-};
-
-#endif //_FFL_COMBOBOX_H_
-
diff --git a/src/main/jni/include/formfiller/FFL_FormFiller.h b/src/main/jni/include/formfiller/FFL_FormFiller.h
deleted file mode 100644
index 7a3402a7..00000000
--- a/src/main/jni/include/formfiller/FFL_FormFiller.h
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_FORMFILLER_H_
-#define _FFL_FORMFILLER_H_
-
-#include "FFL_IFormFiller.h"
-#include "FFL_CBA_Fontmap.h"
-
-class CPDFSDK_Annot;
-class CFFL_FormFiller;
-class CFFL_Notify;
-class CPDFDoc_Environment;
-class CPDFSDK_PageView;
-class CPDFSDK_Document;
-class CPDFSDK_Widget;
-
-
-#define CFFL_PageView2PDFWindow CFX_MapPtrTemplate
-
-struct FFL_KeyStrokeData
-{
- CFX_WideString swValue;
- FX_BOOL bFull;
- int nSelStart;
- int nSelEnd;
-};
-
-
-
-class CFFL_FormFiller : /*public IBA_AnnotFiller,*/ public IPWL_Provider, public CPWL_TimerHandler
-{
-public:
- CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_FormFiller();
-
- virtual FX_RECT GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow, */FX_DWORD dwFlags);
- virtual void OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow, */FX_DWORD dwFlags);
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot);
- virtual void OnLoad(CPDFSDK_Annot* pAnnot);
- virtual void OnDelete(CPDFSDK_Annot* pAnnot);
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
- virtual void OnSelected(CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
-
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
-public: //CPWL_TimerHandler
- virtual void TimerProc();
- virtual IFX_SystemHandler* GetSystemHandler() const;
-
-public:
- virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData);
- virtual CFX_WideString LoadPopupMenuString(int nIndex);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa);
- virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew);
-
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
-
- virtual void OnKeyStroke(FX_BOOL bKeyDown);
-
- CPDF_Matrix GetCurMatrix();
-
- CPDF_Rect FFLtoPWL(const CPDF_Rect& rect);
- CPDF_Rect PWLtoFFL(const CPDF_Rect& rect);
- CPDF_Point FFLtoPWL(const CPDF_Point& point);
- CPDF_Point PWLtoFFL(const CPDF_Point& point);
-
- CPDF_Point WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt);
- CPDF_Rect FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect& rect);
-
- void SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow);
- CPDF_Rect GetWindowRect(CPDFSDK_PageView* pPageView);
-
- static void FFL_FreeData(void* pData);
-
- FX_BOOL CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag);
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrokeData& data);
-
-public:
- CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew);
- void DestroyPDFWindow(CPDFSDK_PageView* pPageView);
- void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow);
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) = 0;
- virtual CPDF_Rect GetFocusBox(CPDFSDK_PageView* pPageView);
-
-public:
- FX_BOOL IsValid() const;
- CPDF_Rect GetPDFWindowRect() const;
-
- CPDFSDK_PageView* GetCurPageView();
- void SetChangeMark();
-
- virtual void InvalidateRect(double left, double top, double right, double bottom);
- CPDFDoc_Environment* GetApp(){return m_pApp;}
- CPDFSDK_Annot* GetSDKAnnot() {return m_pAnnot;}
-protected:
- CPDFDoc_Environment* m_pApp;
- CPDFSDK_Widget* m_pWidget;
- CPDFSDK_Annot* m_pAnnot;
-
- FX_BOOL m_bValid;
- CFFL_PageView2PDFWindow m_Maps;
- CPDF_Point m_ptOldPos;
-};
-
-class CFFL_Button : public CFFL_FormFiller
-{
-public:
- CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
- virtual ~CFFL_Button();
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual void OnDraw(CPDFSDK_PageView *pPageView/*, HDC hDC*/, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
-
- virtual void OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow, */FX_DWORD dwFlags);
-protected:
- FX_BOOL m_bMouseIn;
- FX_BOOL m_bMouseDown;
-};
-
-//#define CFFL_IM_BOX CFX_ArrayTemplate
-
-#endif
diff --git a/src/main/jni/include/formfiller/FFL_IFormFiller.h b/src/main/jni/include/formfiller/FFL_IFormFiller.h
deleted file mode 100644
index 393f0be3..00000000
--- a/src/main/jni/include/formfiller/FFL_IFormFiller.h
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_IFORMFILLER_H_
-#define _FFL_IFORMFILLER_H_
-
-#include "FormFiller.h"
-class CFFL_FormFiller;
-class CFFL_PrivateData;
-
-#define CFFL_Widget2Filler CFX_MapPtrTemplate
-
-// #define IsALTpressed() (GetKeyState(VK_MENU) < 0)
-// #define IsCTRLpressed() (GetKeyState(VK_CONTROL) < 0)
-// #define IsSHIFTpressed() (GetKeyState(VK_SHIFT)&0x8000)
-// #define IsINSERTpressed() (GetKeyState(VK_INSERT) & 0x01)
-// #define VK_SHIFT 0x10
-// #define VK_CONTROL 0x11
-// #define VK_MENU 0x12
-// #define VK_RETURN 0x0D
-// #define VK_SPACE 0x20
-// #define VK_ESCAPE 0x1B
-
-
-
-class CFFL_IFormFiller :/* public IBA_AnnotFiller, */public IPWL_Filler_Notify//,
-// public IUndo_EventHandler, public IClipboard_Handler
-{
-public:
- CFFL_IFormFiller(CPDFDoc_Environment* pApp);
- virtual ~CFFL_IFormFiller();
-
- virtual FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point);
- virtual FX_RECT GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot);
- virtual void OnLoad(CPDFSDK_Annot* pAnnot);
- virtual void OnDelete(CPDFSDK_Annot* pAnnot);
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
- virtual void OnSelected(CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
-
-public:
- virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet);
- virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
- CFX_WideString & strChange, const CFX_WideString& strChangeEx,
- int nSelStart, int nSelEnd,
- FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag);
- virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ;
-
- virtual void OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow);
- virtual void OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString & strChange,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit);
-
-public:
- virtual void BeforeUndo(CPDFSDK_Document* pDocument);
- virtual void BeforeRedo(CPDFSDK_Document* pDocument);
- virtual void AfterUndo(CPDFSDK_Document* pDocument);
- virtual void AfterRedo(CPDFSDK_Document* pDocument);
-
-public:
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
-public:
- CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);
- void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
-
- static FX_BOOL IsVisible(CPDFSDK_Widget* pWidget);
- static FX_BOOL IsReadOnly(CPDFSDK_Widget* pWidget);
- static FX_BOOL IsFillingAllowed(CPDFSDK_Widget* pWidget);
- static FX_BOOL IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
-
- void OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
- void OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
-
- void OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
- void OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
- void OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag);
-// static LRESULT CALLBACK FFL_WndProc(
-// int code, // hook code
-// WPARAM wParam, // virtual-key code
-// LPARAM lParam // keystroke-message information
-// );
-// static MSG GetLastMessage();
- static int GetCommitKey();
- static FX_BOOL GetKeyDown();
-
-
-public:
-// static MSG g_Msg;
-// static HHOOK m_hookSheet;
-
-private:
- void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
- void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext);
-
-private:
- CPDFDoc_Environment* m_pApp;
- CFFL_Widget2Filler m_Maps;
- FX_BOOL m_bNotifying;
-};
-
-class CFFL_PrivateData
-{
-public:
- CPDFSDK_Widget* pWidget;
- CPDFSDK_PageView* pPageView;
- int nWidgetAge;
- int nValueAge;
-};
-
-#endif //_FFL_IFORMFILLER_H_
-
diff --git a/src/main/jni/include/formfiller/FFL_ListBox.h b/src/main/jni/include/formfiller/FFL_ListBox.h
deleted file mode 100644
index 43f5fce4..00000000
--- a/src/main/jni/include/formfiller/FFL_ListBox.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_LISTBOX_H_
-#define _FFL_LISTBOX_H_
-
-class CBA_FontMap;
-class CFFL_ListBox : public CFFL_FormFiller
-{
-public:
- CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
- virtual ~CFFL_ListBox();
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa);
-
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
- virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag);
-
-private:
- CBA_FontMap* m_pFontMap;
- CFX_MapPtrTemplate m_OriginSelections;
- CFX_ArrayTemplate m_State;
-};
-
-
-#endif //_FFL_LISTBOX_H_
-
diff --git a/src/main/jni/include/formfiller/FFL_Notify.h b/src/main/jni/include/formfiller/FFL_Notify.h
deleted file mode 100644
index c729b745..00000000
--- a/src/main/jni/include/formfiller/FFL_Notify.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#if !defined(_FFL_NOTIFY_H_)
-#define _FFL_NOTIFY_H_
-
-class CFFL_FormFiller;
-
-class CFFL_Notify
-{
-public:
- CFFL_Notify(CFFL_FormFiller * pFormFiller);
- virtual ~CFFL_Notify();
-
-public:
- FX_BOOL OnSetFocus(FX_BOOL & bExit);
- FX_BOOL OnMouseEnter(FX_BOOL & bExit);
- FX_BOOL OnMouseDown(FX_BOOL & bExit);
- FX_BOOL OnMouseUp(FX_BOOL & bExit);
- FX_BOOL OnMouseExit(FX_BOOL & bExit);
- FX_BOOL OnKillFocus(FX_BOOL & bExit);
-
- FX_BOOL OnCalculate();
- FX_BOOL OnFormat(int iCommitKey);
- FX_BOOL OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
- FX_BOOL bShift, FX_BOOL & bRC);
- FX_BOOL OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
- FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull,
- int& nSelStart, int& nSelEnd, FX_BOOL& bRC);
-
- void BeforeNotify();
- void AfterNotify();
- FX_BOOL IsNotifying() const {return m_nNotifyFlag > 0;}
-
-private:
-// CReader_InterForm * GetReaderInterForm();
- FX_BOOL DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit);
- FX_BOOL FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action);
- FX_BOOL FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action);
- FX_BOOL ExecuteActionTree(CPDF_AAction::AActionType eAAT, CPDF_Action & action, FX_BOOL& bExit);
- FX_BOOL ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit);
-
- CFFL_FormFiller * m_pFormFiller;
- FX_BOOL m_bDoActioning;
- FX_INT32 m_nNotifyFlag;
-};
-
-#endif
-
diff --git a/src/main/jni/include/formfiller/FFL_PushButton.h b/src/main/jni/include/formfiller/FFL_PushButton.h
deleted file mode 100644
index be5e735d..00000000
--- a/src/main/jni/include/formfiller/FFL_PushButton.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_PUSHBUTTON_H_
-#define _FFL_PUSHBUTTON_H_
-
-class CFFL_PushButton : public CFFL_Button
-{
-public:
- CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_PushButton();
-
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
-};
-
-#endif //_FFL_PUSHBUTTON_H_
-
diff --git a/src/main/jni/include/formfiller/FFL_RadioButton.h b/src/main/jni/include/formfiller/FFL_RadioButton.h
deleted file mode 100644
index 037e5634..00000000
--- a/src/main/jni/include/formfiller/FFL_RadioButton.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FFL_RADIOBUTTON_H_
-#define _FFL_RADIOBUTTON_H_
-
-class CFFL_RadioButton : public CFFL_Button
-{
-public:
- CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_RadioButton();
-
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-};
-
-#endif //_FFL_RADIOBUTTON_H_
-
diff --git a/src/main/jni/include/formfiller/FFL_TextField.h b/src/main/jni/include/formfiller/FFL_TextField.h
deleted file mode 100644
index d2808e99..00000000
--- a/src/main/jni/include/formfiller/FFL_TextField.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#if !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)
-#define AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_
-
-#include "FFL_FormFiller.h"
-
-#define BF_ALIGN_LEFT 0
-#define BF_ALIGN_MIDDLE 1
-#define BF_ALIGN_RIGHT 2
-
-class CBA_FontMap;
-
-class CFFL_EditUndoItem //: public IUndoItem
-{
-public:
- CFFL_EditUndoItem(CPWL_Edit* pEdit);
- virtual ~CFFL_EditUndoItem();
-
- virtual void Undo();
- virtual void Redo();
- virtual CFX_WideString GetDescr();
- virtual void Release();
-
-private:
- CPWL_Edit* m_pEdit;
-};
-
-struct FFL_TextFieldState
-{
- int nStart;
- int nEnd;
- CFX_WideString sValue;
-};
-
-class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
-{
-public:
- CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_TextField();
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa);
- virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew);
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
-
-public:
- virtual void OnSetFocus(CPWL_Wnd* pWnd);
- virtual void OnKillFocus(CPWL_Wnd* pWnd);
-
-public:
- virtual void OnAddUndo(CPWL_Edit* pEdit);
-
-public:
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
-private:
- CBA_FontMap* m_pFontMap;
-// CBA_SpellCheck* m_pSpellCheck;
- FFL_TextFieldState m_State;
-// CFFL_IM_BOX m_IMBox;
-};
-
-#endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)
diff --git a/src/main/jni/include/formfiller/FFL_Utils.h b/src/main/jni/include/formfiller/FFL_Utils.h
deleted file mode 100644
index 2fdc7b17..00000000
--- a/src/main/jni/include/formfiller/FFL_Utils.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#define FFL_BASE_USERUNIT 1.0f / 72.0f
-
-template T FFL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
-template T FFL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
-
-class CFFL_Utils
-{
-public:
- static CPDF_Rect MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);
- static CPDF_Rect InflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);
- static CPDF_Rect DeflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);
- static FX_BOOL TraceObject(CPDF_Object* pObj);
-};
-
diff --git a/src/main/jni/include/formfiller/FormFiller.h b/src/main/jni/include/formfiller/FormFiller.h
deleted file mode 100644
index 8e45d5ed..00000000
--- a/src/main/jni/include/formfiller/FormFiller.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FORMFILLER_H_
-#define _FORMFILLER_H_
-
-
-
-#ifndef _INC_PDFAPI
- #define _INC_PDFAPI
-
- #include "../../../core/include/fpdfapi/fpdf_module.h"
- #include "../../../core/include/fpdfdoc/fpdf_doc.h"
- #include "../../../core/include/fpdfdoc/fpdf_vt.h"
- #include "../../../core/include/fxcrt/fx_xml.h"
-
-#endif
-
-#include "../fsdk_mgr.h"
-
-#include "../fxedit/fx_edit.h"
-#include "../pdfwindow/IPDFWindow.h"
-
-
-
-#endif //_FORMFILLER_H_
-
diff --git a/src/main/jni/include/fpdf_annot.h b/src/main/jni/include/fpdf_annot.h
new file mode 100644
index 00000000..ef30d9a2
--- /dev/null
+++ b/src/main/jni/include/fpdf_annot.h
@@ -0,0 +1,1012 @@
+// Copyright 2017 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_FPDF_ANNOT_H_
+#define PUBLIC_FPDF_ANNOT_H_
+
+#include
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdf_formfill.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#define FPDF_ANNOT_UNKNOWN 0
+#define FPDF_ANNOT_TEXT 1
+#define FPDF_ANNOT_LINK 2
+#define FPDF_ANNOT_FREETEXT 3
+#define FPDF_ANNOT_LINE 4
+#define FPDF_ANNOT_SQUARE 5
+#define FPDF_ANNOT_CIRCLE 6
+#define FPDF_ANNOT_POLYGON 7
+#define FPDF_ANNOT_POLYLINE 8
+#define FPDF_ANNOT_HIGHLIGHT 9
+#define FPDF_ANNOT_UNDERLINE 10
+#define FPDF_ANNOT_SQUIGGLY 11
+#define FPDF_ANNOT_STRIKEOUT 12
+#define FPDF_ANNOT_STAMP 13
+#define FPDF_ANNOT_CARET 14
+#define FPDF_ANNOT_INK 15
+#define FPDF_ANNOT_POPUP 16
+#define FPDF_ANNOT_FILEATTACHMENT 17
+#define FPDF_ANNOT_SOUND 18
+#define FPDF_ANNOT_MOVIE 19
+#define FPDF_ANNOT_WIDGET 20
+#define FPDF_ANNOT_SCREEN 21
+#define FPDF_ANNOT_PRINTERMARK 22
+#define FPDF_ANNOT_TRAPNET 23
+#define FPDF_ANNOT_WATERMARK 24
+#define FPDF_ANNOT_THREED 25
+#define FPDF_ANNOT_RICHMEDIA 26
+#define FPDF_ANNOT_XFAWIDGET 27
+#define FPDF_ANNOT_REDACT 28
+
+// Refer to PDF Reference (6th edition) table 8.16 for all annotation flags.
+#define FPDF_ANNOT_FLAG_NONE 0
+#define FPDF_ANNOT_FLAG_INVISIBLE (1 << 0)
+#define FPDF_ANNOT_FLAG_HIDDEN (1 << 1)
+#define FPDF_ANNOT_FLAG_PRINT (1 << 2)
+#define FPDF_ANNOT_FLAG_NOZOOM (1 << 3)
+#define FPDF_ANNOT_FLAG_NOROTATE (1 << 4)
+#define FPDF_ANNOT_FLAG_NOVIEW (1 << 5)
+#define FPDF_ANNOT_FLAG_READONLY (1 << 6)
+#define FPDF_ANNOT_FLAG_LOCKED (1 << 7)
+#define FPDF_ANNOT_FLAG_TOGGLENOVIEW (1 << 8)
+
+#define FPDF_ANNOT_APPEARANCEMODE_NORMAL 0
+#define FPDF_ANNOT_APPEARANCEMODE_ROLLOVER 1
+#define FPDF_ANNOT_APPEARANCEMODE_DOWN 2
+#define FPDF_ANNOT_APPEARANCEMODE_COUNT 3
+
+// Refer to PDF Reference version 1.7 table 8.70 for field flags common to all
+// interactive form field types.
+#define FPDF_FORMFLAG_NONE 0
+#define FPDF_FORMFLAG_READONLY (1 << 0)
+#define FPDF_FORMFLAG_REQUIRED (1 << 1)
+#define FPDF_FORMFLAG_NOEXPORT (1 << 2)
+
+// Refer to PDF Reference version 1.7 table 8.77 for field flags specific to
+// interactive form text fields.
+#define FPDF_FORMFLAG_TEXT_MULTILINE (1 << 12)
+#define FPDF_FORMFLAG_TEXT_PASSWORD (1 << 13)
+
+// Refer to PDF Reference version 1.7 table 8.79 for field flags specific to
+// interactive form choice fields.
+#define FPDF_FORMFLAG_CHOICE_COMBO (1 << 17)
+#define FPDF_FORMFLAG_CHOICE_EDIT (1 << 18)
+#define FPDF_FORMFLAG_CHOICE_MULTI_SELECT (1 << 21)
+
+// Additional actions type of form field:
+// K, on key stroke, JavaScript action.
+// F, on format, JavaScript action.
+// V, on validate, JavaScript action.
+// C, on calculate, JavaScript action.
+#define FPDF_ANNOT_AACTION_KEY_STROKE 12
+#define FPDF_ANNOT_AACTION_FORMAT 13
+#define FPDF_ANNOT_AACTION_VALIDATE 14
+#define FPDF_ANNOT_AACTION_CALCULATE 15
+
+typedef enum FPDFANNOT_COLORTYPE {
+ FPDFANNOT_COLORTYPE_Color = 0,
+ FPDFANNOT_COLORTYPE_InteriorColor
+} FPDFANNOT_COLORTYPE;
+
+// Experimental API.
+// Check if an annotation subtype is currently supported for creation.
+// Currently supported subtypes:
+// - circle
+// - fileattachment
+// - freetext
+// - highlight
+// - ink
+// - link
+// - popup
+// - square,
+// - squiggly
+// - stamp
+// - strikeout
+// - text
+// - underline
+//
+// subtype - the subtype to be checked.
+//
+// Returns true if this subtype supported.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_IsSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype);
+
+// Experimental API.
+// Create an annotation in |page| of the subtype |subtype|. If the specified
+// subtype is illegal or unsupported, then a new annotation will not be created.
+// Must call FPDFPage_CloseAnnot() when the annotation returned by this
+// function is no longer needed.
+//
+// page - handle to a page.
+// subtype - the subtype of the new annotation.
+//
+// Returns a handle to the new annotation object, or NULL on failure.
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
+FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype);
+
+// Experimental API.
+// Get the number of annotations in |page|.
+//
+// page - handle to a page.
+//
+// Returns the number of annotations in |page|.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotCount(FPDF_PAGE page);
+
+// Experimental API.
+// Get annotation in |page| at |index|. Must call FPDFPage_CloseAnnot() when the
+// annotation returned by this function is no longer needed.
+//
+// page - handle to a page.
+// index - the index of the annotation.
+//
+// Returns a handle to the annotation object, or NULL on failure.
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFPage_GetAnnot(FPDF_PAGE page,
+ int index);
+
+// Experimental API.
+// Get the index of |annot| in |page|. This is the opposite of
+// FPDFPage_GetAnnot().
+//
+// page - handle to the page that the annotation is on.
+// annot - handle to an annotation.
+//
+// Returns the index of |annot|, or -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotIndex(FPDF_PAGE page,
+ FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Close an annotation. Must be called when the annotation returned by
+// FPDFPage_CreateAnnot() or FPDFPage_GetAnnot() is no longer needed. This
+// function does not remove the annotation from the document.
+//
+// annot - handle to an annotation.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_CloseAnnot(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Remove the annotation in |page| at |index|.
+//
+// page - handle to a page.
+// index - the index of the annotation.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_RemoveAnnot(FPDF_PAGE page,
+ int index);
+
+// Experimental API.
+// Get the subtype of an annotation.
+//
+// annot - handle to an annotation.
+//
+// Returns the annotation subtype.
+FPDF_EXPORT FPDF_ANNOTATION_SUBTYPE FPDF_CALLCONV
+FPDFAnnot_GetSubtype(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Check if an annotation subtype is currently supported for object extraction,
+// update, and removal.
+// Currently supported subtypes: ink and stamp.
+//
+// subtype - the subtype to be checked.
+//
+// Returns true if this subtype supported.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_IsObjectSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype);
+
+// Experimental API.
+// Update |obj| in |annot|. |obj| must be in |annot| already and must have
+// been retrieved by FPDFAnnot_GetObject(). Currently, only ink and stamp
+// annotations are supported by this API. Also note that only path, image, and
+// text objects have APIs for modification; see FPDFPath_*(), FPDFText_*(), and
+// FPDFImageObj_*().
+//
+// annot - handle to an annotation.
+// obj - handle to the object that |annot| needs to update.
+//
+// Return true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_UpdateObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj);
+
+// Experimental API.
+// Add a new InkStroke, represented by an array of points, to the InkList of
+// |annot|. The API creates an InkList if one doesn't already exist in |annot|.
+// This API works only for ink annotations. Please refer to ISO 32000-1:2008
+// spec, section 12.5.6.13.
+//
+// annot - handle to an annotation.
+// points - pointer to a FS_POINTF array representing input points.
+// point_count - number of elements in |points| array. This should not exceed
+// the maximum value that can be represented by an int32_t).
+//
+// Returns the 0-based index at which the new InkStroke is added in the InkList
+// of the |annot|. Returns -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_AddInkStroke(FPDF_ANNOTATION annot,
+ const FS_POINTF* points,
+ size_t point_count);
+
+// Experimental API.
+// Removes an InkList in |annot|.
+// This API works only for ink annotations.
+//
+// annot - handle to an annotation.
+//
+// Return true on successful removal of /InkList entry from context of the
+// non-null ink |annot|. Returns false on failure.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_RemoveInkList(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Add |obj| to |annot|. |obj| must have been created by
+// FPDFPageObj_CreateNew{Path|Rect}() or FPDFPageObj_New{Text|Image}Obj(), and
+// will be owned by |annot|. Note that an |obj| cannot belong to more than one
+// |annot|. Currently, only ink and stamp annotations are supported by this API.
+// Also note that only path, image, and text objects have APIs for creation.
+//
+// annot - handle to an annotation.
+// obj - handle to the object that is to be added to |annot|.
+//
+// Return true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj);
+
+// Experimental API.
+// Get the total number of objects in |annot|, including path objects, text
+// objects, external objects, image objects, and shading objects.
+//
+// annot - handle to an annotation.
+//
+// Returns the number of objects in |annot|.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Get the object in |annot| at |index|.
+//
+// annot - handle to an annotation.
+// index - the index of the object.
+//
+// Return a handle to the object, or NULL on failure.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index);
+
+// Experimental API.
+// Remove the object in |annot| at |index|.
+//
+// annot - handle to an annotation.
+// index - the index of the object to be removed.
+//
+// Return true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_RemoveObject(FPDF_ANNOTATION annot, int index);
+
+// Experimental API.
+// Set the color of an annotation. Fails when called on annotations with
+// appearance streams already defined; instead use
+// FPDFPath_Set{Stroke|Fill}Color().
+//
+// annot - handle to an annotation.
+// type - type of the color to be set.
+// R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255.
+// A - buffer to hold the opacity. Ranges from 0 to 255.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetColor(FPDF_ANNOTATION annot,
+ FPDFANNOT_COLORTYPE type,
+ unsigned int R,
+ unsigned int G,
+ unsigned int B,
+ unsigned int A);
+
+// Experimental API.
+// Get the color of an annotation. If no color is specified, default to yellow
+// for highlight annotation, black for all else. Fails when called on
+// annotations with appearance streams already defined; instead use
+// FPDFPath_Get{Stroke|Fill}Color().
+//
+// annot - handle to an annotation.
+// type - type of the color requested.
+// R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255.
+// A - buffer to hold the opacity. Ranges from 0 to 255.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetColor(FPDF_ANNOTATION annot,
+ FPDFANNOT_COLORTYPE type,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A);
+
+// Experimental API.
+// Check if the annotation is of a type that has attachment points
+// (i.e. quadpoints). Quadpoints are the vertices of the rectangle that
+// encompasses the texts affected by the annotation. They provide the
+// coordinates in the page where the annotation is attached. Only text markup
+// annotations (i.e. highlight, strikeout, squiggly, and underline) and link
+// annotations have quadpoints.
+//
+// annot - handle to an annotation.
+//
+// Returns true if the annotation is of a type that has quadpoints, false
+// otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_HasAttachmentPoints(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Replace the attachment points (i.e. quadpoints) set of an annotation at
+// |quad_index|. This index needs to be within the result of
+// FPDFAnnot_CountAttachmentPoints().
+// If the annotation's appearance stream is defined and this annotation is of a
+// type with quadpoints, then update the bounding box too if the new quadpoints
+// define a bigger one.
+//
+// annot - handle to an annotation.
+// quad_index - index of the set of quadpoints.
+// quad_points - the quadpoints to be set.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot,
+ size_t quad_index,
+ const FS_QUADPOINTSF* quad_points);
+
+// Experimental API.
+// Append to the list of attachment points (i.e. quadpoints) of an annotation.
+// If the annotation's appearance stream is defined and this annotation is of a
+// type with quadpoints, then update the bounding box too if the new quadpoints
+// define a bigger one.
+//
+// annot - handle to an annotation.
+// quad_points - the quadpoints to be set.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_AppendAttachmentPoints(FPDF_ANNOTATION annot,
+ const FS_QUADPOINTSF* quad_points);
+
+// Experimental API.
+// Get the number of sets of quadpoints of an annotation.
+//
+// annot - handle to an annotation.
+//
+// Returns the number of sets of quadpoints, or 0 on failure.
+FPDF_EXPORT size_t FPDF_CALLCONV
+FPDFAnnot_CountAttachmentPoints(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Get the attachment points (i.e. quadpoints) of an annotation.
+//
+// annot - handle to an annotation.
+// quad_index - index of the set of quadpoints.
+// quad_points - receives the quadpoints; must not be NULL.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot,
+ size_t quad_index,
+ FS_QUADPOINTSF* quad_points);
+
+// Experimental API.
+// Set the annotation rectangle defining the location of the annotation. If the
+// annotation's appearance stream is defined and this annotation is of a type
+// without quadpoints, then update the bounding box too if the new rectangle
+// defines a bigger one.
+//
+// annot - handle to an annotation.
+// rect - the annotation rectangle to be set.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetRect(FPDF_ANNOTATION annot,
+ const FS_RECTF* rect);
+
+// Experimental API.
+// Get the annotation rectangle defining the location of the annotation.
+//
+// annot - handle to an annotation.
+// rect - receives the rectangle; must not be NULL.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetRect(FPDF_ANNOTATION annot,
+ FS_RECTF* rect);
+
+// Experimental API.
+// Get the vertices of a polygon or polyline annotation. |buffer| is an array of
+// points of the annotation. If |length| is less than the returned length, or
+// |annot| or |buffer| is NULL, |buffer| will not be modified.
+//
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
+// buffer - buffer for holding the points.
+// length - length of the buffer in points.
+//
+// Returns the number of points if the annotation is of type polygon or
+// polyline, 0 otherwise.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetVertices(FPDF_ANNOTATION annot,
+ FS_POINTF* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Get the number of paths in the ink list of an ink annotation.
+//
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
+//
+// Returns the number of paths in the ink list if the annotation is of type ink,
+// 0 otherwise.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetInkListCount(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Get a path in the ink list of an ink annotation. |buffer| is an array of
+// points of the path. If |length| is less than the returned length, or |annot|
+// or |buffer| is NULL, |buffer| will not be modified.
+//
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
+// path_index - index of the path
+// buffer - buffer for holding the points.
+// length - length of the buffer in points.
+//
+// Returns the number of points of the path if the annotation is of type ink, 0
+// otherwise.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetInkListPath(FPDF_ANNOTATION annot,
+ unsigned long path_index,
+ FS_POINTF* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Get the starting and ending coordinates of a line annotation.
+//
+// annot - handle to an annotation, as returned by e.g. FPDFPage_GetAnnot()
+// start - starting point
+// end - ending point
+//
+// Returns true if the annotation is of type line, |start| and |end| are not
+// NULL, false otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetLine(FPDF_ANNOTATION annot,
+ FS_POINTF* start,
+ FS_POINTF* end);
+
+// Experimental API.
+// Set the characteristics of the annotation's border (rounded rectangle).
+//
+// annot - handle to an annotation
+// horizontal_radius - horizontal corner radius, in default user space units
+// vertical_radius - vertical corner radius, in default user space units
+// border_width - border width, in default user space units
+//
+// Returns true if setting the border for |annot| succeeds, false otherwise.
+//
+// If |annot| contains an appearance stream that overrides the border values,
+// then the appearance stream will be removed on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetBorder(FPDF_ANNOTATION annot,
+ float horizontal_radius,
+ float vertical_radius,
+ float border_width);
+
+// Experimental API.
+// Get the characteristics of the annotation's border (rounded rectangle).
+//
+// annot - handle to an annotation
+// horizontal_radius - horizontal corner radius, in default user space units
+// vertical_radius - vertical corner radius, in default user space units
+// border_width - border width, in default user space units
+//
+// Returns true if |horizontal_radius|, |vertical_radius| and |border_width| are
+// not NULL, false otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_GetBorder(FPDF_ANNOTATION annot,
+ float* horizontal_radius,
+ float* vertical_radius,
+ float* border_width);
+
+// Experimental API.
+// Get the JavaScript of an event of the annotation's additional actions.
+// |buffer| is only modified if |buflen| is large enough to hold the whole
+// JavaScript string. If |buflen| is smaller, the total size of the JavaScript
+// is still returned, but nothing is copied. If there is no JavaScript for
+// |event| in |annot|, an empty string is written to |buf| and 2 is returned,
+// denoting the size of the null terminator in the buffer. On other errors,
+// nothing is written to |buffer| and 0 is returned.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+// event - event type, one of the FPDF_ANNOT_AACTION_* values.
+// buffer - buffer for holding the value string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes, including the 2-byte
+// null terminator.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetFormAdditionalActionJavaScript(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ int event,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Check if |annot|'s dictionary has |key| as a key.
+//
+// annot - handle to an annotation.
+// key - the key to look for, encoded in UTF-8.
+//
+// Returns true if |key| exists.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot,
+ FPDF_BYTESTRING key);
+
+// Experimental API.
+// Get the type of the value corresponding to |key| in |annot|'s dictionary.
+//
+// annot - handle to an annotation.
+// key - the key to look for, encoded in UTF-8.
+//
+// Returns the type of the dictionary value.
+FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV
+FPDFAnnot_GetValueType(FPDF_ANNOTATION annot, FPDF_BYTESTRING key);
+
+// Experimental API.
+// Set the string value corresponding to |key| in |annot|'s dictionary,
+// overwriting the existing value if any. The value type would be
+// FPDF_OBJECT_STRING after this function call succeeds.
+//
+// annot - handle to an annotation.
+// key - the key to the dictionary entry to be set, encoded in UTF-8.
+// value - the string value to be set, encoded in UTF-16LE.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_SetStringValue(FPDF_ANNOTATION annot,
+ FPDF_BYTESTRING key,
+ FPDF_WIDESTRING value);
+
+// Experimental API.
+// Get the string value corresponding to |key| in |annot|'s dictionary. |buffer|
+// is only modified if |buflen| is longer than the length of contents. Note that
+// if |key| does not exist in the dictionary or if |key|'s corresponding value
+// in the dictionary is not a string (i.e. the value is not of type
+// FPDF_OBJECT_STRING or FPDF_OBJECT_NAME), then an empty string would be copied
+// to |buffer| and the return value would be 2. On other errors, nothing would
+// be added to |buffer| and the return value would be 0.
+//
+// annot - handle to an annotation.
+// key - the key to the requested dictionary entry, encoded in UTF-8.
+// buffer - buffer for holding the value string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot,
+ FPDF_BYTESTRING key,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Get the float value corresponding to |key| in |annot|'s dictionary. Writes
+// value to |value| and returns True if |key| exists in the dictionary and
+// |key|'s corresponding value is a number (FPDF_OBJECT_NUMBER), False
+// otherwise.
+//
+// annot - handle to an annotation.
+// key - the key to the requested dictionary entry, encoded in UTF-8.
+// value - receives the value, must not be NULL.
+//
+// Returns True if value found, False otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_GetNumberValue(FPDF_ANNOTATION annot,
+ FPDF_BYTESTRING key,
+ float* value);
+
+// Experimental API.
+// Set the AP (appearance string) in |annot|'s dictionary for a given
+// |appearanceMode|.
+//
+// annot - handle to an annotation.
+// appearanceMode - the appearance mode (normal, rollover or down) for which
+// to get the AP.
+// value - the string value to be set, encoded in UTF-16LE. If
+// nullptr is passed, the AP is cleared for that mode. If the
+// mode is Normal, APs for all modes are cleared.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_SetAP(FPDF_ANNOTATION annot,
+ FPDF_ANNOT_APPEARANCEMODE appearanceMode,
+ FPDF_WIDESTRING value);
+
+// Experimental API.
+// Get the AP (appearance string) from |annot|'s dictionary for a given
+// |appearanceMode|.
+// |buffer| is only modified if |buflen| is large enough to hold the whole AP
+// string. If |buflen| is smaller, the total size of the AP is still returned,
+// but nothing is copied.
+// If there is no appearance stream for |annot| in |appearanceMode|, an empty
+// string is written to |buf| and 2 is returned.
+// On other errors, nothing is written to |buffer| and 0 is returned.
+//
+// annot - handle to an annotation.
+// appearanceMode - the appearance mode (normal, rollover or down) for which
+// to get the AP.
+// buffer - buffer for holding the value string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetAP(FPDF_ANNOTATION annot,
+ FPDF_ANNOT_APPEARANCEMODE appearanceMode,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Get the annotation corresponding to |key| in |annot|'s dictionary. Common
+// keys for linking annotations include "IRT" and "Popup". Must call
+// FPDFPage_CloseAnnot() when the annotation returned by this function is no
+// longer needed.
+//
+// annot - handle to an annotation.
+// key - the key to the requested dictionary entry, encoded in UTF-8.
+//
+// Returns a handle to the linked annotation object, or NULL on failure.
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
+FPDFAnnot_GetLinkedAnnot(FPDF_ANNOTATION annot, FPDF_BYTESTRING key);
+
+// Experimental API.
+// Get the annotation flags of |annot|.
+//
+// annot - handle to an annotation.
+//
+// Returns the annotation flags.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetFlags(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Set the |annot|'s flags to be of the value |flags|.
+//
+// annot - handle to an annotation.
+// flags - the flag values to be set.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetFlags(FPDF_ANNOTATION annot,
+ int flags);
+
+// Experimental API.
+// Get the annotation flags of |annot|.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+//
+// Returns the annotation flags specific to interactive forms.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFAnnot_GetFormFieldFlags(FPDF_FORMHANDLE handle,
+ FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Retrieves an interactive form annotation whose rectangle contains a given
+// point on a page. Must call FPDFPage_CloseAnnot() when the annotation returned
+// is no longer needed.
+//
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - handle to the page, returned by FPDF_LoadPage function.
+// point - position in PDF "user space".
+//
+// Returns the interactive form annotation whose rectangle contains the given
+// coordinates on the page. If there is no such annotation, return NULL.
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
+FPDFAnnot_GetFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ const FS_POINTF* point);
+
+// Experimental API.
+// Gets the name of |annot|, which is an interactive form annotation.
+// |buffer| is only modified if |buflen| is longer than the length of contents.
+// In case of error, nothing will be added to |buffer| and the return value will
+// be 0. Note that return value of empty string is 2 for "\0\0".
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+// buffer - buffer for holding the name string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetFormFieldName(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Gets the alternate name of |annot|, which is an interactive form annotation.
+// |buffer| is only modified if |buflen| is longer than the length of contents.
+// In case of error, nothing will be added to |buffer| and the return value will
+// be 0. Note that return value of empty string is 2 for "\0\0".
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+// buffer - buffer for holding the alternate name string, encoded in
+// UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetFormFieldAlternateName(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Gets the form field type of |annot|, which is an interactive form annotation.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+//
+// Returns the type of the form field (one of the FPDF_FORMFIELD_* values) on
+// success. Returns -1 on error.
+// See field types in fpdf_formfill.h.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFAnnot_GetFormFieldType(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Gets the value of |annot|, which is an interactive form annotation.
+// |buffer| is only modified if |buflen| is longer than the length of contents.
+// In case of error, nothing will be added to |buffer| and the return value will
+// be 0. Note that return value of empty string is 2 for "\0\0".
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+// buffer - buffer for holding the value string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetFormFieldValue(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Get the number of options in the |annot|'s "Opt" dictionary. Intended for
+// use with listbox and combobox widget annotations.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+//
+// Returns the number of options in "Opt" dictionary on success. Return value
+// will be -1 if annotation does not have an "Opt" dictionary or other error.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetOptionCount(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Get the string value for the label of the option at |index| in |annot|'s
+// "Opt" dictionary. Intended for use with listbox and combobox widget
+// annotations. |buffer| is only modified if |buflen| is longer than the length
+// of contents. If index is out of range or in case of other error, nothing
+// will be added to |buffer| and the return value will be 0. Note that
+// return value of empty string is 2 for "\0\0".
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+// index - numeric index of the option in the "Opt" array
+// buffer - buffer for holding the value string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+// If |annot| does not have an "Opt" array, |index| is out of range or if any
+// other error occurs, returns 0.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetOptionLabel(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ int index,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Determine whether or not the option at |index| in |annot|'s "Opt" dictionary
+// is selected. Intended for use with listbox and combobox widget annotations.
+//
+// handle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+// index - numeric index of the option in the "Opt" array.
+//
+// Returns true if the option at |index| in |annot|'s "Opt" dictionary is
+// selected, false otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_IsOptionSelected(FPDF_FORMHANDLE handle,
+ FPDF_ANNOTATION annot,
+ int index);
+
+// Experimental API.
+// Get the float value of the font size for an |annot| with variable text.
+// If 0, the font is to be auto-sized: its size is computed as a function of
+// the height of the annotation rectangle.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+// value - Required. Float which will be set to font size on success.
+//
+// Returns true if the font size was set in |value|, false on error or if
+// |value| not provided.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_GetFontSize(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ float* value);
+
+// Experimental API.
+// Get the RGB value of the font color for an |annot| with variable text.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+// R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255.
+//
+// Returns true if the font color was set, false on error or if the font
+// color was not provided.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_GetFontColor(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B);
+
+// Experimental API.
+// Determine if |annot| is a form widget that is checked. Intended for use with
+// checkbox and radio button widgets.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+//
+// Returns true if |annot| is a form widget and is checked, false otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_IsChecked(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Set the list of focusable annotation subtypes. Annotations of subtype
+// FPDF_ANNOT_WIDGET are by default focusable. New subtypes set using this API
+// will override the existing subtypes.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// subtypes - list of annotation subtype which can be tabbed over.
+// count - total number of annotation subtype in list.
+// Returns true if list of annotation subtype is set successfully, false
+// otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_SetFocusableSubtypes(FPDF_FORMHANDLE hHandle,
+ const FPDF_ANNOTATION_SUBTYPE* subtypes,
+ size_t count);
+
+// Experimental API.
+// Get the count of focusable annotation subtypes as set by host
+// for a |hHandle|.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// Returns the count of focusable annotation subtypes or -1 on error.
+// Note : Annotations of type FPDF_ANNOT_WIDGET are by default focusable.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFAnnot_GetFocusableSubtypesCount(FPDF_FORMHANDLE hHandle);
+
+// Experimental API.
+// Get the list of focusable annotation subtype as set by host.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// subtypes - receives the list of annotation subtype which can be tabbed
+// over. Caller must have allocated |subtypes| more than or
+// equal to the count obtained from
+// FPDFAnnot_GetFocusableSubtypesCount() API.
+// count - size of |subtypes|.
+// Returns true on success and set list of annotation subtype to |subtypes|,
+// false otherwise.
+// Note : Annotations of type FPDF_ANNOT_WIDGET are by default focusable.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAnnot_GetFocusableSubtypes(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION_SUBTYPE* subtypes,
+ size_t count);
+
+// Experimental API.
+// Gets FPDF_LINK object for |annot|. Intended to use for link annotations.
+//
+// annot - handle to an annotation.
+//
+// Returns FPDF_LINK from the FPDF_ANNOTATION and NULL on failure,
+// if the input annot is NULL or input annot's subtype is not link.
+FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFAnnot_GetLink(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Gets the count of annotations in the |annot|'s control group.
+// A group of interactive form annotations is collectively called a form
+// control group. Here, |annot|, an interactive form annotation, should be
+// either a radio button or a checkbox.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+//
+// Returns number of controls in its control group or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFAnnot_GetFormControlCount(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Gets the index of |annot| in |annot|'s control group.
+// A group of interactive form annotations is collectively called a form
+// control group. Here, |annot|, an interactive form annotation, should be
+// either a radio button or a checkbox.
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment.
+// annot - handle to an annotation.
+//
+// Returns index of a given |annot| in its control group or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFAnnot_GetFormControlIndex(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Gets the export value of |annot| which is an interactive form annotation.
+// Intended for use with radio button and checkbox widget annotations.
+// |buffer| is only modified if |buflen| is longer than the length of contents.
+// In case of error, nothing will be added to |buffer| and the return value
+// will be 0. Note that return value of empty string is 2 for "\0\0".
+//
+// hHandle - handle to the form fill module, returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - handle to an interactive form annotation.
+// buffer - buffer for holding the value string, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the string value in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAnnot_GetFormFieldExportValue(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Add a URI action to |annot|, overwriting the existing action, if any.
+//
+// annot - handle to a link annotation.
+// uri - the URI to be set, encoded in 7-bit ASCII.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetURI(FPDF_ANNOTATION annot,
+ const char* uri);
+
+// Experimental API.
+// Get the attachment from |annot|.
+//
+// annot - handle to a file annotation.
+//
+// Returns the handle to the attachment object, or NULL on failure.
+FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
+FPDFAnnot_GetFileAttachment(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Add an embedded file with |name| to |annot|.
+//
+// annot - handle to a file annotation.
+// name - name of the new attachment.
+//
+// Returns a handle to the new attachment object, or NULL on failure.
+FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
+FPDFAnnot_AddFileAttachment(FPDF_ANNOTATION annot, FPDF_WIDESTRING name);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_ANNOT_H_
diff --git a/src/main/jni/include/fpdf_attachment.h b/src/main/jni/include/fpdf_attachment.h
new file mode 100644
index 00000000..d25bddab
--- /dev/null
+++ b/src/main/jni/include/fpdf_attachment.h
@@ -0,0 +1,179 @@
+// Copyright 2017 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_FPDF_ATTACHMENT_H_
+#define PUBLIC_FPDF_ATTACHMENT_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Experimental API.
+// Get the number of embedded files in |document|.
+//
+// document - handle to a document.
+//
+// Returns the number of embedded files in |document|.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Add an embedded file with |name| in |document|. If |name| is empty, or if
+// |name| is the name of a existing embedded file in |document|, or if
+// |document|'s embedded file name tree is too deep (i.e. |document| has too
+// many embedded files already), then a new attachment will not be added.
+//
+// document - handle to a document.
+// name - name of the new attachment.
+//
+// Returns a handle to the new attachment object, or NULL on failure.
+FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
+FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name);
+
+// Experimental API.
+// Get the embedded attachment at |index| in |document|. Note that the returned
+// attachment handle is only valid while |document| is open.
+//
+// document - handle to a document.
+// index - the index of the requested embedded file.
+//
+// Returns the handle to the attachment object, or NULL on failure.
+FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
+FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index);
+
+// Experimental API.
+// Delete the embedded attachment at |index| in |document|. Note that this does
+// not remove the attachment data from the PDF file; it simply removes the
+// file's entry in the embedded files name tree so that it does not appear in
+// the attachment list. This behavior may change in the future.
+//
+// document - handle to a document.
+// index - the index of the embedded file to be deleted.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFDoc_DeleteAttachment(FPDF_DOCUMENT document, int index);
+
+// Experimental API.
+// Get the name of the |attachment| file. |buffer| is only modified if |buflen|
+// is longer than the length of the file name. On errors, |buffer| is unmodified
+// and the returned length is 0.
+//
+// attachment - handle to an attachment.
+// buffer - buffer for holding the file name, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the file name in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAttachment_GetName(FPDF_ATTACHMENT attachment,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Check if the params dictionary of |attachment| has |key| as a key.
+//
+// attachment - handle to an attachment.
+// key - the key to look for, encoded in UTF-8.
+//
+// Returns true if |key| exists.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAttachment_HasKey(FPDF_ATTACHMENT attachment, FPDF_BYTESTRING key);
+
+// Experimental API.
+// Get the type of the value corresponding to |key| in the params dictionary of
+// the embedded |attachment|.
+//
+// attachment - handle to an attachment.
+// key - the key to look for, encoded in UTF-8.
+//
+// Returns the type of the dictionary value.
+FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV
+FPDFAttachment_GetValueType(FPDF_ATTACHMENT attachment, FPDF_BYTESTRING key);
+
+// Experimental API.
+// Set the string value corresponding to |key| in the params dictionary of the
+// embedded file |attachment|, overwriting the existing value if any. The value
+// type should be FPDF_OBJECT_STRING after this function call succeeds.
+//
+// attachment - handle to an attachment.
+// key - the key to the dictionary entry, encoded in UTF-8.
+// value - the string value to be set, encoded in UTF-16LE.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAttachment_SetStringValue(FPDF_ATTACHMENT attachment,
+ FPDF_BYTESTRING key,
+ FPDF_WIDESTRING value);
+
+// Experimental API.
+// Get the string value corresponding to |key| in the params dictionary of the
+// embedded file |attachment|. |buffer| is only modified if |buflen| is longer
+// than the length of the string value. Note that if |key| does not exist in the
+// dictionary or if |key|'s corresponding value in the dictionary is not a
+// string (i.e. the value is not of type FPDF_OBJECT_STRING or
+// FPDF_OBJECT_NAME), then an empty string would be copied to |buffer| and the
+// return value would be 2. On other errors, nothing would be added to |buffer|
+// and the return value would be 0.
+//
+// attachment - handle to an attachment.
+// key - the key to the requested string value, encoded in UTF-8.
+// buffer - buffer for holding the string value encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the dictionary value string in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAttachment_GetStringValue(FPDF_ATTACHMENT attachment,
+ FPDF_BYTESTRING key,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Set the file data of |attachment|, overwriting the existing file data if any.
+// The creation date and checksum will be updated, while all other dictionary
+// entries will be deleted. Note that only contents with |len| smaller than
+// INT_MAX is supported.
+//
+// attachment - handle to an attachment.
+// contents - buffer holding the file data to write to |attachment|.
+// len - length of file data in bytes.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAttachment_SetFile(FPDF_ATTACHMENT attachment,
+ FPDF_DOCUMENT document,
+ const void* contents,
+ unsigned long len);
+
+// Experimental API.
+// Get the file data of |attachment|.
+// When the attachment file data is readable, true is returned, and |out_buflen|
+// is updated to indicate the file data size. |buffer| is only modified if
+// |buflen| is non-null and long enough to contain the entire file data. Callers
+// must check both the return value and the input |buflen| is no less than the
+// returned |out_buflen| before using the data.
+//
+// Otherwise, when the attachment file data is unreadable or when |out_buflen|
+// is null, false is returned and |buffer| and |out_buflen| remain unmodified.
+//
+// attachment - handle to an attachment.
+// buffer - buffer for holding the file data from |attachment|.
+// buflen - length of the buffer in bytes.
+// out_buflen - pointer to the variable that will receive the minimum buffer
+// size to contain the file data of |attachment|.
+//
+// Returns true on success, false otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFAttachment_GetFile(FPDF_ATTACHMENT attachment,
+ void* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_ATTACHMENT_H_
diff --git a/src/main/jni/include/fpdf_catalog.h b/src/main/jni/include/fpdf_catalog.h
new file mode 100644
index 00000000..033cca5f
--- /dev/null
+++ b/src/main/jni/include/fpdf_catalog.h
@@ -0,0 +1,42 @@
+// Copyright 2017 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_FPDF_CATALOG_H_
+#define PUBLIC_FPDF_CATALOG_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Experimental API.
+//
+// Determine if |document| represents a tagged PDF.
+//
+// For the definition of tagged PDF, See (see 10.7 "Tagged PDF" in PDF
+// Reference 1.7).
+//
+// document - handle to a document.
+//
+// Returns |true| iff |document| is a tagged PDF.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFCatalog_IsTagged(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Sets the language of |document| to |language|.
+//
+// document - handle to a document.
+// language - the language to set to.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFCatalog_SetLanguage(FPDF_DOCUMENT document, FPDF_BYTESTRING language);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_CATALOG_H_
diff --git a/src/main/jni/include/fpdf_dataavail.h b/src/main/jni/include/fpdf_dataavail.h
index 971ab250..004d9beb 100644
--- a/src/main/jni/include/fpdf_dataavail.h
+++ b/src/main/jni/include/fpdf_dataavail.h
@@ -1,222 +1,204 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FPDF_DATAAVAIL_H_
-#define _FPDF_DATAAVAIL_H_
+#ifndef PUBLIC_FPDF_DATAAVAIL_H_
+#define PUBLIC_FPDF_DATAAVAIL_H_
+
+#include
-#ifndef _FPDFVIEW_H_
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-#endif
+#define PDF_LINEARIZATION_UNKNOWN -1
+#define PDF_NOT_LINEARIZED 0
+#define PDF_LINEARIZED 1
-/** The result of the process which check linearized PDF. */
-#define FSDK_IS_LINEARIZED 1
-#define FSDK_NOT_LINEARIZED 0
-#define FSDK_UNKNOW_LINEARIZED -1
+#define PDF_DATA_ERROR -1
+#define PDF_DATA_NOTAVAIL 0
+#define PDF_DATA_AVAIL 1
+#define PDF_FORM_ERROR -1
+#define PDF_FORM_NOTAVAIL 0
+#define PDF_FORM_AVAIL 1
+#define PDF_FORM_NOTEXIST 2
#ifdef __cplusplus
extern "C" {
-#endif
+#endif // __cplusplus
-/**
- * Interface: FX_FILEAVAIL
- * Interface for checking whether the section of the file is available.
- */
+// Interface for checking whether sections of the file are available.
typedef struct _FX_FILEAVAIL {
- /**
- * Version number of the interface. Currently must be 1.
- */
- int version;
-
- /**
- * Method: IsDataAvail
- * Report whether the specified data section is available. A section is available only if all bytes in the section is available.
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * offset - The offset of the data section in the file.
- * size - The size of the data section
- * Return Value:
- * true means the specified data section is available.
- * Comments:
- * Called by Foxit SDK to check whether the data section is ready.
- */
- bool (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size);
+ // Version number of the interface. Must be 1.
+ int version;
+
+ // Reports if the specified data section is currently available. A section is
+ // available if all bytes in the section are available.
+ //
+ // Interface Version: 1
+ // Implementation Required: Yes
+ //
+ // pThis - pointer to the interface structure.
+ // offset - the offset of the data section in the file.
+ // size - the size of the data section.
+ //
+ // Returns true if the specified data section at |offset| of |size|
+ // is available.
+ FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis,
+ size_t offset,
+ size_t size);
} FX_FILEAVAIL;
-typedef void* FPDF_AVAIL;
-
-/**
-* Function: FPDFAvail_Create
-* Create a document availability provider.
-*
-* Parameters:
-* file_avail - Pointer to file availability interface to check availability of file data.
-* file - Pointer to a file access interface for reading data from file.
-* Return value:
-* A handle to the document availability provider. NULL for error.
-* Comments:
-* Application must call FPDFAvail_Destroy when done with the availability provider.
-*/
-DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FILEACCESS* file);
-
-/**
-* Function: FPDFAvail_Destroy
-* Destroy a document availibity provider.
-*
-* Parameters:
-* avail - Handle to document availability provider returned by FPDFAvail_Create
-* Return Value:
-* None.
-*/
-DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);
-
-/**
- * Interface: FX_DOWNLOADHINTS
- * Download hints interface. Used to receive hints for further downloading.
- */
+// Create a document availability provider.
+//
+// file_avail - pointer to file availability interface.
+// file - pointer to a file access interface.
+//
+// Returns a handle to the document availability provider, or NULL on error.
+//
+// FPDFAvail_Destroy() must be called when done with the availability provider.
+FPDF_EXPORT FPDF_AVAIL FPDF_CALLCONV FPDFAvail_Create(FX_FILEAVAIL* file_avail,
+ FPDF_FILEACCESS* file);
+
+// Destroy the |avail| document availability provider.
+//
+// avail - handle to document availability provider to be destroyed.
+FPDF_EXPORT void FPDF_CALLCONV FPDFAvail_Destroy(FPDF_AVAIL avail);
+
+// Download hints interface. Used to receive hints for further downloading.
typedef struct _FX_DOWNLOADHINTS {
- /**
- * Version number of the interface. Currently must be 1.
- */
- int version;
-
- /**
- * Method: AddSegment
- * Add a section to be downloaded.
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * offset - The offset of the hint reported to be downloaded.
- * size - The size of the hint reported to be downloaded.
- * Return Value:
- * None.
- * Comments:
- * Called by Foxit SDK to report some downloading hints for download manager.
- * The position and size of section may be not accurate, part of the section might be already available.
- * The download manager must deal with that to maximize download efficiency.
- */
- void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_t size);
+ // Version number of the interface. Must be 1.
+ int version;
+
+ // Add a section to be downloaded.
+ //
+ // Interface Version: 1
+ // Implementation Required: Yes
+ //
+ // pThis - pointer to the interface structure.
+ // offset - the offset of the hint reported to be downloaded.
+ // size - the size of the hint reported to be downloaded.
+ //
+ // The |offset| and |size| of the section may not be unique. Part of the
+ // section might be already available. The download manager must deal with
+ // overlapping sections.
+ void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis,
+ size_t offset,
+ size_t size);
} FX_DOWNLOADHINTS;
-/**
-* Function: FPDFAvail_IsDocAvail
-* Check whether the document is ready for loading, if not, get download hints.
-*
-* Parameters:
-* avail - Handle to document availability provider returned by FPDFAvail_Create
-* hints - Pointer to a download hints interface, receiving generated hints
-* Return value:
-* Non-zero for page is fully available, 0 for page not yet available.
-* Comments:
-* The application should call this function whenever new data arrived, and process all the
-* generated download hints if any, until the function returns non-zero value. Then the
-* application can call FPDFAvail_GetDocument() to get a document handle.
-*/
-DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
-
-/**
-* Function: FPDFAvail_GetDocument
-* Get document from the availability provider.
-*
-* Parameters:
-* avail - Handle to document availability provider returned by FPDFAvail_Create
-* password - Optional password for decrypting the PDF file.
-* Return value:
-* Handle to the document.
-* Comments:
-* After FPDFAvail_IsDocAvail() returns TRUE, the application should call this function to
-* get the document handle. To close the document, use FPDF_CloseDocument function.
-*/
-DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail,
- FPDF_BYTESTRING password);
-
-/**
-* Function: FPDFAvail_GetFirstPageNum
-* Get page number for the first available page in a linearized PDF
-*
-* Parameters:
-* doc - A document handle returned by FPDFAvail_GetDocument
-* Return Value:
-* Zero-based index for the first available page.
-* Comments:
-* For most linearized PDFs, the first available page would be just the first page, however,
-* some PDFs might make other page to be the first available page.
-* For non-linearized PDF, this function will always return zero.
-*/
-DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
-
-/**
-* Function: FPDFAvail_IsPageAvail
-* Check whether a page is ready for loading, if not, get download hints.
-*
-* Parameters:
-* avail - Handle to document availability provider returned by FPDFAvail_Create
-* page_index - Index number of the page. 0 for the first page.
-* hints - Pointer to a download hints interface, receiving generated hints
-* Return value:
-* Non-zero for page is fully available, 0 for page not yet available.
-* Comments:
-* This function call be called only after FPDFAvail_GetDocument if called.
-* The application should call this function whenever new data arrived, and process all the
-* generated download hints if any, until the function returns non-zero value. Then the
-* application can perform page loading.
-*/
-DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, int page_index, FX_DOWNLOADHINTS* hints);
-
-/**
-* Function: FPDFAvail_ISFormAvail
-* Check whether Form data is ready for init, if not, get download hints.
-*
-* Parameters:
-* avail - Handle to document availability provider returned by FPDFAvail_Create
-* hints - Pointer to a download hints interface, receiving generated hints
-* Return value:
-* Non-zero for Form data is fully available, 0 for Form data not yet available.
-* Details: -1 - error, the input parameter not correct, such as hints is null.
-* 0 - data not available
-* 1 - data available
-* 2 - no form data.
-* Comments:
-* This function call be called only after FPDFAvail_GetDocument if called.
-* The application should call this function whenever new data arrived, and process all the
-* generated download hints if any, until the function returns non-zero value. Then the
-* application can perform page loading. Recommend to call FPDFDOC_InitFormFillEnviroument
-* after the function returns non-zero value.
-*/
-DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
-
-/**
-* Function: FPDFAvail_IsLinearized
-* To check whether a document is Linearized PDF file.
-*
-* Parameters:
-* avail - Handle to document availability provider returned by FPDFAvail_Create
-* Return value:
-* return TRUE means the document is linearized PDF else not.
-* FSDK_IS_LINEARIZED is a linearize file.
-* FSDK_NOT_LINEARIZED is not a linearize file.
-* FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize file.
-* Comments:
-* It return TRUE/FALSE as soon as we have first 1K data. If the file's size less than
-* 1K,we don't known whether the PDF is a linearized file.
-*
-*/
-DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
+// Checks if the document is ready for loading, if not, gets download hints.
+//
+// avail - handle to document availability provider.
+// hints - pointer to a download hints interface.
+//
+// Returns one of:
+// PDF_DATA_ERROR: A common error is returned. Data availability unknown.
+// PDF_DATA_NOTAVAIL: Data not yet available.
+// PDF_DATA_AVAIL: Data available.
+//
+// Applications should call this function whenever new data arrives, and process
+// all the generated download hints, if any, until the function returns
+// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|.
+// if hints is nullptr, the function just check current document availability.
+//
+// Once all data is available, call FPDFAvail_GetDocument() to get a document
+// handle.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsDocAvail(FPDF_AVAIL avail,
+ FX_DOWNLOADHINTS* hints);
+
+// Get document from the availability provider.
+//
+// avail - handle to document availability provider.
+// password - password for decrypting the PDF file. Optional.
+//
+// Returns a handle to the document.
+//
+// When FPDFAvail_IsDocAvail() returns TRUE, call FPDFAvail_GetDocument() to
+// retrieve the document handle.
+// See the comments for FPDF_LoadDocument() regarding the encoding for
+// |password|.
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
+FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password);
+
+// Get the page number for the first available page in a linearized PDF.
+//
+// doc - document handle.
+//
+// Returns the zero-based index for the first available page.
+//
+// For most linearized PDFs, the first available page will be the first page,
+// however, some PDFs might make another page the first available page.
+// For non-linearized PDFs, this function will always return zero.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
+
+// Check if |page_index| is ready for loading, if not, get the
+// |FX_DOWNLOADHINTS|.
+//
+// avail - handle to document availability provider.
+// page_index - index number of the page. Zero for the first page.
+// hints - pointer to a download hints interface. Populated if
+// |page_index| is not available.
+//
+// Returns one of:
+// PDF_DATA_ERROR: A common error is returned. Data availability unknown.
+// PDF_DATA_NOTAVAIL: Data not yet available.
+// PDF_DATA_AVAIL: Data available.
+//
+// This function can be called only after FPDFAvail_GetDocument() is called.
+// Applications should call this function whenever new data arrives and process
+// all the generated download |hints|, if any, until this function returns
+// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page
+// loading.
+// if hints is nullptr, the function just check current availability of
+// specified page.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
+ int page_index,
+ FX_DOWNLOADHINTS* hints);
+
+// Check if form data is ready for initialization, if not, get the
+// |FX_DOWNLOADHINTS|.
+//
+// avail - handle to document availability provider.
+// hints - pointer to a download hints interface. Populated if form is not
+// ready for initialization.
+//
+// Returns one of:
+// PDF_FORM_ERROR: A common eror, in general incorrect parameters.
+// PDF_FORM_NOTAVAIL: Data not available.
+// PDF_FORM_AVAIL: Data available.
+// PDF_FORM_NOTEXIST: No form data.
+//
+// This function can be called only after FPDFAvail_GetDocument() is called.
+// The application should call this function whenever new data arrives and
+// process all the generated download |hints|, if any, until the function
+// |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|.
+// if hints is nullptr, the function just check current form availability.
+//
+// Applications can then perform page loading. It is recommend to call
+// FPDFDOC_InitFormFillEnvironment() when |PDF_FORM_AVAIL| is returned.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
+ FX_DOWNLOADHINTS* hints);
+
+// Check whether a document is a linearized PDF.
+//
+// avail - handle to document availability provider.
+//
+// Returns one of:
+// PDF_LINEARIZED
+// PDF_NOT_LINEARIZED
+// PDF_LINEARIZATION_UNKNOWN
+//
+// FPDFAvail_IsLinearized() will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED|
+// when we have 1k of data. If the files size less than 1k, it returns
+// |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine
+// if the PDF is linearlized.
+FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsLinearized(FPDF_AVAIL avail);
#ifdef __cplusplus
-};
-#endif
-
-#endif
+} // extern "C"
+#endif // __cplusplus
+#endif // PUBLIC_FPDF_DATAAVAIL_H_
diff --git a/src/main/jni/include/fpdf_doc.h b/src/main/jni/include/fpdf_doc.h
new file mode 100644
index 00000000..2dc22d9c
--- /dev/null
+++ b/src/main/jni/include/fpdf_doc.h
@@ -0,0 +1,438 @@
+// Copyright 2014 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_DOC_H_
+#define PUBLIC_FPDF_DOC_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Unsupported action type.
+#define PDFACTION_UNSUPPORTED 0
+// Go to a destination within current document.
+#define PDFACTION_GOTO 1
+// Go to a destination within another document.
+#define PDFACTION_REMOTEGOTO 2
+// URI, including web pages and other Internet resources.
+#define PDFACTION_URI 3
+// Launch an application or open a file.
+#define PDFACTION_LAUNCH 4
+// Go to a destination in an embedded file.
+#define PDFACTION_EMBEDDEDGOTO 5
+
+// View destination fit types. See pdfmark reference v9, page 48.
+#define PDFDEST_VIEW_UNKNOWN_MODE 0
+#define PDFDEST_VIEW_XYZ 1
+#define PDFDEST_VIEW_FIT 2
+#define PDFDEST_VIEW_FITH 3
+#define PDFDEST_VIEW_FITV 4
+#define PDFDEST_VIEW_FITR 5
+#define PDFDEST_VIEW_FITB 6
+#define PDFDEST_VIEW_FITBH 7
+#define PDFDEST_VIEW_FITBV 8
+
+// The file identifier entry type. See section 14.4 "File Identifiers" of the
+// ISO 32000-1:2008 spec.
+typedef enum {
+ FILEIDTYPE_PERMANENT = 0,
+ FILEIDTYPE_CHANGING = 1
+} FPDF_FILEIDTYPE;
+
+// Get the first child of |bookmark|, or the first top-level bookmark item.
+//
+// document - handle to the document.
+// bookmark - handle to the current bookmark. Pass NULL for the first top
+// level item.
+//
+// Returns a handle to the first child of |bookmark| or the first top-level
+// bookmark item. NULL if no child or top-level bookmark found.
+// Note that another name for the bookmarks is the document outline, as
+// described in ISO 32000-1:2008, section 12.3.3.
+FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
+FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Get the next sibling of |bookmark|.
+//
+// document - handle to the document.
+// bookmark - handle to the current bookmark.
+//
+// Returns a handle to the next sibling of |bookmark|, or NULL if this is the
+// last bookmark at this level.
+//
+// Note that the caller is responsible for handling circular bookmark
+// references, as may arise from malformed documents.
+FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
+FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Get the title of |bookmark|.
+//
+// bookmark - handle to the bookmark.
+// buffer - buffer for the title. May be NULL.
+// buflen - the length of the buffer in bytes. May be 0.
+//
+// Returns the number of bytes in the title, including the terminating NUL
+// character. The number of bytes is returned regardless of the |buffer| and
+// |buflen| parameters.
+//
+// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The
+// string is terminated by a UTF16 NUL character. If |buflen| is less than the
+// required length, or |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Get the number of chlidren of |bookmark|.
+//
+// bookmark - handle to the bookmark.
+//
+// Returns a signed integer that represents the number of sub-items the given
+// bookmark has. If the value is positive, child items shall be shown by default
+// (open state). If the value is negative, child items shall be hidden by
+// default (closed state). Please refer to PDF 32000-1:2008, Table 153.
+// Returns 0 if the bookmark has no children or is invalid.
+FPDF_EXPORT int FPDF_CALLCONV FPDFBookmark_GetCount(FPDF_BOOKMARK bookmark);
+
+// Find the bookmark with |title| in |document|.
+//
+// document - handle to the document.
+// title - the UTF-16LE encoded Unicode title for which to search.
+//
+// Returns the handle to the bookmark, or NULL if |title| can't be found.
+//
+// FPDFBookmark_Find() will always return the first bookmark found even if
+// multiple bookmarks have the same |title|.
+FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
+FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
+
+// Get the destination associated with |bookmark|.
+//
+// document - handle to the document.
+// bookmark - handle to the bookmark.
+//
+// Returns the handle to the destination data, or NULL if no destination is
+// associated with |bookmark|.
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
+FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Get the action associated with |bookmark|.
+//
+// bookmark - handle to the bookmark.
+//
+// Returns the handle to the action data, or NULL if no action is associated
+// with |bookmark|.
+// If this function returns a valid handle, it is valid as long as |bookmark| is
+// valid.
+// If this function returns NULL, FPDFBookmark_GetDest() should be called to get
+// the |bookmark| destination data.
+FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
+FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
+
+// Get the type of |action|.
+//
+// action - handle to the action.
+//
+// Returns one of:
+// PDFACTION_UNSUPPORTED
+// PDFACTION_GOTO
+// PDFACTION_REMOTEGOTO
+// PDFACTION_URI
+// PDFACTION_LAUNCH
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action);
+
+// Get the destination of |action|.
+//
+// document - handle to the document.
+// action - handle to the action. |action| must be a |PDFACTION_GOTO| or
+// |PDFACTION_REMOTEGOTO|.
+//
+// Returns a handle to the destination data, or NULL on error, typically
+// because the arguments were bad or the action was of the wrong type.
+//
+// In the case of |PDFACTION_REMOTEGOTO|, you must first call
+// FPDFAction_GetFilePath(), then load the document at that path, then pass
+// the document handle from that document as |document| to FPDFAction_GetDest().
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
+ FPDF_ACTION action);
+
+// Get the file path of |action|.
+//
+// action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or
+// |PDFACTION_REMOTEGOTO|.
+// buffer - a buffer for output the path string. May be NULL.
+// buflen - the length of the buffer, in bytes. May be 0.
+//
+// Returns the number of bytes in the file path, including the trailing NUL
+// character, or 0 on error, typically because the arguments were bad or the
+// action was of the wrong type.
+//
+// Regardless of the platform, the |buffer| is always in UTF-8 encoding.
+// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
+// will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);
+
+// Get the URI path of |action|.
+//
+// document - handle to the document.
+// action - handle to the action. Must be a |PDFACTION_URI|.
+// buffer - a buffer for the path string. May be NULL.
+// buflen - the length of the buffer, in bytes. May be 0.
+//
+// Returns the number of bytes in the URI path, including the trailing NUL
+// character, or 0 on error, typically because the arguments were bad or the
+// action was of the wrong type.
+//
+// The |buffer| may contain badly encoded data. The caller should validate the
+// output. e.g. Check to see if it is UTF-8.
+//
+// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
+// will not be modified.
+//
+// Historically, the documentation for this API claimed |buffer| is always
+// encoded in 7-bit ASCII, but did not actually enforce it.
+// https://pdfium.googlesource.com/pdfium.git/+/d609e84cee2e14a18333247485af91df48a40592
+// added that enforcement, but that did not work well for real world PDFs that
+// used UTF-8. As of this writing, this API reverted back to its original
+// behavior prior to commit d609e84cee.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFAction_GetURIPath(FPDF_DOCUMENT document,
+ FPDF_ACTION action,
+ void* buffer,
+ unsigned long buflen);
+
+// Get the page index of |dest|.
+//
+// document - handle to the document.
+// dest - handle to the destination.
+//
+// Returns the 0-based page index containing |dest|. Returns -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document,
+ FPDF_DEST dest);
+
+// Experimental API.
+// Get the view (fit type) specified by |dest|.
+//
+// dest - handle to the destination.
+// pNumParams - receives the number of view parameters, which is at most 4.
+// pParams - buffer to write the view parameters. Must be at least 4
+// FS_FLOATs long.
+// Returns one of the PDFDEST_VIEW_* constants, PDFDEST_VIEW_UNKNOWN_MODE if
+// |dest| does not specify a view.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFDest_GetView(FPDF_DEST dest, unsigned long* pNumParams, FS_FLOAT* pParams);
+
+// Get the (x, y, zoom) location of |dest| in the destination page, if the
+// destination is in [page /XYZ x y zoom] syntax.
+//
+// dest - handle to the destination.
+// hasXVal - out parameter; true if the x value is not null
+// hasYVal - out parameter; true if the y value is not null
+// hasZoomVal - out parameter; true if the zoom value is not null
+// x - out parameter; the x coordinate, in page coordinates.
+// y - out parameter; the y coordinate, in page coordinates.
+// zoom - out parameter; the zoom value.
+// Returns TRUE on successfully reading the /XYZ value.
+//
+// Note the [x, y, zoom] values are only set if the corresponding hasXVal,
+// hasYVal or hasZoomVal flags are true.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFDest_GetLocationInPage(FPDF_DEST dest,
+ FPDF_BOOL* hasXVal,
+ FPDF_BOOL* hasYVal,
+ FPDF_BOOL* hasZoomVal,
+ FS_FLOAT* x,
+ FS_FLOAT* y,
+ FS_FLOAT* zoom);
+
+// Find a link at point (|x|,|y|) on |page|.
+//
+// page - handle to the document page.
+// x - the x coordinate, in the page coordinate system.
+// y - the y coordinate, in the page coordinate system.
+//
+// Returns a handle to the link, or NULL if no link found at the given point.
+//
+// You can convert coordinates from screen coordinates to page coordinates using
+// FPDF_DeviceToPage().
+FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
+ double x,
+ double y);
+
+// Find the Z-order of link at point (|x|,|y|) on |page|.
+//
+// page - handle to the document page.
+// x - the x coordinate, in the page coordinate system.
+// y - the y coordinate, in the page coordinate system.
+//
+// Returns the Z-order of the link, or -1 if no link found at the given point.
+// Larger Z-order numbers are closer to the front.
+//
+// You can convert coordinates from screen coordinates to page coordinates using
+// FPDF_DeviceToPage().
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
+ double x,
+ double y);
+
+// Get destination info for |link|.
+//
+// document - handle to the document.
+// link - handle to the link.
+//
+// Returns a handle to the destination, or NULL if there is no destination
+// associated with the link. In this case, you should call FPDFLink_GetAction()
+// to retrieve the action associated with |link|.
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
+ FPDF_LINK link);
+
+// Get action info for |link|.
+//
+// link - handle to the link.
+//
+// Returns a handle to the action associated to |link|, or NULL if no action.
+// If this function returns a valid handle, it is valid as long as |link| is
+// valid.
+FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link);
+
+// Enumerates all the link annotations in |page|.
+//
+// page - handle to the page.
+// start_pos - the start position, should initially be 0 and is updated with
+// the next start position on return.
+// link_annot - the link handle for |startPos|.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
+ int* start_pos,
+ FPDF_LINK* link_annot);
+
+// Experimental API.
+// Gets FPDF_ANNOTATION object for |link_annot|.
+//
+// page - handle to the page in which FPDF_LINK object is present.
+// link_annot - handle to link annotation.
+//
+// Returns FPDF_ANNOTATION from the FPDF_LINK and NULL on failure,
+// if the input link annot or page is NULL.
+FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV
+FPDFLink_GetAnnot(FPDF_PAGE page, FPDF_LINK link_annot);
+
+// Get the rectangle for |link_annot|.
+//
+// link_annot - handle to the link annotation.
+// rect - the annotation rectangle.
+//
+// Returns true on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot,
+ FS_RECTF* rect);
+
+// Get the count of quadrilateral points to the |link_annot|.
+//
+// link_annot - handle to the link annotation.
+//
+// Returns the count of quadrilateral points.
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot);
+
+// Get the quadrilateral points for the specified |quad_index| in |link_annot|.
+//
+// link_annot - handle to the link annotation.
+// quad_index - the specified quad point index.
+// quad_points - receives the quadrilateral points.
+//
+// Returns true on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFLink_GetQuadPoints(FPDF_LINK link_annot,
+ int quad_index,
+ FS_QUADPOINTSF* quad_points);
+
+// Experimental API
+// Gets an additional-action from |page|.
+//
+// page - handle to the page, as returned by FPDF_LoadPage().
+// aa_type - the type of the page object's addtional-action, defined
+// in public/fpdf_formfill.h
+//
+// Returns the handle to the action data, or NULL if there is no
+// additional-action of type |aa_type|.
+// If this function returns a valid handle, it is valid as long as |page| is
+// valid.
+FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDF_GetPageAAction(FPDF_PAGE page,
+ int aa_type);
+
+// Experimental API.
+// Get the file identifer defined in the trailer of |document|.
+//
+// document - handle to the document.
+// id_type - the file identifier type to retrieve.
+// buffer - a buffer for the file identifier. May be NULL.
+// buflen - the length of the buffer, in bytes. May be 0.
+//
+// Returns the number of bytes in the file identifier, including the NUL
+// terminator.
+//
+// The |buffer| is always a byte string. The |buffer| is followed by a NUL
+// terminator. If |buflen| is less than the returned length, or |buffer| is
+// NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_GetFileIdentifier(FPDF_DOCUMENT document,
+ FPDF_FILEIDTYPE id_type,
+ void* buffer,
+ unsigned long buflen);
+
+// Get meta-data |tag| content from |document|.
+//
+// document - handle to the document.
+// tag - the tag to retrieve. The tag can be one of:
+// Title, Author, Subject, Keywords, Creator, Producer,
+// CreationDate, or ModDate.
+// For detailed explanations of these tags and their respective
+// values, please refer to PDF Reference 1.6, section 10.2.1,
+// 'Document Information Dictionary'.
+// buffer - a buffer for the tag. May be NULL.
+// buflen - the length of the buffer, in bytes. May be 0.
+//
+// Returns the number of bytes in the tag, including trailing zeros.
+//
+// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
+// bytes of zeros indicating the end of the string. If |buflen| is less than
+// the returned length, or |buffer| is NULL, |buffer| will not be modified.
+//
+// For linearized files, FPDFAvail_IsFormAvail must be called before this, and
+// it must have returned PDF_FORM_AVAIL or PDF_FORM_NOTEXIST. Before that, there
+// is no guarantee the metadata has been loaded.
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
+ FPDF_BYTESTRING tag,
+ void* buffer,
+ unsigned long buflen);
+
+// Get the page label for |page_index| from |document|.
+//
+// document - handle to the document.
+// page_index - the 0-based index of the page.
+// buffer - a buffer for the page label. May be NULL.
+// buflen - the length of the buffer, in bytes. May be 0.
+//
+// Returns the number of bytes in the page label, including trailing zeros.
+//
+// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
+// bytes of zeros indicating the end of the string. If |buflen| is less than
+// the returned length, or |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_GetPageLabel(FPDF_DOCUMENT document,
+ int page_index,
+ void* buffer,
+ unsigned long buflen);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_DOC_H_
diff --git a/src/main/jni/include/fpdf_edit.h b/src/main/jni/include/fpdf_edit.h
new file mode 100644
index 00000000..5dc11c48
--- /dev/null
+++ b/src/main/jni/include/fpdf_edit.h
@@ -0,0 +1,1624 @@
+// Copyright 2014 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_EDIT_H_
+#define PUBLIC_FPDF_EDIT_H_
+
+#include
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#define FPDF_ARGB(a, r, g, b) \
+ ((uint32_t)(((uint32_t)(b)&0xff) | (((uint32_t)(g)&0xff) << 8) | \
+ (((uint32_t)(r)&0xff) << 16) | (((uint32_t)(a)&0xff) << 24)))
+#define FPDF_GetBValue(argb) ((uint8_t)(argb))
+#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8))
+#define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16))
+#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24))
+
+// Refer to PDF Reference version 1.7 table 4.12 for all color space families.
+#define FPDF_COLORSPACE_UNKNOWN 0
+#define FPDF_COLORSPACE_DEVICEGRAY 1
+#define FPDF_COLORSPACE_DEVICERGB 2
+#define FPDF_COLORSPACE_DEVICECMYK 3
+#define FPDF_COLORSPACE_CALGRAY 4
+#define FPDF_COLORSPACE_CALRGB 5
+#define FPDF_COLORSPACE_LAB 6
+#define FPDF_COLORSPACE_ICCBASED 7
+#define FPDF_COLORSPACE_SEPARATION 8
+#define FPDF_COLORSPACE_DEVICEN 9
+#define FPDF_COLORSPACE_INDEXED 10
+#define FPDF_COLORSPACE_PATTERN 11
+
+// The page object constants.
+#define FPDF_PAGEOBJ_UNKNOWN 0
+#define FPDF_PAGEOBJ_TEXT 1
+#define FPDF_PAGEOBJ_PATH 2
+#define FPDF_PAGEOBJ_IMAGE 3
+#define FPDF_PAGEOBJ_SHADING 4
+#define FPDF_PAGEOBJ_FORM 5
+
+// The path segment constants.
+#define FPDF_SEGMENT_UNKNOWN -1
+#define FPDF_SEGMENT_LINETO 0
+#define FPDF_SEGMENT_BEZIERTO 1
+#define FPDF_SEGMENT_MOVETO 2
+
+#define FPDF_FILLMODE_NONE 0
+#define FPDF_FILLMODE_ALTERNATE 1
+#define FPDF_FILLMODE_WINDING 2
+
+#define FPDF_FONT_TYPE1 1
+#define FPDF_FONT_TRUETYPE 2
+
+#define FPDF_LINECAP_BUTT 0
+#define FPDF_LINECAP_ROUND 1
+#define FPDF_LINECAP_PROJECTING_SQUARE 2
+
+#define FPDF_LINEJOIN_MITER 0
+#define FPDF_LINEJOIN_ROUND 1
+#define FPDF_LINEJOIN_BEVEL 2
+
+// See FPDF_SetPrintMode() for descriptions.
+#define FPDF_PRINTMODE_EMF 0
+#define FPDF_PRINTMODE_TEXTONLY 1
+#define FPDF_PRINTMODE_POSTSCRIPT2 2
+#define FPDF_PRINTMODE_POSTSCRIPT3 3
+#define FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH 4
+#define FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH 5
+#define FPDF_PRINTMODE_EMF_IMAGE_MASKS 6
+#define FPDF_PRINTMODE_POSTSCRIPT3_TYPE42 7
+#define FPDF_PRINTMODE_POSTSCRIPT3_TYPE42_PASSTHROUGH 8
+
+typedef struct FPDF_IMAGEOBJ_METADATA {
+ // The image width in pixels.
+ unsigned int width;
+ // The image height in pixels.
+ unsigned int height;
+ // The image's horizontal pixel-per-inch.
+ float horizontal_dpi;
+ // The image's vertical pixel-per-inch.
+ float vertical_dpi;
+ // The number of bits used to represent each pixel.
+ unsigned int bits_per_pixel;
+ // The image's colorspace. See above for the list of FPDF_COLORSPACE_*.
+ int colorspace;
+ // The image's marked content ID. Useful for pairing with associated alt-text.
+ // A value of -1 indicates no ID.
+ int marked_content_id;
+} FPDF_IMAGEOBJ_METADATA;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Create a new PDF document.
+//
+// Returns a handle to a new document, or NULL on failure.
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument();
+
+// Create a new PDF page.
+//
+// document - handle to document.
+// page_index - suggested 0-based index of the page to create. If it is larger
+// than document's current last index(L), the created page index
+// is the next available index -- L+1.
+// width - the page width in points.
+// height - the page height in points.
+//
+// Returns the handle to the new page or NULL on failure.
+//
+// The page should be closed with FPDF_ClosePage() when finished as
+// with any other page in the document.
+FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document,
+ int page_index,
+ double width,
+ double height);
+
+// Delete the page at |page_index|.
+//
+// document - handle to document.
+// page_index - the index of the page to delete.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document,
+ int page_index);
+
+// Experimental API.
+// Move the given pages to a new index position.
+//
+// page_indices - the ordered list of pages to move. No duplicates allowed.
+// page_indices_len - the number of elements in |page_indices|
+// dest_page_index - the new index position to which the pages in
+// |page_indices| are moved.
+//
+// Returns TRUE on success. If it returns FALSE, the document may be left in an
+// indeterminate state.
+//
+// Example: The PDF document starts out with pages [A, B, C, D], with indices
+// [0, 1, 2, 3].
+//
+// > Move(doc, [3, 2], 2, 1); // returns true
+// > // The document has pages [A, D, C, B].
+// >
+// > Move(doc, [0, 4, 3], 3, 1); // returns false
+// > // Returned false because index 4 is out of range.
+// >
+// > Move(doc, [0, 3, 1], 3, 2); // returns false
+// > // Returned false because index 2 is out of range for 3 page indices.
+// >
+// > Move(doc, [2, 2], 2, 0); // returns false
+// > // Returned false because [2, 2] contains duplicates.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_MovePages(FPDF_DOCUMENT document,
+ const int* page_indices,
+ unsigned long page_indices_len,
+ int dest_page_index);
+
+// Get the rotation of |page|.
+//
+// page - handle to a page
+//
+// Returns one of the following indicating the page rotation:
+// 0 - No rotation.
+// 1 - Rotated 90 degrees clockwise.
+// 2 - Rotated 180 degrees clockwise.
+// 3 - Rotated 270 degrees clockwise.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetRotation(FPDF_PAGE page);
+
+// Set rotation for |page|.
+//
+// page - handle to a page.
+// rotate - the rotation value, one of:
+// 0 - No rotation.
+// 1 - Rotated 90 degrees clockwise.
+// 2 - Rotated 180 degrees clockwise.
+// 3 - Rotated 270 degrees clockwise.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetRotation(FPDF_PAGE page, int rotate);
+
+// Insert |page_object| into |page|.
+//
+// page - handle to a page
+// page_object - handle to a page object. The |page_object| will be
+// automatically freed.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object);
+
+// Experimental API.
+// Remove |page_object| from |page|.
+//
+// page - handle to a page
+// page_object - handle to a page object to be removed.
+//
+// Returns TRUE on success.
+//
+// Ownership is transferred to the caller. Call FPDFPageObj_Destroy() to free
+// it.
+// Note that when removing a |page_object| of type FPDF_PAGEOBJ_TEXT, all
+// FPDF_TEXTPAGE handles for |page| are no longer valid.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPage_RemoveObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object);
+
+// Get number of page objects inside |page|.
+//
+// page - handle to a page.
+//
+// Returns the number of objects in |page|.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page);
+
+// Get object in |page| at |index|.
+//
+// page - handle to a page.
+// index - the index of a page object.
+//
+// Returns the handle to the page object, or NULL on failed.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page,
+ int index);
+
+// Checks if |page| contains transparency.
+//
+// page - handle to a page.
+//
+// Returns TRUE if |page| contains transparency.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_HasTransparency(FPDF_PAGE page);
+
+// Generate the content of |page|.
+//
+// page - handle to a page.
+//
+// Returns TRUE on success.
+//
+// Before you save the page to a file, or reload the page, you must call
+// |FPDFPage_GenerateContent| or any changes to |page| will be lost.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page);
+
+// Destroy |page_object| by releasing its resources. |page_object| must have
+// been created by FPDFPageObj_CreateNew{Path|Rect}() or
+// FPDFPageObj_New{Text|Image}Obj(). This function must be called on
+// newly-created objects if they are not added to a page through
+// FPDFPage_InsertObject() or to an annotation through FPDFAnnot_AppendObject().
+//
+// page_object - handle to a page object.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_Destroy(FPDF_PAGEOBJECT page_object);
+
+// Checks if |page_object| contains transparency.
+//
+// page_object - handle to a page object.
+//
+// Returns TRUE if |page_object| contains transparency.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object);
+
+// Get type of |page_object|.
+//
+// page_object - handle to a page object.
+//
+// Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on
+// error.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object);
+
+// Experimental API.
+// Gets active state for |page_object| within page.
+//
+// page_object - handle to a page object.
+// active - pointer to variable that will receive if the page object is
+// active. This is a required parameter. Not filled if FALSE
+// is returned.
+//
+// For page objects where |active| is filled with FALSE, the |page_object| is
+// treated as if it wasn't in the document even though it is still held
+// internally.
+//
+// Returns TRUE if the operation succeeded, FALSE if it failed.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetIsActive(FPDF_PAGEOBJECT page_object, FPDF_BOOL* active);
+
+// Experimental API.
+// Sets if |page_object| is active within page.
+//
+// page_object - handle to a page object.
+// active - a boolean specifying if the object is active.
+//
+// Returns TRUE on success.
+//
+// Page objects all start in the active state by default, and remain in that
+// state unless this function is called.
+//
+// When |active| is false, this makes the |page_object| be treated as if it
+// wasn't in the document even though it is still held internally.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetIsActive(FPDF_PAGEOBJECT page_object, FPDF_BOOL active);
+
+// Transform |page_object| by the given matrix.
+//
+// page_object - handle to a page object.
+// a - matrix value.
+// b - matrix value.
+// c - matrix value.
+// d - matrix value.
+// e - matrix value.
+// f - matrix value.
+//
+// The matrix is composed as:
+// |a c e|
+// |b d f|
+// and can be used to scale, rotate, shear and translate the |page_object|.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
+ double a,
+ double b,
+ double c,
+ double d,
+ double e,
+ double f);
+
+// Experimental API.
+// Transform |page_object| by the given matrix.
+//
+// page_object - handle to a page object.
+// matrix - the transform matrix.
+//
+// Returns TRUE on success.
+//
+// This can be used to scale, rotate, shear and translate the |page_object|.
+// It is an improved version of FPDFPageObj_Transform() that does not do
+// unnecessary double to float conversions, and only uses 1 parameter for the
+// matrix. It also returns whether the operation succeeded or not.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_TransformF(FPDF_PAGEOBJECT page_object, const FS_MATRIX* matrix);
+
+// Experimental API.
+// Get the transform matrix of a page object.
+//
+// page_object - handle to a page object.
+// matrix - pointer to struct to receive the matrix value.
+//
+// The matrix is composed as:
+// |a c e|
+// |b d f|
+// and used to scale, rotate, shear and translate the page object.
+//
+// For page objects outside form objects, the matrix values are relative to the
+// page that contains it.
+// For page objects inside form objects, the matrix values are relative to the
+// form that contains it.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetMatrix(FPDF_PAGEOBJECT page_object, FS_MATRIX* matrix);
+
+// Experimental API.
+// Set the transform matrix of a page object.
+//
+// page_object - handle to a page object.
+// matrix - pointer to struct with the matrix value.
+//
+// The matrix is composed as:
+// |a c e|
+// |b d f|
+// and can be used to scale, rotate, shear and translate the page object.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetMatrix(FPDF_PAGEOBJECT page_object, const FS_MATRIX* matrix);
+
+// Transform all annotations in |page|.
+//
+// page - handle to a page.
+// a - matrix value.
+// b - matrix value.
+// c - matrix value.
+// d - matrix value.
+// e - matrix value.
+// f - matrix value.
+//
+// The matrix is composed as:
+// |a c e|
+// |b d f|
+// and can be used to scale, rotate, shear and translate the |page| annotations.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_TransformAnnots(FPDF_PAGE page,
+ double a,
+ double b,
+ double c,
+ double d,
+ double e,
+ double f);
+
+// Create a new image object.
+//
+// document - handle to a document.
+//
+// Returns a handle to a new image object.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDFPageObj_NewImageObj(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Get the marked content ID for the object.
+//
+// page_object - handle to a page object.
+//
+// Returns the page object's marked content ID, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPageObj_GetMarkedContentID(FPDF_PAGEOBJECT page_object);
+
+// Experimental API.
+// Get number of content marks in |page_object|.
+//
+// page_object - handle to a page object.
+//
+// Returns the number of content marks in |page_object|, or -1 in case of
+// failure.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object);
+
+// Experimental API.
+// Get content mark in |page_object| at |index|.
+//
+// page_object - handle to a page object.
+// index - the index of a page object.
+//
+// Returns the handle to the content mark, or NULL on failure. The handle is
+// still owned by the library, and it should not be freed directly. It becomes
+// invalid if the page object is destroyed, either directly or indirectly by
+// unloading the page.
+FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
+FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index);
+
+// Experimental API.
+// Add a new content mark to a |page_object|.
+//
+// page_object - handle to a page object.
+// name - the name (tag) of the mark.
+//
+// Returns the handle to the content mark, or NULL on failure. The handle is
+// still owned by the library, and it should not be freed directly. It becomes
+// invalid if the page object is destroyed, either directly or indirectly by
+// unloading the page.
+FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
+FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name);
+
+// Experimental API.
+// Removes a content |mark| from a |page_object|.
+// The mark handle will be invalid after the removal.
+//
+// page_object - handle to a page object.
+// mark - handle to a content mark in that object to remove.
+//
+// Returns TRUE if the operation succeeded, FALSE if it failed.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_RemoveMark(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark);
+
+// Experimental API.
+// Get the name of a content mark.
+//
+// mark - handle to a content mark.
+// buffer - buffer for holding the returned name in UTF-16LE. This is only
+// modified if |buflen| is large enough to store the name.
+// Optional, pass null to just retrieve the size of the buffer
+// needed.
+// buflen - length of the buffer in bytes.
+// out_buflen - pointer to variable that will receive the minimum buffer size
+// in bytes to contain the name. This is a required parameter.
+// Not filled if FALSE is returned.
+//
+// Returns TRUE if the operation succeeded, FALSE if it failed.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+// Experimental API.
+// Get the number of key/value pair parameters in |mark|.
+//
+// mark - handle to a content mark.
+//
+// Returns the number of key/value pair parameters |mark|, or -1 in case of
+// failure.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark);
+
+// Experimental API.
+// Get the key of a property in a content mark.
+//
+// mark - handle to a content mark.
+// index - index of the property.
+// buffer - buffer for holding the returned key in UTF-16LE. This is only
+// modified if |buflen| is large enough to store the key.
+// Optional, pass null to just retrieve the size of the buffer
+// needed.
+// buflen - length of the buffer in bytes.
+// out_buflen - pointer to variable that will receive the minimum buffer size
+// in bytes to contain the name. This is a required parameter.
+// Not filled if FALSE is returned.
+//
+// Returns TRUE if the operation was successful, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark,
+ unsigned long index,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+// Experimental API.
+// Get the type of the value of a property in a content mark by key.
+//
+// mark - handle to a content mark.
+// key - string key of the property.
+//
+// Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of failure.
+FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV
+FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key);
+
+// Experimental API.
+// Get the value of a number property in a content mark by key as int.
+// FPDFPageObjMark_GetParamValueType() should have returned FPDF_OBJECT_NUMBER
+// for this property.
+//
+// mark - handle to a content mark.
+// key - string key of the property.
+// out_value - pointer to variable that will receive the value. Not filled if
+// false is returned.
+//
+// Returns TRUE if the key maps to a number value, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ int* out_value);
+
+// Experimental API.
+// Get the value of a string property in a content mark by key.
+//
+// mark - handle to a content mark.
+// key - string key of the property.
+// buffer - buffer for holding the returned value in UTF-16LE. This is
+// only modified if |buflen| is large enough to store the value.
+// Optional, pass null to just retrieve the size of the buffer
+// needed.
+// buflen - length of the buffer in bytes.
+// out_buflen - pointer to variable that will receive the minimum buffer size
+// in bytes to contain the name. This is a required parameter.
+// Not filled if FALSE is returned.
+//
+// Returns TRUE if the key maps to a string/blob value, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+// Experimental API.
+// Get the value of a blob property in a content mark by key.
+//
+// mark - handle to a content mark.
+// key - string key of the property.
+// buffer - buffer for holding the returned value. This is only modified
+// if |buflen| is large enough to store the value.
+// Optional, pass null to just retrieve the size of the buffer
+// needed.
+// buflen - length of the buffer in bytes.
+// out_buflen - pointer to variable that will receive the minimum buffer size
+// in bytes to contain the name. This is a required parameter.
+// Not filled if FALSE is returned.
+//
+// Returns TRUE if the key maps to a string/blob value, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ unsigned char* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+// Experimental API.
+// Set the value of an int property in a content mark by key. If a parameter
+// with key |key| exists, its value is set to |value|. Otherwise, it is added as
+// a new parameter.
+//
+// document - handle to the document.
+// page_object - handle to the page object with the mark.
+// mark - handle to a content mark.
+// key - string key of the property.
+// value - int value to set.
+//
+// Returns TRUE if the operation succeeded, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document,
+ FPDF_PAGEOBJECT page_object,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ int value);
+
+// Experimental API.
+// Set the value of a string property in a content mark by key. If a parameter
+// with key |key| exists, its value is set to |value|. Otherwise, it is added as
+// a new parameter.
+//
+// document - handle to the document.
+// page_object - handle to the page object with the mark.
+// mark - handle to a content mark.
+// key - string key of the property.
+// value - string value to set.
+//
+// Returns TRUE if the operation succeeded, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document,
+ FPDF_PAGEOBJECT page_object,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ FPDF_BYTESTRING value);
+
+// Experimental API.
+// Set the value of a blob property in a content mark by key. If a parameter
+// with key |key| exists, its value is set to |value|. Otherwise, it is added as
+// a new parameter.
+//
+// document - handle to the document.
+// page_object - handle to the page object with the mark.
+// mark - handle to a content mark.
+// key - string key of the property.
+// value - pointer to blob value to set.
+// value_len - size in bytes of |value|.
+//
+// Returns TRUE if the operation succeeded, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document,
+ FPDF_PAGEOBJECT page_object,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key,
+ const unsigned char* value,
+ unsigned long value_len);
+
+// Experimental API.
+// Removes a property from a content mark by key.
+//
+// page_object - handle to the page object with the mark.
+// mark - handle to a content mark.
+// key - string key of the property.
+//
+// Returns TRUE if the operation succeeded, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObjMark_RemoveParam(FPDF_PAGEOBJECT page_object,
+ FPDF_PAGEOBJECTMARK mark,
+ FPDF_BYTESTRING key);
+
+// Load an image from a JPEG image file and then set it into |image_object|.
+//
+// pages - pointer to the start of all loaded pages, may be NULL.
+// count - number of |pages|, may be 0.
+// image_object - handle to an image object.
+// file_access - file access handler which specifies the JPEG image file.
+//
+// Returns TRUE on success.
+//
+// The image object might already have an associated image, which is shared and
+// cached by the loaded pages. In that case, we need to clear the cached image
+// for all the loaded pages. Pass |pages| and page count (|count|) to this API
+// to clear the image cache. If the image is not previously shared, or NULL is a
+// valid |pages| value.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
+ int count,
+ FPDF_PAGEOBJECT image_object,
+ FPDF_FILEACCESS* file_access);
+
+// Load an image from a JPEG image file and then set it into |image_object|.
+//
+// pages - pointer to the start of all loaded pages, may be NULL.
+// count - number of |pages|, may be 0.
+// image_object - handle to an image object.
+// file_access - file access handler which specifies the JPEG image file.
+//
+// Returns TRUE on success.
+//
+// The image object might already have an associated image, which is shared and
+// cached by the loaded pages. In that case, we need to clear the cached image
+// for all the loaded pages. Pass |pages| and page count (|count|) to this API
+// to clear the image cache. If the image is not previously shared, or NULL is a
+// valid |pages| value. This function loads the JPEG image inline, so the image
+// content is copied to the file. This allows |file_access| and its associated
+// data to be deleted after this function returns.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages,
+ int count,
+ FPDF_PAGEOBJECT image_object,
+ FPDF_FILEACCESS* file_access);
+
+// TODO(thestig): Start deprecating this once FPDFPageObj_SetMatrix() is stable.
+//
+// Set the transform matrix of |image_object|.
+//
+// image_object - handle to an image object.
+// a - matrix value.
+// b - matrix value.
+// c - matrix value.
+// d - matrix value.
+// e - matrix value.
+// f - matrix value.
+//
+// The matrix is composed as:
+// |a c e|
+// |b d f|
+// and can be used to scale, rotate, shear and translate the |image_object|.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
+ double a,
+ double b,
+ double c,
+ double d,
+ double e,
+ double f);
+
+// Set |bitmap| to |image_object|.
+//
+// pages - pointer to the start of all loaded pages, may be NULL.
+// count - number of |pages|, may be 0.
+// image_object - handle to an image object.
+// bitmap - handle of the bitmap.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
+ int count,
+ FPDF_PAGEOBJECT image_object,
+ FPDF_BITMAP bitmap);
+
+// Get a bitmap rasterization of |image_object|. FPDFImageObj_GetBitmap() only
+// operates on |image_object| and does not take the associated image mask into
+// account. It also ignores the matrix for |image_object|.
+// The returned bitmap will be owned by the caller, and FPDFBitmap_Destroy()
+// must be called on the returned bitmap when it is no longer needed.
+//
+// image_object - handle to an image object.
+//
+// Returns the bitmap.
+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
+FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object);
+
+// Experimental API.
+// Get a bitmap rasterization of |image_object| that takes the image mask and
+// image matrix into account. To render correctly, the caller must provide the
+// |document| associated with |image_object|. If there is a |page| associated
+// with |image_object|, the caller should provide that as well.
+// The returned bitmap will be owned by the caller, and FPDFBitmap_Destroy()
+// must be called on the returned bitmap when it is no longer needed.
+//
+// document - handle to a document associated with |image_object|.
+// page - handle to an optional page associated with |image_object|.
+// image_object - handle to an image object.
+//
+// Returns the bitmap or NULL on failure.
+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
+FPDFImageObj_GetRenderedBitmap(FPDF_DOCUMENT document,
+ FPDF_PAGE page,
+ FPDF_PAGEOBJECT image_object);
+
+// Get the decoded image data of |image_object|. The decoded data is the
+// uncompressed image data, i.e. the raw image data after having all filters
+// applied. |buffer| is only modified if |buflen| is longer than the length of
+// the decoded image data.
+//
+// image_object - handle to an image object.
+// buffer - buffer for holding the decoded image data.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the decoded image data.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
+ void* buffer,
+ unsigned long buflen);
+
+// Get the raw image data of |image_object|. The raw data is the image data as
+// stored in the PDF without applying any filters. |buffer| is only modified if
+// |buflen| is longer than the length of the raw image data.
+//
+// image_object - handle to an image object.
+// buffer - buffer for holding the raw image data.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the raw image data.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFImageObj_GetImageDataRaw(FPDF_PAGEOBJECT image_object,
+ void* buffer,
+ unsigned long buflen);
+
+// Get the number of filters (i.e. decoders) of the image in |image_object|.
+//
+// image_object - handle to an image object.
+//
+// Returns the number of |image_object|'s filters.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFImageObj_GetImageFilterCount(FPDF_PAGEOBJECT image_object);
+
+// Get the filter at |index| of |image_object|'s list of filters. Note that the
+// filters need to be applied in order, i.e. the first filter should be applied
+// first, then the second, etc. |buffer| is only modified if |buflen| is longer
+// than the length of the filter string.
+//
+// image_object - handle to an image object.
+// index - the index of the filter requested.
+// buffer - buffer for holding filter string, encoded in UTF-8.
+// buflen - length of the buffer.
+//
+// Returns the length of the filter string.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFImageObj_GetImageFilter(FPDF_PAGEOBJECT image_object,
+ int index,
+ void* buffer,
+ unsigned long buflen);
+
+// Get the image metadata of |image_object|, including dimension, DPI, bits per
+// pixel, and colorspace. If the |image_object| is not an image object or if it
+// does not have an image, then the return value will be false. Otherwise,
+// failure to retrieve any specific parameter would result in its value being 0.
+//
+// image_object - handle to an image object.
+// page - handle to the page that |image_object| is on. Required for
+// retrieving the image's bits per pixel and colorspace.
+// metadata - receives the image metadata; must not be NULL.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object,
+ FPDF_PAGE page,
+ FPDF_IMAGEOBJ_METADATA* metadata);
+
+// Experimental API.
+// Get the image size in pixels. Faster method to get only image size.
+//
+// image_object - handle to an image object.
+// width - receives the image width in pixels; must not be NULL.
+// height - receives the image height in pixels; must not be NULL.
+//
+// Returns true if successful.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_GetImagePixelSize(FPDF_PAGEOBJECT image_object,
+ unsigned int* width,
+ unsigned int* height);
+
+// Experimental API.
+// Get ICC profile decoded data of |image_object|. If the |image_object| is not
+// an image object or if it does not have an image, then the return value will
+// be false. It also returns false if the |image_object| has no ICC profile.
+// |buffer| is only modified if ICC profile exists and |buflen| is longer than
+// the length of the ICC profile decoded data.
+//
+// image_object - handle to an image object; must not be NULL.
+// page - handle to the page containing |image_object|; must not be
+// NULL. Required for retrieving the image's colorspace.
+// buffer - Buffer to receive ICC profile data; may be NULL if querying
+// required size via |out_buflen|.
+// buflen - Length of the buffer in bytes. Ignored if |buffer| is NULL.
+// out_buflen - Pointer to receive the ICC profile data size in bytes; must
+// not be NULL. Will be set if this API returns true.
+//
+// Returns true if |out_buflen| is not null and an ICC profile exists for the
+// given |image_object|.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFImageObj_GetIccProfileDataDecoded(FPDF_PAGEOBJECT image_object,
+ FPDF_PAGE page,
+ uint8_t* buffer,
+ size_t buflen,
+ size_t* out_buflen);
+
+// Create a new path object at an initial position.
+//
+// x - initial horizontal position.
+// y - initial vertical position.
+//
+// Returns a handle to a new path object.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewPath(float x,
+ float y);
+
+// Create a closed path consisting of a rectangle.
+//
+// x - horizontal position for the left boundary of the rectangle.
+// y - vertical position for the bottom boundary of the rectangle.
+// w - width of the rectangle.
+// h - height of the rectangle.
+//
+// Returns a handle to the new path object.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x,
+ float y,
+ float w,
+ float h);
+
+// Get the bounding box of |page_object|.
+//
+// page_object - handle to a page object.
+// left - pointer where the left coordinate will be stored
+// bottom - pointer where the bottom coordinate will be stored
+// right - pointer where the right coordinate will be stored
+// top - pointer where the top coordinate will be stored
+//
+// On success, returns TRUE and fills in the 4 coordinates.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
+// Experimental API.
+// Get the quad points that bounds |page_object|.
+//
+// page_object - handle to a page object.
+// quad_points - pointer where the quadrilateral points will be stored.
+//
+// On success, returns TRUE and fills in |quad_points|.
+//
+// Similar to FPDFPageObj_GetBounds(), this returns the bounds of a page
+// object. When the object is rotated by a non-multiple of 90 degrees, this API
+// returns a tighter bound that cannot be represented with just the 4 sides of
+// a rectangle.
+//
+// Currently only works the following |page_object| types: FPDF_PAGEOBJ_TEXT and
+// FPDF_PAGEOBJ_IMAGE.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetRotatedBounds(FPDF_PAGEOBJECT page_object,
+ FS_QUADPOINTSF* quad_points);
+
+// Set the blend mode of |page_object|.
+//
+// page_object - handle to a page object.
+// blend_mode - string containing the blend mode.
+//
+// Blend mode can be one of following: Color, ColorBurn, ColorDodge, Darken,
+// Difference, Exclusion, HardLight, Hue, Lighten, Luminosity, Multiply, Normal,
+// Overlay, Saturation, Screen, SoftLight
+FPDF_EXPORT void FPDF_CALLCONV
+FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
+ FPDF_BYTESTRING blend_mode);
+
+// Set the stroke RGBA of a page object. Range of values: 0 - 255.
+//
+// page_object - the handle to the page object.
+// R - the red component for the object's stroke color.
+// G - the green component for the object's stroke color.
+// B - the blue component for the object's stroke color.
+// A - the stroke alpha for the object.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetStrokeColor(FPDF_PAGEOBJECT page_object,
+ unsigned int R,
+ unsigned int G,
+ unsigned int B,
+ unsigned int A);
+
+// Get the stroke RGBA of a page object. Range of values: 0 - 255.
+//
+// page_object - the handle to the page object.
+// R - the red component of the path stroke color.
+// G - the green component of the object's stroke color.
+// B - the blue component of the object's stroke color.
+// A - the stroke alpha of the object.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A);
+
+// Set the stroke width of a page object.
+//
+// path - the handle to the page object.
+// width - the width of the stroke.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width);
+
+// Get the stroke width of a page object.
+//
+// path - the handle to the page object.
+// width - the width of the stroke.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width);
+
+// Get the line join of |page_object|.
+//
+// page_object - handle to a page object.
+//
+// Returns the line join, or -1 on failure.
+// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND,
+// FPDF_LINEJOIN_BEVEL
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPageObj_GetLineJoin(FPDF_PAGEOBJECT page_object);
+
+// Set the line join of |page_object|.
+//
+// page_object - handle to a page object.
+// line_join - line join
+//
+// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND,
+// FPDF_LINEJOIN_BEVEL
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join);
+
+// Get the line cap of |page_object|.
+//
+// page_object - handle to a page object.
+//
+// Returns the line cap, or -1 on failure.
+// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND,
+// FPDF_LINECAP_PROJECTING_SQUARE
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPageObj_GetLineCap(FPDF_PAGEOBJECT page_object);
+
+// Set the line cap of |page_object|.
+//
+// page_object - handle to a page object.
+// line_cap - line cap
+//
+// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND,
+// FPDF_LINECAP_PROJECTING_SQUARE
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap);
+
+// Set the fill RGBA of a page object. Range of values: 0 - 255.
+//
+// page_object - the handle to the page object.
+// R - the red component for the object's fill color.
+// G - the green component for the object's fill color.
+// B - the blue component for the object's fill color.
+// A - the fill alpha for the object.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object,
+ unsigned int R,
+ unsigned int G,
+ unsigned int B,
+ unsigned int A);
+
+// Get the fill RGBA of a page object. Range of values: 0 - 255.
+//
+// page_object - the handle to the page object.
+// R - the red component of the object's fill color.
+// G - the green component of the object's fill color.
+// B - the blue component of the object's fill color.
+// A - the fill alpha of the object.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetFillColor(FPDF_PAGEOBJECT page_object,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A);
+
+// Experimental API.
+// Get the line dash |phase| of |page_object|.
+//
+// page_object - handle to a page object.
+// phase - pointer where the dashing phase will be stored.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetDashPhase(FPDF_PAGEOBJECT page_object, float* phase);
+
+// Experimental API.
+// Set the line dash phase of |page_object|.
+//
+// page_object - handle to a page object.
+// phase - line dash phase.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetDashPhase(FPDF_PAGEOBJECT page_object, float phase);
+
+// Experimental API.
+// Get the line dash array of |page_object|.
+//
+// page_object - handle to a page object.
+//
+// Returns the line dash array size or -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPageObj_GetDashCount(FPDF_PAGEOBJECT page_object);
+
+// Experimental API.
+// Get the line dash array of |page_object|.
+//
+// page_object - handle to a page object.
+// dash_array - pointer where the dashing array will be stored.
+// dash_count - number of elements in |dash_array|.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetDashArray(FPDF_PAGEOBJECT page_object,
+ float* dash_array,
+ size_t dash_count);
+
+// Experimental API.
+// Set the line dash array of |page_object|.
+//
+// page_object - handle to a page object.
+// dash_array - the dash array.
+// dash_count - number of elements in |dash_array|.
+// phase - the line dash phase.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_SetDashArray(FPDF_PAGEOBJECT page_object,
+ const float* dash_array,
+ size_t dash_count,
+ float phase);
+
+// Get number of segments inside |path|.
+//
+// path - handle to a path.
+//
+// A segment is a command, created by e.g. FPDFPath_MoveTo(),
+// FPDFPath_LineTo() or FPDFPath_BezierTo().
+//
+// Returns the number of objects in |path| or -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPath_CountSegments(FPDF_PAGEOBJECT path);
+
+// Get segment in |path| at |index|.
+//
+// path - handle to a path.
+// index - the index of a segment.
+//
+// Returns the handle to the segment, or NULL on faiure.
+FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
+FPDFPath_GetPathSegment(FPDF_PAGEOBJECT path, int index);
+
+// Get coordinates of |segment|.
+//
+// segment - handle to a segment.
+// x - the horizontal position of the segment.
+// y - the vertical position of the segment.
+//
+// Returns TRUE on success, otherwise |x| and |y| is not set.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y);
+
+// Get type of |segment|.
+//
+// segment - handle to a segment.
+//
+// Returns one of the FPDF_SEGMENT_* values on success,
+// FPDF_SEGMENT_UNKNOWN on error.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPathSegment_GetType(FPDF_PATHSEGMENT segment);
+
+// Gets if the |segment| closes the current subpath of a given path.
+//
+// segment - handle to a segment.
+//
+// Returns close flag for non-NULL segment, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPathSegment_GetClose(FPDF_PATHSEGMENT segment);
+
+// Move a path's current point.
+//
+// path - the handle to the path object.
+// x - the horizontal position of the new current point.
+// y - the vertical position of the new current point.
+//
+// Note that no line will be created between the previous current point and the
+// new one.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_MoveTo(FPDF_PAGEOBJECT path,
+ float x,
+ float y);
+
+// Add a line between the current point and a new point in the path.
+//
+// path - the handle to the path object.
+// x - the horizontal position of the new point.
+// y - the vertical position of the new point.
+//
+// The path's current point is changed to (x, y).
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_LineTo(FPDF_PAGEOBJECT path,
+ float x,
+ float y);
+
+// Add a cubic Bezier curve to the given path, starting at the current point.
+//
+// path - the handle to the path object.
+// x1 - the horizontal position of the first Bezier control point.
+// y1 - the vertical position of the first Bezier control point.
+// x2 - the horizontal position of the second Bezier control point.
+// y2 - the vertical position of the second Bezier control point.
+// x3 - the horizontal position of the ending point of the Bezier curve.
+// y3 - the vertical position of the ending point of the Bezier curve.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_BezierTo(FPDF_PAGEOBJECT path,
+ float x1,
+ float y1,
+ float x2,
+ float y2,
+ float x3,
+ float y3);
+
+// Close the current subpath of a given path.
+//
+// path - the handle to the path object.
+//
+// This will add a line between the current point and the initial point of the
+// subpath, thus terminating the current subpath.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_Close(FPDF_PAGEOBJECT path);
+
+// Set the drawing mode of a path.
+//
+// path - the handle to the path object.
+// fillmode - the filling mode to be set: one of the FPDF_FILLMODE_* flags.
+// stroke - a boolean specifying if the path should be stroked or not.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path,
+ int fillmode,
+ FPDF_BOOL stroke);
+
+// Get the drawing mode of a path.
+//
+// path - the handle to the path object.
+// fillmode - the filling mode of the path: one of the FPDF_FILLMODE_* flags.
+// stroke - a boolean specifying if the path is stroked or not.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path,
+ int* fillmode,
+ FPDF_BOOL* stroke);
+
+// Create a new text object using one of the standard PDF fonts.
+//
+// document - handle to the document.
+// font - string containing the font name, without spaces.
+// font_size - the font size for the new text object.
+//
+// Returns a handle to a new text object, or NULL on failure
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
+ FPDF_BYTESTRING font,
+ float font_size);
+
+// Set the text for a text object. If it had text, it will be replaced.
+//
+// text_object - handle to the text object.
+// text - the UTF-16LE encoded string containing the text to be added.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text);
+
+// Experimental API.
+// Set the text using charcodes for a text object. If it had text, it will be
+// replaced.
+//
+// text_object - handle to the text object.
+// charcodes - pointer to an array of charcodes to be added.
+// count - number of elements in |charcodes|.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_SetCharcodes(FPDF_PAGEOBJECT text_object,
+ const uint32_t* charcodes,
+ size_t count);
+
+// Returns a font object loaded from a stream of data. The font is loaded
+// into the document. Various font data structures, such as the ToUnicode data,
+// are auto-generated based on the inputs.
+//
+// document - handle to the document.
+// data - the stream of font data, which will be copied by the font object.
+// size - the size of the font data, in bytes.
+// font_type - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font type.
+// cid - a boolean specifying if the font is a CID font or not.
+//
+// The loaded font can be closed using FPDFFont_Close().
+//
+// Returns NULL on failure
+FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadFont(FPDF_DOCUMENT document,
+ const uint8_t* data,
+ uint32_t size,
+ int font_type,
+ FPDF_BOOL cid);
+
+// Experimental API.
+// Loads one of the standard 14 fonts per PDF spec 1.7 page 416. The preferred
+// way of using font style is using a dash to separate the name from the style,
+// for example 'Helvetica-BoldItalic'.
+//
+// document - handle to the document.
+// font - string containing the font name, without spaces.
+//
+// The loaded font can be closed using FPDFFont_Close().
+//
+// Returns NULL on failure.
+FPDF_EXPORT FPDF_FONT FPDF_CALLCONV
+FPDFText_LoadStandardFont(FPDF_DOCUMENT document, FPDF_BYTESTRING font);
+
+// Experimental API.
+// Returns a font object loaded from a stream of data for a type 2 CID font. The
+// font is loaded into the document. Unlike FPDFText_LoadFont(), the ToUnicode
+// data and the CIDToGIDMap data are caller provided, instead of auto-generated.
+//
+// document - handle to the document.
+// font_data - the stream of font data, which will be copied by
+// the font object.
+// font_data_size - the size of the font data, in bytes.
+// to_unicode_cmap - the ToUnicode data.
+// cid_to_gid_map_data - the stream of CIDToGIDMap data.
+// cid_to_gid_map_data_size - the size of the CIDToGIDMap data, in bytes.
+//
+// The loaded font can be closed using FPDFFont_Close().
+//
+// Returns NULL on failure.
+FPDF_EXPORT FPDF_FONT FPDF_CALLCONV
+FPDFText_LoadCidType2Font(FPDF_DOCUMENT document,
+ const uint8_t* font_data,
+ uint32_t font_data_size,
+ FPDF_BYTESTRING to_unicode_cmap,
+ const uint8_t* cid_to_gid_map_data,
+ uint32_t cid_to_gid_map_data_size);
+
+// Get the font size of a text object.
+//
+// text - handle to a text.
+// size - pointer to the font size of the text object, measured in points
+// (about 1/72 inch)
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text, float* size);
+
+// Close a loaded PDF font.
+//
+// font - Handle to the loaded font.
+FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font);
+
+// Create a new text object using a loaded font.
+//
+// document - handle to the document.
+// font - handle to the font object.
+// font_size - the font size for the new text object.
+//
+// Returns a handle to a new text object, or NULL on failure
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ FPDF_FONT font,
+ float font_size);
+
+// Get the text rendering mode of a text object.
+//
+// text - the handle to the text object.
+//
+// Returns one of the known FPDF_TEXT_RENDERMODE enum values on success,
+// FPDF_TEXTRENDERMODE_UNKNOWN on error.
+FPDF_EXPORT FPDF_TEXT_RENDERMODE FPDF_CALLCONV
+FPDFTextObj_GetTextRenderMode(FPDF_PAGEOBJECT text);
+
+// Experimental API.
+// Set the text rendering mode of a text object.
+//
+// text - the handle to the text object.
+// render_mode - the FPDF_TEXT_RENDERMODE enum value to be set (cannot set to
+// FPDF_TEXTRENDERMODE_UNKNOWN).
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFTextObj_SetTextRenderMode(FPDF_PAGEOBJECT text,
+ FPDF_TEXT_RENDERMODE render_mode);
+
+// Get the text of a text object.
+//
+// text_object - the handle to the text object.
+// text_page - the handle to the text page.
+// buffer - the address of a buffer that receives the text.
+// length - the size, in bytes, of |buffer|.
+//
+// Returns the number of bytes in the text (including the trailing NUL
+// character) on success, 0 on error.
+//
+// Regardless of the platform, the |buffer| is always in UTF-16LE encoding.
+// If |length| is less than the returned length, or |buffer| is NULL, |buffer|
+// will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
+ FPDF_TEXTPAGE text_page,
+ FPDF_WCHAR* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Get a bitmap rasterization of |text_object|. To render correctly, the caller
+// must provide the |document| associated with |text_object|. If there is a
+// |page| associated with |text_object|, the caller should provide that as well.
+// The returned bitmap will be owned by the caller, and FPDFBitmap_Destroy()
+// must be called on the returned bitmap when it is no longer needed.
+//
+// document - handle to a document associated with |text_object|.
+// page - handle to an optional page associated with |text_object|.
+// text_object - handle to a text object.
+// scale - the scaling factor, which must be greater than 0.
+//
+// Returns the bitmap or NULL on failure.
+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
+FPDFTextObj_GetRenderedBitmap(FPDF_DOCUMENT document,
+ FPDF_PAGE page,
+ FPDF_PAGEOBJECT text_object,
+ float scale);
+
+// Experimental API.
+// Get the font of a text object.
+//
+// text - the handle to the text object.
+//
+// Returns a handle to the font object held by |text| which retains ownership.
+FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFTextObj_GetFont(FPDF_PAGEOBJECT text);
+
+// Experimental API.
+// Get the base name of a font.
+//
+// font - the handle to the font object.
+// buffer - the address of a buffer that receives the base font name.
+// length - the size, in bytes, of |buffer|.
+//
+// Returns the number of bytes in the base name (including the trailing NUL
+// character) on success, 0 on error. The base name is typically the font's
+// PostScript name. See descriptions of "BaseFont" in ISO 32000-1:2008 spec.
+//
+// Regardless of the platform, the |buffer| is always in UTF-8 encoding.
+// If |length| is less than the returned length, or |buffer| is NULL, |buffer|
+// will not be modified.
+FPDF_EXPORT size_t FPDF_CALLCONV FPDFFont_GetBaseFontName(FPDF_FONT font,
+ char* buffer,
+ size_t length);
+
+// Experimental API.
+// Get the family name of a font.
+//
+// font - the handle to the font object.
+// buffer - the address of a buffer that receives the font name.
+// length - the size, in bytes, of |buffer|.
+//
+// Returns the number of bytes in the family name (including the trailing NUL
+// character) on success, 0 on error.
+//
+// Regardless of the platform, the |buffer| is always in UTF-8 encoding.
+// If |length| is less than the returned length, or |buffer| is NULL, |buffer|
+// will not be modified.
+FPDF_EXPORT size_t FPDF_CALLCONV FPDFFont_GetFamilyName(FPDF_FONT font,
+ char* buffer,
+ size_t length);
+
+// Experimental API.
+// Get the decoded data from the |font| object.
+//
+// font - The handle to the font object. (Required)
+// buffer - The address of a buffer that receives the font data.
+// buflen - Length of the buffer.
+// out_buflen - Pointer to variable that will receive the minimum buffer size
+// to contain the font data. Not filled if the return value is
+// FALSE. (Required)
+//
+// Returns TRUE on success. In which case, |out_buflen| will be filled, and
+// |buffer| will be filled if it is large enough. Returns FALSE if any of the
+// required parameters are null.
+//
+// The decoded data is the uncompressed font data. i.e. the raw font data after
+// having all stream filters applied, when the data is embedded.
+//
+// If the font is not embedded, then this API will instead return the data for
+// the substitution font it is using.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetFontData(FPDF_FONT font,
+ uint8_t* buffer,
+ size_t buflen,
+ size_t* out_buflen);
+
+// Experimental API.
+// Get whether |font| is embedded or not.
+//
+// font - the handle to the font object.
+//
+// Returns 1 if the font is embedded, 0 if it not, and -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetIsEmbedded(FPDF_FONT font);
+
+// Experimental API.
+// Get the descriptor flags of a font.
+//
+// font - the handle to the font object.
+//
+// Returns the bit flags specifying various characteristics of the font as
+// defined in ISO 32000-1:2008, table 123, -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetFlags(FPDF_FONT font);
+
+// Experimental API.
+// Get the font weight of a font.
+//
+// font - the handle to the font object.
+//
+// Returns the font weight, -1 on failure.
+// Typical values are 400 (normal) and 700 (bold).
+FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetWeight(FPDF_FONT font);
+
+// Experimental API.
+// Get the italic angle of a font.
+//
+// font - the handle to the font object.
+// angle - pointer where the italic angle will be stored
+//
+// The italic angle of a |font| is defined as degrees counterclockwise
+// from vertical. For a font that slopes to the right, this will be negative.
+//
+// Returns TRUE on success; |angle| unmodified on failure.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetItalicAngle(FPDF_FONT font,
+ int* angle);
+
+// Experimental API.
+// Get ascent distance of a font.
+//
+// font - the handle to the font object.
+// font_size - the size of the |font|.
+// ascent - pointer where the font ascent will be stored
+//
+// Ascent is the maximum distance in points above the baseline reached by the
+// glyphs of the |font|. One point is 1/72 inch (around 0.3528 mm).
+//
+// Returns TRUE on success; |ascent| unmodified on failure.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetAscent(FPDF_FONT font,
+ float font_size,
+ float* ascent);
+
+// Experimental API.
+// Get descent distance of a font.
+//
+// font - the handle to the font object.
+// font_size - the size of the |font|.
+// descent - pointer where the font descent will be stored
+//
+// Descent is the maximum distance in points below the baseline reached by the
+// glyphs of the |font|. One point is 1/72 inch (around 0.3528 mm).
+//
+// Returns TRUE on success; |descent| unmodified on failure.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetDescent(FPDF_FONT font,
+ float font_size,
+ float* descent);
+
+// Experimental API.
+// Get the width of a glyph in a font.
+//
+// font - the handle to the font object.
+// glyph - the glyph.
+// font_size - the size of the font.
+// width - pointer where the glyph width will be stored
+//
+// Glyph width is the distance from the end of the prior glyph to the next
+// glyph. This will be the vertical distance for vertical writing.
+//
+// Returns TRUE on success; |width| unmodified on failure.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetGlyphWidth(FPDF_FONT font,
+ uint32_t glyph,
+ float font_size,
+ float* width);
+
+// Experimental API.
+// Get the glyphpath describing how to draw a font glyph.
+//
+// font - the handle to the font object.
+// glyph - the glyph being drawn.
+// font_size - the size of the font.
+//
+// Returns the handle to the segment, or NULL on faiure.
+FPDF_EXPORT FPDF_GLYPHPATH FPDF_CALLCONV FPDFFont_GetGlyphPath(FPDF_FONT font,
+ uint32_t glyph,
+ float font_size);
+
+// Experimental API.
+// Get number of segments inside glyphpath.
+//
+// glyphpath - handle to a glyph path.
+//
+// Returns the number of objects in |glyphpath| or -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFGlyphPath_CountGlyphSegments(FPDF_GLYPHPATH glyphpath);
+
+// Experimental API.
+// Get segment in glyphpath at index.
+//
+// glyphpath - handle to a glyph path.
+// index - the index of a segment.
+//
+// Returns the handle to the segment, or NULL on faiure.
+FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
+FPDFGlyphPath_GetGlyphPathSegment(FPDF_GLYPHPATH glyphpath, int index);
+
+// Get number of page objects inside |form_object|.
+//
+// form_object - handle to a form object.
+//
+// Returns the number of objects in |form_object| on success, -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
+
+// Get page object in |form_object| at |index|.
+//
+// form_object - handle to a form object.
+// index - the 0-based index of a page object.
+//
+// Returns the handle to the page object, or NULL on error.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_EDIT_H_
diff --git a/src/main/jni/include/fpdf_ext.h b/src/main/jni/include/fpdf_ext.h
index 5efe0e66..068a977c 100644
--- a/src/main/jni/include/fpdf_ext.h
+++ b/src/main/jni/include/fpdf_ext.h
@@ -1,108 +1,119 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FPDF_EXT_H_
-#define _FPDF_EXT_H_
+#ifndef PUBLIC_FPDF_EXT_H_
+#define PUBLIC_FPDF_EXT_H_
+
+#include
-#ifndef _FPDFVIEW_H_
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-#endif
#ifdef __cplusplus
extern "C" {
-#endif
-
-//flags for type of unsupport object.
-#define FPDF_UNSP_DOC_XFAFORM 1
-#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2
-#define FPDF_UNSP_DOC_ATTACHMENT 3
-#define FPDF_UNSP_DOC_SECURITY 4
-#define FPDF_UNSP_DOC_SHAREDREVIEW 5
-#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6
-#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7
-#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8
-#define FPDF_UNSP_ANNOT_3DANNOT 11
-#define FPDF_UNSP_ANNOT_MOVIE 12
-#define FPDF_UNSP_ANNOT_SOUND 13
-#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14
-#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15
-#define FPDF_UNSP_ANNOT_ATTACHMENT 16
-#define FPDF_UNSP_ANNOT_SIG 17
-
-typedef struct _UNSUPPORT_INFO
-{
- /**
- * Version number of the interface. Currently must be 1.
- **/
- int version;
-
- /**
- * Method: FSDK_UnSupport_Handler
- * UnSupport Object process handling function.
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * nType - The type of unsupportObject
- * Return value:
- * None.
- * */
-
- void(*FSDK_UnSupport_Handler)(_UNSUPPORT_INFO* pThis,int nType);
-}UNSUPPORT_INFO;
-
-
-/**
- * Function: FSDK_SetUnSpObjProcessHandler
- * Setup A UnSupport Object process handler for foxit sdk.
- * Parameters:
- * unsp_info - Pointer to a UNSUPPORT_INFO structure.
- * Return Value:
- * TRUE means successful. FALSE means fails.
- **/
-
-DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
-
-//flags for page mode.
-
-//Unknown value
-#define PAGEMODE_UNKONOWN -1
-
-//Neither document outline nor thumbnail images visible
-#define PAGEMODE_USENONE 0
-
-//Document outline visible
-#define PAGEMODE_USEOUTLINES 1
-
-//Thumbnial images visible
-#define PAGEMODE_USETHUMBS 2
-
-//Full-screen mode, with no menu bar, window controls, or any other window visible
-#define PAGEMODE_FULLSCREEN 3
-
-//Optional content group panel visible
-#define PAGEMODE_USEOC 4
-
-//Attachments panel visible
-#define PAGEMODE_USEATTACHMENTS 5
-
-
-/**
- * Function: FPDFDoc_GetPageMode
- * Get the document's PageMode(How the document should be displayed when opened)
- * Parameters:
- * doc - Handle to document. Returned by FPDF_LoadDocument function.
- * Return Value:
- * The flags for page mode.
- **/
-DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
+#endif // __cplusplus
+
+// Unsupported XFA form.
+#define FPDF_UNSP_DOC_XFAFORM 1
+// Unsupported portable collection.
+#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2
+// Unsupported attachment.
+#define FPDF_UNSP_DOC_ATTACHMENT 3
+// Unsupported security.
+#define FPDF_UNSP_DOC_SECURITY 4
+// Unsupported shared review.
+#define FPDF_UNSP_DOC_SHAREDREVIEW 5
+// Unsupported shared form, acrobat.
+#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6
+// Unsupported shared form, filesystem.
+#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7
+// Unsupported shared form, email.
+#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8
+// Unsupported 3D annotation.
+#define FPDF_UNSP_ANNOT_3DANNOT 11
+// Unsupported movie annotation.
+#define FPDF_UNSP_ANNOT_MOVIE 12
+// Unsupported sound annotation.
+#define FPDF_UNSP_ANNOT_SOUND 13
+// Unsupported screen media annotation.
+#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14
+// Unsupported screen rich media annotation.
+#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15
+// Unsupported attachment annotation.
+#define FPDF_UNSP_ANNOT_ATTACHMENT 16
+// Unsupported signature annotation.
+#define FPDF_UNSP_ANNOT_SIG 17
+
+// Interface for unsupported feature notifications.
+typedef struct _UNSUPPORT_INFO {
+ // Version number of the interface. Must be 1.
+ int version;
+
+ // Unsupported object notification function.
+ // Interface Version: 1
+ // Implementation Required: Yes
+ //
+ // pThis - pointer to the interface structure.
+ // nType - the type of unsupported object. One of the |FPDF_UNSP_*| entries.
+ void (*FSDK_UnSupport_Handler)(struct _UNSUPPORT_INFO* pThis, int nType);
+} UNSUPPORT_INFO;
+
+// Setup an unsupported object handler.
+//
+// unsp_info - Pointer to an UNSUPPORT_INFO structure.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
+
+// Set replacement function for calls to time().
+//
+// This API is intended to be used only for testing, thus may cause PDFium to
+// behave poorly in production environments.
+//
+// func - Function pointer to alternate implementation of time(), or
+// NULL to restore to actual time() call itself.
+FPDF_EXPORT void FPDF_CALLCONV FSDK_SetTimeFunction(time_t (*func)());
+
+// Set replacement function for calls to localtime().
+//
+// This API is intended to be used only for testing, thus may cause PDFium to
+// behave poorly in production environments.
+//
+// func - Function pointer to alternate implementation of localtime(), or
+// NULL to restore to actual localtime() call itself.
+FPDF_EXPORT void FPDF_CALLCONV
+FSDK_SetLocaltimeFunction(struct tm* (*func)(const time_t*));
+
+// Unknown page mode.
+#define PAGEMODE_UNKNOWN -1
+// Document outline, and thumbnails hidden.
+#define PAGEMODE_USENONE 0
+// Document outline visible.
+#define PAGEMODE_USEOUTLINES 1
+// Thumbnail images visible.
+#define PAGEMODE_USETHUMBS 2
+// Full-screen mode, no menu bar, window controls, or other decorations visible.
+#define PAGEMODE_FULLSCREEN 3
+// Optional content group panel visible.
+#define PAGEMODE_USEOC 4
+// Attachments panel visible.
+#define PAGEMODE_USEATTACHMENTS 5
+
+// Get the document's PageMode.
+//
+// doc - Handle to document.
+//
+// Returns one of the |PAGEMODE_*| flags defined above.
+//
+// The page mode defines how the document should be initially displayed.
+FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
#ifdef __cplusplus
-};
-#endif
-#endif
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_EXT_H_
diff --git a/src/main/jni/include/fpdf_flatten.h b/src/main/jni/include/fpdf_flatten.h
index 2e9e5092..aba5186b 100644
--- a/src/main/jni/include/fpdf_flatten.h
+++ b/src/main/jni/include/fpdf_flatten.h
@@ -1,42 +1,44 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FPDF_FLATTEN_H_
-#define _FPDF_FLATTEN_H_
-
+#ifndef PUBLIC_FPDF_FLATTEN_H_
+#define PUBLIC_FPDF_FLATTEN_H_
+
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-#define FLATTEN_FAIL 0 // Flatten operation failed.
-#define FLATTEN_SUCCESS 1 // Flatten operation succeed.
-#define FLATTEN_NOTINGTODO 2 // There is nothing can be flatten.
-
+// Flatten operation failed.
+#define FLATTEN_FAIL 0
+// Flatten operation succeed.
+#define FLATTEN_SUCCESS 1
+// Nothing to be flattened.
+#define FLATTEN_NOTHINGTODO 2
+
+// Flatten for normal display.
+#define FLAT_NORMALDISPLAY 0
+// Flatten for print.
+#define FLAT_PRINT 1
+
#ifdef __cplusplus
extern "C" {
-#endif
-
-#define FLAT_NORMALDISPLAY 0
-#define FLAT_PRINT 1
- //Function: FPDFPage_Flatten
-
- // Flat a pdf page,annotations or form fields will become part of the page contents.
- //Parameters:
-
- // page - Handle to the page. Returned by FPDF_LoadPage function.
- // nFlag - the flag for the use of flatten result. Zero for normal display, 1 for print.
- //Return value:
- // The result flag of the function, See flags above ( FLATTEN_FAIL, FLATTEN_SUCCESS, FLATTEN_NOTINGTODO ).
- //
- // Comments: Current version all fails return zero. If necessary we will assign different value
- // to indicate different fail reason.
- //
- DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag);
-
-
+#endif // __cplusplus
+
+// Flatten annotations and form fields into the page contents.
+//
+// page - handle to the page.
+// nFlag - One of the |FLAT_*| values denoting the page usage.
+//
+// Returns one of the |FLATTEN_*| values.
+//
+// Currently, all failures return |FLATTEN_FAIL| with no indication of the
+// cause.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag);
+
#ifdef __cplusplus
-};
-#endif
+} // extern "C"
+#endif // __cplusplus
-#endif //_FPDF_FLATTEN_H_
+#endif // PUBLIC_FPDF_FLATTEN_H_
diff --git a/src/main/jni/include/fpdf_formfill.h b/src/main/jni/include/fpdf_formfill.h
new file mode 100644
index 00000000..1f0b1298
--- /dev/null
+++ b/src/main/jni/include/fpdf_formfill.h
@@ -0,0 +1,1830 @@
+// Copyright 2014 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_FORMFILL_H_
+#define PUBLIC_FPDF_FORMFILL_H_
+
+// clang-format off
+// NOLINTNEXTLINE(build/include_directory)
+#include "fpdfview.h"
+
+// These values are return values for a public API, so should not be changed
+// other than the count when adding new values.
+#define FORMTYPE_NONE 0 // Document contains no forms
+#define FORMTYPE_ACRO_FORM 1 // Forms are specified using AcroForm spec
+#define FORMTYPE_XFA_FULL 2 // Forms are specified using entire XFA spec
+#define FORMTYPE_XFA_FOREGROUND 3 // Forms are specified using the XFAF subset
+ // of XFA spec
+#define FORMTYPE_COUNT 4 // The number of form types
+
+#define JSPLATFORM_ALERT_BUTTON_OK 0 // OK button
+#define JSPLATFORM_ALERT_BUTTON_OKCANCEL 1 // OK & Cancel buttons
+#define JSPLATFORM_ALERT_BUTTON_YESNO 2 // Yes & No buttons
+#define JSPLATFORM_ALERT_BUTTON_YESNOCANCEL 3 // Yes, No & Cancel buttons
+#define JSPLATFORM_ALERT_BUTTON_DEFAULT JSPLATFORM_ALERT_BUTTON_OK
+
+#define JSPLATFORM_ALERT_ICON_ERROR 0 // Error
+#define JSPLATFORM_ALERT_ICON_WARNING 1 // Warning
+#define JSPLATFORM_ALERT_ICON_QUESTION 2 // Question
+#define JSPLATFORM_ALERT_ICON_STATUS 3 // Status
+#define JSPLATFORM_ALERT_ICON_ASTERISK 4 // Asterisk
+#define JSPLATFORM_ALERT_ICON_DEFAULT JSPLATFORM_ALERT_ICON_ERROR
+
+#define JSPLATFORM_ALERT_RETURN_OK 1 // OK
+#define JSPLATFORM_ALERT_RETURN_CANCEL 2 // Cancel
+#define JSPLATFORM_ALERT_RETURN_NO 3 // No
+#define JSPLATFORM_ALERT_RETURN_YES 4 // Yes
+
+#define JSPLATFORM_BEEP_ERROR 0 // Error
+#define JSPLATFORM_BEEP_WARNING 1 // Warning
+#define JSPLATFORM_BEEP_QUESTION 2 // Question
+#define JSPLATFORM_BEEP_STATUS 3 // Status
+#define JSPLATFORM_BEEP_DEFAULT 4 // Default
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _IPDF_JsPlatform {
+ // Version number of the interface. Currently must be 2.
+ int version;
+
+ // Version 1.
+
+ // Method: app_alert
+ // Pop up a dialog to show warning or hint.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // Msg - A string containing the message to be displayed.
+ // Title - The title of the dialog.
+ // Type - The type of button group, one of the
+ // JSPLATFORM_ALERT_BUTTON_* values above.
+ // nIcon - The type of the icon, one of the
+ // JSPLATFORM_ALERT_ICON_* above.
+ // Return Value:
+ // Option selected by user in dialogue, one of the
+ // JSPLATFORM_ALERT_RETURN_* values above.
+ int (*app_alert)(struct _IPDF_JsPlatform* pThis,
+ FPDF_WIDESTRING Msg,
+ FPDF_WIDESTRING Title,
+ int Type,
+ int Icon);
+
+ // Method: app_beep
+ // Causes the system to play a sound.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // nType - The sound type, see JSPLATFORM_BEEP_TYPE_*
+ // above.
+ // Return Value:
+ // None
+ void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType);
+
+ // Method: app_response
+ // Displays a dialog box containing a question and an entry field for
+ // the user to reply to the question.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // Question - The question to be posed to the user.
+ // Title - The title of the dialog box.
+ // Default - A default value for the answer to the question. If
+ // not specified, no default value is presented.
+ // cLabel - A short string to appear in front of and on the
+ // same line as the edit text field.
+ // bPassword - If true, indicates that the user's response should
+ // be shown as asterisks (*) or bullets (?) to mask
+ // the response, which might be sensitive information.
+ // response - A string buffer allocated by PDFium, to receive the
+ // user's response.
+ // length - The length of the buffer in bytes. Currently, it is
+ // always 2048.
+ // Return Value:
+ // Number of bytes the complete user input would actually require, not
+ // including trailing zeros, regardless of the value of the length
+ // parameter or the presence of the response buffer.
+ // Comments:
+ // No matter on what platform, the response buffer should be always
+ // written using UTF-16LE encoding. If a response buffer is
+ // present and the size of the user input exceeds the capacity of the
+ // buffer as specified by the length parameter, only the
+ // first "length" bytes of the user input are to be written to the
+ // buffer.
+ int (*app_response)(struct _IPDF_JsPlatform* pThis,
+ FPDF_WIDESTRING Question,
+ FPDF_WIDESTRING Title,
+ FPDF_WIDESTRING Default,
+ FPDF_WIDESTRING cLabel,
+ FPDF_BOOL bPassword,
+ void* response,
+ int length);
+
+ // Method: Doc_getFilePath
+ // Get the file path of the current document.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // filePath - The string buffer to receive the file path. Can
+ // be NULL.
+ // length - The length of the buffer, number of bytes. Can
+ // be 0.
+ // Return Value:
+ // Number of bytes the filePath consumes, including trailing zeros.
+ // Comments:
+ // The filePath should always be provided in the local encoding.
+ // The return value always indicated number of bytes required for
+ // the buffer, even when there is no buffer specified, or the buffer
+ // size is less than required. In this case, the buffer will not
+ // be modified.
+ int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis,
+ void* filePath,
+ int length);
+
+ // Method: Doc_mail
+ // Mails the data buffer as an attachment to all recipients, with or
+ // without user interaction.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // mailData - Pointer to the data buffer to be sent. Can be NULL.
+ // length - The size,in bytes, of the buffer pointed by
+ // mailData parameter. Can be 0.
+ // bUI - If true, the rest of the parameters are used in a
+ // compose-new-message window that is displayed to the
+ // user. If false, the cTo parameter is required and
+ // all others are optional.
+ // To - A semicolon-delimited list of recipients for the
+ // message.
+ // Subject - The subject of the message. The length limit is
+ // 64 KB.
+ // CC - A semicolon-delimited list of CC recipients for
+ // the message.
+ // BCC - A semicolon-delimited list of BCC recipients for
+ // the message.
+ // Msg - The content of the message. The length limit is
+ // 64 KB.
+ // Return Value:
+ // None.
+ // Comments:
+ // If the parameter mailData is NULL or length is 0, the current
+ // document will be mailed as an attachment to all recipients.
+ void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,
+ void* mailData,
+ int length,
+ FPDF_BOOL bUI,
+ FPDF_WIDESTRING To,
+ FPDF_WIDESTRING Subject,
+ FPDF_WIDESTRING CC,
+ FPDF_WIDESTRING BCC,
+ FPDF_WIDESTRING Msg);
+
+ // Method: Doc_print
+ // Prints all or a specific number of pages of the document.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // bUI - If true, will cause a UI to be presented to the
+ // user to obtain printing information and confirm
+ // the action.
+ // nStart - A 0-based index that defines the start of an
+ // inclusive range of pages.
+ // nEnd - A 0-based index that defines the end of an
+ // inclusive page range.
+ // bSilent - If true, suppresses the cancel dialog box while
+ // the document is printing. The default is false.
+ // bShrinkToFit - If true, the page is shrunk (if necessary) to
+ // fit within the imageable area of the printed page.
+ // bPrintAsImage - If true, print pages as an image.
+ // bReverse - If true, print from nEnd to nStart.
+ // bAnnotations - If true (the default), annotations are
+ // printed.
+ // Return Value:
+ // None.
+ void (*Doc_print)(struct _IPDF_JsPlatform* pThis,
+ FPDF_BOOL bUI,
+ int nStart,
+ int nEnd,
+ FPDF_BOOL bSilent,
+ FPDF_BOOL bShrinkToFit,
+ FPDF_BOOL bPrintAsImage,
+ FPDF_BOOL bReverse,
+ FPDF_BOOL bAnnotations);
+
+ // Method: Doc_submitForm
+ // Send the form data to a specified URL.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // formData - Pointer to the data buffer to be sent.
+ // length - The size,in bytes, of the buffer pointed by
+ // formData parameter.
+ // URL - The URL to send to.
+ // Return Value:
+ // None.
+ void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,
+ void* formData,
+ int length,
+ FPDF_WIDESTRING URL);
+
+ // Method: Doc_gotoPage
+ // Jump to a specified page.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // nPageNum - The specified page number, zero for the first page.
+ // Return Value:
+ // None.
+ void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
+
+ // Method: Field_browse
+ // Show a file selection dialog, and return the selected file path.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // filePath - Pointer to the data buffer to receive the file
+ // path. Can be NULL.
+ // length - The length of the buffer, in bytes. Can be 0.
+ // Return Value:
+ // Number of bytes the filePath consumes, including trailing zeros.
+ // Comments:
+ // The filePath should always be provided in local encoding.
+ int (*Field_browse)(struct _IPDF_JsPlatform* pThis,
+ void* filePath,
+ int length);
+
+ // Pointer for embedder-specific data. Unused by PDFium, and despite
+ // its name, can be any data the embedder desires, though traditionally
+ // a FPDF_FORMFILLINFO interface.
+ void* m_pFormfillinfo;
+
+ // Version 2.
+
+ void* m_isolate; // Unused in v3, retain for compatibility.
+ unsigned int m_v8EmbedderSlot; // Unused in v3, retain for compatibility.
+
+ // Version 3.
+ // Version 3 moves m_Isolate and m_v8EmbedderSlot to FPDF_LIBRARY_CONFIG.
+} IPDF_JSPLATFORM;
+
+// Flags for Cursor type
+#define FXCT_ARROW 0
+#define FXCT_NESW 1
+#define FXCT_NWSE 2
+#define FXCT_VBEAM 3
+#define FXCT_HBEAM 4
+#define FXCT_HAND 5
+
+// Function signature for the callback function passed to the FFI_SetTimer
+// method.
+// Parameters:
+// idEvent - Identifier of the timer.
+// Return value:
+// None.
+typedef void (*TimerCallback)(int idEvent);
+
+// Declares of a struct type to the local system time.
+typedef struct _FPDF_SYSTEMTIME {
+ unsigned short wYear; // years since 1900
+ unsigned short wMonth; // months since January - [0,11]
+ unsigned short wDayOfWeek; // days since Sunday - [0,6]
+ unsigned short wDay; // day of the month - [1,31]
+ unsigned short wHour; // hours since midnight - [0,23]
+ unsigned short wMinute; // minutes after the hour - [0,59]
+ unsigned short wSecond; // seconds after the minute - [0,59]
+ unsigned short wMilliseconds; // milliseconds after the second - [0,999]
+} FPDF_SYSTEMTIME;
+
+#ifdef PDF_ENABLE_XFA
+
+// Pageview event flags
+#define FXFA_PAGEVIEWEVENT_POSTADDED 1 // After a new pageview is added.
+#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3 // After a pageview is removed.
+
+// Definitions for Right Context Menu Features Of XFA Fields
+#define FXFA_MENU_COPY 1
+#define FXFA_MENU_CUT 2
+#define FXFA_MENU_SELECTALL 4
+#define FXFA_MENU_UNDO 8
+#define FXFA_MENU_REDO 16
+#define FXFA_MENU_PASTE 32
+
+// Definitions for File Type.
+#define FXFA_SAVEAS_XML 1
+#define FXFA_SAVEAS_XDP 2
+
+#endif // PDF_ENABLE_XFA
+
+typedef struct _FPDF_FORMFILLINFO {
+ // Version number of the interface.
+ // Version 1 contains stable interfaces. Version 2 has additional
+ // experimental interfaces.
+ // When PDFium is built without the XFA module, version can be 1 or 2.
+ // With version 1, only stable interfaces are called. With version 2,
+ // additional experimental interfaces are also called.
+ // When PDFium is built with the XFA module, version must be 2.
+ // All the XFA related interfaces are experimental. If PDFium is built with
+ // the XFA module and version 1 then none of the XFA related interfaces
+ // would be called. When PDFium is built with XFA module then the version
+ // must be 2.
+ int version;
+
+ // Version 1.
+
+ // Method: Release
+ // Give the implementation a chance to release any resources after the
+ // interface is no longer used.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Comments:
+ // Called by PDFium during the final cleanup process.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // Return Value:
+ // None
+ void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
+
+ // Method: FFI_Invalidate
+ // Invalidate the client area within the specified rectangle.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page - Handle to the page. Returned by FPDF_LoadPage().
+ // left - Left position of the client area in PDF page
+ // coordinates.
+ // top - Top position of the client area in PDF page
+ // coordinates.
+ // right - Right position of the client area in PDF page
+ // coordinates.
+ // bottom - Bottom position of the client area in PDF page
+ // coordinates.
+ // Return Value:
+ // None.
+ // Comments:
+ // All positions are measured in PDF "user space".
+ // Implementation should call FPDF_RenderPageBitmap() for repainting
+ // the specified page area.
+ void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_PAGE page,
+ double left,
+ double top,
+ double right,
+ double bottom);
+
+ // Method: FFI_OutputSelectedRect
+ // When the user selects text in form fields with the mouse, this
+ // callback function will be invoked with the selected areas.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page - Handle to the page. Returned by FPDF_LoadPage()/
+ // left - Left position of the client area in PDF page
+ // coordinates.
+ // top - Top position of the client area in PDF page
+ // coordinates.
+ // right - Right position of the client area in PDF page
+ // coordinates.
+ // bottom - Bottom position of the client area in PDF page
+ // coordinates.
+ // Return Value:
+ // None.
+ // Comments:
+ // This callback function is useful for implementing special text
+ // selection effects. An implementation should first record the
+ // returned rectangles, then draw them one by one during the next
+ // painting period. Lastly, it should remove all the recorded
+ // rectangles when finished painting.
+ void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_PAGE page,
+ double left,
+ double top,
+ double right,
+ double bottom);
+
+ // Method: FFI_SetCursor
+ // Set the Cursor shape.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // nCursorType - Cursor type, see Flags for Cursor type for details.
+ // Return value:
+ // None.
+ void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
+
+ // Method: FFI_SetTimer
+ // This method installs a system timer. An interval value is specified,
+ // and every time that interval elapses, the system must call into the
+ // callback function with the timer ID as returned by this function.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // uElapse - Specifies the time-out value, in milliseconds.
+ // lpTimerFunc - A pointer to the callback function-TimerCallback.
+ // Return value:
+ // The timer identifier of the new timer if the function is successful.
+ // An application passes this value to the FFI_KillTimer method to kill
+ // the timer. Nonzero if it is successful; otherwise, it is zero.
+ int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis,
+ int uElapse,
+ TimerCallback lpTimerFunc);
+
+ // Method: FFI_KillTimer
+ // This method uninstalls a system timer, as set by an earlier call to
+ // FFI_SetTimer.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // nTimerID - The timer ID returned by FFI_SetTimer function.
+ // Return value:
+ // None.
+ void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
+
+ // Method: FFI_GetLocalTime
+ // This method receives the current local time on the system.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // Return value:
+ // The local time. See FPDF_SYSTEMTIME above for details.
+ // Note: Unused.
+ FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
+
+ // Method: FFI_OnChange
+ // This method will be invoked to notify the implementation when the
+ // value of any FormField on the document had been changed.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // no
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // Return value:
+ // None.
+ void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
+
+ // Method: FFI_GetPage
+ // This method receives the page handle associated with a specified
+ // page index.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // document - Handle to document. Returned by FPDF_LoadDocument().
+ // nPageIndex - Index number of the page. 0 for the first page.
+ // Return value:
+ // Handle to the page, as previously returned to the implementation by
+ // FPDF_LoadPage().
+ // Comments:
+ // The implementation is expected to keep track of the page handles it
+ // receives from PDFium, and their mappings to page numbers. In some
+ // cases, the document-level JavaScript action may refer to a page
+ // which hadn't been loaded yet. To successfully run the Javascript
+ // action, the implementation needs to load the page.
+ FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_DOCUMENT document,
+ int nPageIndex);
+
+ // Method: FFI_GetCurrentPage
+ // This method receives the handle to the current page.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Yes when V8 support is present, otherwise unused.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // document - Handle to document. Returned by FPDF_LoadDocument().
+ // Return value:
+ // Handle to the page. Returned by FPDF_LoadPage().
+ // Comments:
+ // PDFium doesn't keep keep track of the "current page" (e.g. the one
+ // that is most visible on screen), so it must ask the embedder for
+ // this information.
+ FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_DOCUMENT document);
+
+ // Method: FFI_GetRotation
+ // This method receives currently rotation of the page view.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page - Handle to page, as returned by FPDF_LoadPage().
+ // Return value:
+ // A number to indicate the page rotation in 90 degree increments
+ // in a clockwise direction:
+ // 0 - 0 degrees
+ // 1 - 90 degrees
+ // 2 - 180 degrees
+ // 3 - 270 degrees
+ // Note: Unused.
+ int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
+
+ // Method: FFI_ExecuteNamedAction
+ // This method will execute a named action.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // namedAction - A byte string which indicates the named action,
+ // terminated by 0.
+ // Return value:
+ // None.
+ // Comments:
+ // See ISO 32000-1:2008, section 12.6.4.11 for descriptions of the
+ // standard named actions, but note that a document may supply any
+ // name of its choosing.
+ void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_BYTESTRING namedAction);
+ // Method: FFI_SetTextFieldFocus
+ // Called when a text field is getting or losing focus.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // no
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // value - The string value of the form field, in UTF-16LE
+ // format.
+ // valueLen - The length of the string value. This is the
+ // number of characters, not bytes.
+ // is_focus - True if the form field is getting focus, false
+ // if the form field is losing focus.
+ // Return value:
+ // None.
+ // Comments:
+ // Only supports text fields and combobox fields.
+ void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_WIDESTRING value,
+ FPDF_DWORD valueLen,
+ FPDF_BOOL is_focus);
+
+ // Method: FFI_DoURIAction
+ // Ask the implementation to navigate to a uniform resource identifier.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // bsURI - A byte string which indicates the uniform
+ // resource identifier, terminated by 0.
+ // Return value:
+ // None.
+ // Comments:
+ // If the embedder is version 2 or higher and have implementation for
+ // FFI_DoURIActionWithKeyboardModifier, then
+ // FFI_DoURIActionWithKeyboardModifier takes precedence over
+ // FFI_DoURIAction.
+ // See the URI actions description of <>
+ // for more details.
+ void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_BYTESTRING bsURI);
+
+ // Method: FFI_DoGoToAction
+ // This action changes the view to a specified destination.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // nPageIndex - The index of the PDF page.
+ // zoomMode - The zoom mode for viewing page. See below.
+ // fPosArray - The float array which carries the position info.
+ // sizeofArray - The size of float array.
+ // PDFZoom values:
+ // - XYZ = 1
+ // - FITPAGE = 2
+ // - FITHORZ = 3
+ // - FITVERT = 4
+ // - FITRECT = 5
+ // - FITBBOX = 6
+ // - FITBHORZ = 7
+ // - FITBVERT = 8
+ // Return value:
+ // None.
+ // Comments:
+ // See the Destinations description of <>
+ // in 8.2.1 for more details.
+ void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis,
+ int nPageIndex,
+ int zoomMode,
+ float* fPosArray,
+ int sizeofArray);
+
+ // Pointer to IPDF_JSPLATFORM interface.
+ // Unused if PDFium is built without V8 support. Otherwise, if NULL, then
+ // JavaScript will be prevented from executing while rendering the document.
+ IPDF_JSPLATFORM* m_pJsPlatform;
+
+ // Version 2 - Experimental.
+
+ // Whether the XFA module is disabled when built with the XFA module.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ FPDF_BOOL xfa_disabled;
+
+ // Method: FFI_DisplayCaret
+ // This method will show the caret at specified position.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page - Handle to page. Returned by FPDF_LoadPage().
+ // left - Left position of the client area in PDF page
+ // coordinates.
+ // top - Top position of the client area in PDF page
+ // coordinates.
+ // right - Right position of the client area in PDF page
+ // coordinates.
+ // bottom - Bottom position of the client area in PDF page
+ // coordinates.
+ // Return value:
+ // None.
+ void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_PAGE page,
+ FPDF_BOOL bVisible,
+ double left,
+ double top,
+ double right,
+ double bottom);
+
+ // Method: FFI_GetCurrentPageIndex
+ // This method will get the current page index.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // document - Handle to document from FPDF_LoadDocument().
+ // Return value:
+ // The index of current page.
+ int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_DOCUMENT document);
+
+ // Method: FFI_SetCurrentPage
+ // This method will set the current page.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // document - Handle to document from FPDF_LoadDocument().
+ // iCurPage - The index of the PDF page.
+ // Return value:
+ // None.
+ void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_DOCUMENT document,
+ int iCurPage);
+
+ // Method: FFI_GotoURL
+ // This method will navigate to the specified URL.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // document - Handle to document from FPDF_LoadDocument().
+ // wsURL - The string value of the URL, in UTF-16LE format.
+ // Return value:
+ // None.
+ void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_DOCUMENT document,
+ FPDF_WIDESTRING wsURL);
+
+ // Method: FFI_GetPageViewRect
+ // This method will get the current page view rectangle.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page - Handle to page. Returned by FPDF_LoadPage().
+ // left - The pointer to receive left position of the page
+ // view area in PDF page coordinates.
+ // top - The pointer to receive top position of the page
+ // view area in PDF page coordinates.
+ // right - The pointer to receive right position of the
+ // page view area in PDF page coordinates.
+ // bottom - The pointer to receive bottom position of the
+ // page view area in PDF page coordinates.
+ // Return value:
+ // None.
+ void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_PAGE page,
+ double* left,
+ double* top,
+ double* right,
+ double* bottom);
+
+ // Method: FFI_PageEvent
+ // This method fires when pages have been added to or deleted from
+ // the XFA document.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page_count - The number of pages to be added or deleted.
+ // event_type - See FXFA_PAGEVIEWEVENT_* above.
+ // Return value:
+ // None.
+ // Comments:
+ // The pages to be added or deleted always start from the last page
+ // of document. This means that if parameter page_count is 2 and
+ // event type is FXFA_PAGEVIEWEVENT_POSTADDED, 2 new pages have been
+ // appended to the tail of document; If page_count is 2 and
+ // event type is FXFA_PAGEVIEWEVENT_POSTREMOVED, the last 2 pages
+ // have been deleted.
+ void (*FFI_PageEvent)(struct _FPDF_FORMFILLINFO* pThis,
+ int page_count,
+ FPDF_DWORD event_type);
+
+ // Method: FFI_PopupMenu
+ // This method will track the right context menu for XFA fields.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // page - Handle to page. Returned by FPDF_LoadPage().
+ // hWidget - Always null, exists for compatibility.
+ // menuFlag - The menu flags. Please refer to macro definition
+ // of FXFA_MENU_XXX and this can be one or a
+ // combination of these macros.
+ // x - X position of the client area in PDF page
+ // coordinates.
+ // y - Y position of the client area in PDF page
+ // coordinates.
+ // Return value:
+ // TRUE indicates success; otherwise false.
+ FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_PAGE page,
+ FPDF_WIDGET hWidget,
+ int menuFlag,
+ float x,
+ float y);
+
+ // Method: FFI_OpenFile
+ // This method will open the specified file with the specified mode.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // fileFlag - The file flag. Please refer to macro definition
+ // of FXFA_SAVEAS_XXX and use one of these macros.
+ // wsURL - The string value of the file URL, in UTF-16LE
+ // format.
+ // mode - The mode for open file, e.g. "rb" or "wb".
+ // Return value:
+ // The handle to FPDF_FILEHANDLER.
+ FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis,
+ int fileFlag,
+ FPDF_WIDESTRING wsURL,
+ const char* mode);
+
+ // Method: FFI_EmailTo
+ // This method will email the specified file stream to the specified
+ // contact.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // pFileHandler - Handle to the FPDF_FILEHANDLER.
+ // pTo - A semicolon-delimited list of recipients for the
+ // message,in UTF-16LE format.
+ // pSubject - The subject of the message,in UTF-16LE format.
+ // pCC - A semicolon-delimited list of CC recipients for
+ // the message,in UTF-16LE format.
+ // pBcc - A semicolon-delimited list of BCC recipients for
+ // the message,in UTF-16LE format.
+ // pMsg - Pointer to the data buffer to be sent.Can be
+ // NULL,in UTF-16LE format.
+ // Return value:
+ // None.
+ void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_FILEHANDLER* fileHandler,
+ FPDF_WIDESTRING pTo,
+ FPDF_WIDESTRING pSubject,
+ FPDF_WIDESTRING pCC,
+ FPDF_WIDESTRING pBcc,
+ FPDF_WIDESTRING pMsg);
+
+ // Method: FFI_UploadTo
+ // This method will upload the specified file stream to the
+ // specified URL.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // pFileHandler - Handle to the FPDF_FILEHANDLER.
+ // fileFlag - The file flag. Please refer to macro definition
+ // of FXFA_SAVEAS_XXX and use one of these macros.
+ // uploadTo - Pointer to the URL path, in UTF-16LE format.
+ // Return value:
+ // None.
+ void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_FILEHANDLER* fileHandler,
+ int fileFlag,
+ FPDF_WIDESTRING uploadTo);
+
+ // Method: FFI_GetPlatform
+ // This method will get the current platform.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // platform - Pointer to the data buffer to receive the
+ // platform,in UTF-16LE format. Can be NULL.
+ // length - The length of the buffer in bytes. Can be
+ // 0 to query the required size.
+ // Return value:
+ // The length of the buffer, number of bytes.
+ int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis,
+ void* platform,
+ int length);
+
+ // Method: FFI_GetLanguage
+ // This method will get the current language.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // language - Pointer to the data buffer to receive the
+ // current language. Can be NULL.
+ // length - The length of the buffer in bytes. Can be
+ // 0 to query the required size.
+ // Return value:
+ // The length of the buffer, number of bytes.
+ int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis,
+ void* language,
+ int length);
+
+ // Method: FFI_DownloadFromURL
+ // This method will download the specified file from the URL.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // URL - The string value of the file URL, in UTF-16LE
+ // format.
+ // Return value:
+ // The handle to FPDF_FILEHANDLER.
+ FPDF_FILEHANDLER* (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_WIDESTRING URL);
+ // Method: FFI_PostRequestURL
+ // This method will post the request to the server URL.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // wsURL - The string value of the server URL, in UTF-16LE
+ // format.
+ // wsData - The post data,in UTF-16LE format.
+ // wsContentType - The content type of the request data, in
+ // UTF-16LE format.
+ // wsEncode - The encode type, in UTF-16LE format.
+ // wsHeader - The request header,in UTF-16LE format.
+ // response - Pointer to the FPDF_BSTR to receive the response
+ // data from the server, in UTF-16LE format.
+ // Return value:
+ // TRUE indicates success, otherwise FALSE.
+ FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_WIDESTRING wsURL,
+ FPDF_WIDESTRING wsData,
+ FPDF_WIDESTRING wsContentType,
+ FPDF_WIDESTRING wsEncode,
+ FPDF_WIDESTRING wsHeader,
+ FPDF_BSTR* response);
+
+ // Method: FFI_PutRequestURL
+ // This method will put the request to the server URL.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // Required for XFA, otherwise set to NULL.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself.
+ // wsURL - The string value of the server URL, in UTF-16LE
+ // format.
+ // wsData - The put data, in UTF-16LE format.
+ // wsEncode - The encode type, in UTR-16LE format.
+ // Return value:
+ // TRUE indicates success, otherwise FALSE.
+ FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
+ FPDF_WIDESTRING wsURL,
+ FPDF_WIDESTRING wsData,
+ FPDF_WIDESTRING wsEncode);
+
+ // Method: FFI_OnFocusChange
+ // Called when the focused annotation is updated.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // No
+ // Parameters:
+ // param - Pointer to the interface structure itself.
+ // annot - The focused annotation.
+ // page_index - Index number of the page which contains the
+ // focused annotation. 0 for the first page.
+ // Return value:
+ // None.
+ // Comments:
+ // This callback function is useful for implementing any view based
+ // action such as scrolling the annotation rect into view. The
+ // embedder should not copy and store the annot as its scope is
+ // limited to this call only.
+ void (*FFI_OnFocusChange)(struct _FPDF_FORMFILLINFO* param,
+ FPDF_ANNOTATION annot,
+ int page_index);
+
+ // Method: FFI_DoURIActionWithKeyboardModifier
+ // Ask the implementation to navigate to a uniform resource identifier
+ // with the specified modifiers.
+ // Interface Version:
+ // Ignored if |version| < 2.
+ // Implementation Required:
+ // No
+ // Parameters:
+ // param - Pointer to the interface structure itself.
+ // uri - A byte string which indicates the uniform
+ // resource identifier, terminated by 0.
+ // modifiers - Keyboard modifier that indicates which of
+ // the virtual keys are down, if any.
+ // Return value:
+ // None.
+ // Comments:
+ // If the embedder who is version 2 and does not implement this API,
+ // then a call will be redirected to FFI_DoURIAction.
+ // See the URI actions description of <>
+ // for more details.
+ void(*FFI_DoURIActionWithKeyboardModifier)(struct _FPDF_FORMFILLINFO* param,
+ FPDF_BYTESTRING uri,
+ int modifiers);
+} FPDF_FORMFILLINFO;
+
+// Function: FPDFDOC_InitFormFillEnvironment
+// Initialize form fill environment.
+// Parameters:
+// document - Handle to document from FPDF_LoadDocument().
+// formInfo - Pointer to a FPDF_FORMFILLINFO structure.
+// Return Value:
+// Handle to the form fill module, or NULL on failure.
+// Comments:
+// This function should be called before any form fill operation.
+// The FPDF_FORMFILLINFO passed in via |formInfo| must remain valid until
+// the returned FPDF_FORMHANDLE is closed.
+FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV
+FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
+ FPDF_FORMFILLINFO* formInfo);
+
+// Function: FPDFDOC_ExitFormFillEnvironment
+// Take ownership of |hHandle| and exit form fill environment.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// None.
+// Comments:
+// This function is a no-op when |hHandle| is null.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle);
+
+// Function: FORM_OnAfterLoadPage
+// This method is required for implementing all the form related
+// functions. Should be invoked after user successfully loaded a
+// PDF page, and FPDFDOC_InitFormFillEnvironment() has been invoked.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page,
+ FPDF_FORMHANDLE hHandle);
+
+// Function: FORM_OnBeforeClosePage
+// This method is required for implementing all the form related
+// functions. Should be invoked before user closes the PDF page.
+// Parameters:
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page,
+ FPDF_FORMHANDLE hHandle);
+
+// Function: FORM_DoDocumentJSAction
+// This method is required for performing document-level JavaScript
+// actions. It should be invoked after the PDF document has been loaded.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// None.
+// Comments:
+// If there is document-level JavaScript action embedded in the
+// document, this method will execute the JavaScript action. Otherwise,
+// the method will do nothing.
+FPDF_EXPORT void FPDF_CALLCONV
+FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
+
+// Function: FORM_DoDocumentOpenAction
+// This method is required for performing open-action when the document
+// is opened.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// None.
+// Comments:
+// This method will do nothing if there are no open-actions embedded
+// in the document.
+FPDF_EXPORT void FPDF_CALLCONV
+FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
+
+// Additional actions type of document:
+// WC, before closing document, JavaScript action.
+// WS, before saving document, JavaScript action.
+// DS, after saving document, JavaScript action.
+// WP, before printing document, JavaScript action.
+// DP, after printing document, JavaScript action.
+#define FPDFDOC_AACTION_WC 0x10
+#define FPDFDOC_AACTION_WS 0x11
+#define FPDFDOC_AACTION_DS 0x12
+#define FPDFDOC_AACTION_WP 0x13
+#define FPDFDOC_AACTION_DP 0x14
+
+// Function: FORM_DoDocumentAAction
+// This method is required for performing the document's
+// additional-action.
+// Parameters:
+// hHandle - Handle to the form fill module. Returned by
+// FPDFDOC_InitFormFillEnvironment.
+// aaType - The type of the additional-actions which defined
+// above.
+// Return Value:
+// None.
+// Comments:
+// This method will do nothing if there is no document
+// additional-action corresponding to the specified |aaType|.
+FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
+ int aaType);
+
+// Additional-action types of page object:
+// OPEN (/O) -- An action to be performed when the page is opened
+// CLOSE (/C) -- An action to be performed when the page is closed
+#define FPDFPAGE_AACTION_OPEN 0
+#define FPDFPAGE_AACTION_CLOSE 1
+
+// Function: FORM_DoPageAAction
+// This method is required for performing the page object's
+// additional-action when opened or closed.
+// Parameters:
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// aaType - The type of the page object's additional-actions
+// which defined above.
+// Return Value:
+// None.
+// Comments:
+// This method will do nothing if no additional-action corresponding
+// to the specified |aaType| exists.
+FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
+ FPDF_FORMHANDLE hHandle,
+ int aaType);
+
+// Function: FORM_OnMouseMove
+// Call this member function when the mouse cursor moves.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// modifier - Indicates whether various virtual keys are down.
+// page_x - Specifies the x-coordinate of the cursor in PDF user
+// space.
+// page_y - Specifies the y-coordinate of the cursor in PDF user
+// space.
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+
+// Experimental API
+// Function: FORM_OnMouseWheel
+// Call this member function when the user scrolls the mouse wheel.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// modifier - Indicates whether various virtual keys are down.
+// page_coord - Specifies the coordinates of the cursor in PDF user
+// space.
+// delta_x - Specifies the amount of wheel movement on the x-axis,
+// in units of platform-agnostic wheel deltas. Negative
+// values mean left.
+// delta_y - Specifies the amount of wheel movement on the y-axis,
+// in units of platform-agnostic wheel deltas. Negative
+// values mean down.
+// Return Value:
+// True indicates success; otherwise false.
+// Comments:
+// For |delta_x| and |delta_y|, the caller must normalize
+// platform-specific wheel deltas. e.g. On Windows, a delta value of 240
+// for a WM_MOUSEWHEEL event normalizes to 2, since Windows defines
+// WHEEL_DELTA as 120.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseWheel(
+ FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ const FS_POINTF* page_coord,
+ int delta_x,
+ int delta_y);
+
+// Function: FORM_OnFocus
+// This function focuses the form annotation at a given point. If the
+// annotation at the point already has focus, nothing happens. If there
+// is no annotation at the point, removes form focus.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// modifier - Indicates whether various virtual keys are down.
+// page_x - Specifies the x-coordinate of the cursor in PDF user
+// space.
+// page_y - Specifies the y-coordinate of the cursor in PDF user
+// space.
+// Return Value:
+// True if there is an annotation at the given point and it has focus.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+
+// Function: FORM_OnLButtonDown
+// Call this member function when the user presses the left
+// mouse button.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// modifier - Indicates whether various virtual keys are down.
+// page_x - Specifies the x-coordinate of the cursor in PDF user
+// space.
+// page_y - Specifies the y-coordinate of the cursor in PDF user
+// space.
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+
+// Function: FORM_OnRButtonDown
+// Same as above, execpt for the right mouse button.
+// Comments:
+// At the present time, has no effect except in XFA builds, but is
+// included for the sake of symmetry.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+// Function: FORM_OnLButtonUp
+// Call this member function when the user releases the left
+// mouse button.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// modifier - Indicates whether various virtual keys are down.
+// page_x - Specifies the x-coordinate of the cursor in device.
+// page_y - Specifies the y-coordinate of the cursor in device.
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+
+// Function: FORM_OnRButtonUp
+// Same as above, execpt for the right mouse button.
+// Comments:
+// At the present time, has no effect except in XFA builds, but is
+// included for the sake of symmetry.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+
+// Function: FORM_OnLButtonDoubleClick
+// Call this member function when the user double clicks the
+// left mouse button.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// modifier - Indicates whether various virtual keys are down.
+// page_x - Specifies the x-coordinate of the cursor in PDF user
+// space.
+// page_y - Specifies the y-coordinate of the cursor in PDF user
+// space.
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int modifier,
+ double page_x,
+ double page_y);
+
+// Function: FORM_OnKeyDown
+// Call this member function when a nonsystem key is pressed.
+// Parameters:
+// hHandle - Handle to the form fill module, aseturned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// nKeyCode - The virtual-key code of the given key (see
+// fpdf_fwlevent.h for virtual key codes).
+// modifier - Mask of key flags (see fpdf_fwlevent.h for key
+// flag values).
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int nKeyCode,
+ int modifier);
+
+// Function: FORM_OnKeyUp
+// Call this member function when a nonsystem key is released.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// nKeyCode - The virtual-key code of the given key (see
+// fpdf_fwlevent.h for virtual key codes).
+// modifier - Mask of key flags (see fpdf_fwlevent.h for key
+// flag values).
+// Return Value:
+// True indicates success; otherwise false.
+// Comments:
+// Currently unimplemented and always returns false. PDFium reserves this
+// API and may implement it in the future on an as-needed basis.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int nKeyCode,
+ int modifier);
+
+// Function: FORM_OnChar
+// Call this member function when a keystroke translates to a
+// nonsystem character.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// nChar - The character code value itself.
+// modifier - Mask of key flags (see fpdf_fwlevent.h for key
+// flag values).
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int nChar,
+ int modifier);
+
+// Experimental API
+// Function: FORM_GetFocusedText
+// Call this function to obtain the text within the current focused
+// field, if any.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// buffer - Buffer for holding the form text, encoded in
+// UTF-16LE. If NULL, |buffer| is not modified.
+// buflen - Length of |buffer| in bytes. If |buflen| is less
+// than the length of the form text string, |buffer| is
+// not modified.
+// Return Value:
+// Length in bytes for the text in the focused field.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FORM_GetFocusedText(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FORM_GetSelectedText
+// Call this function to obtain selected text within a form text
+// field or form combobox text field.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// buffer - Buffer for holding the selected text, encoded in
+// UTF-16LE. If NULL, |buffer| is not modified.
+// buflen - Length of |buffer| in bytes. If |buflen| is less
+// than the length of the selected text string,
+// |buffer| is not modified.
+// Return Value:
+// Length in bytes of selected text in form text field or form combobox
+// text field.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FORM_GetSelectedText(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API
+// Function: FORM_ReplaceAndKeepSelection
+// Call this function to replace the selected text in a form
+// text field or user-editable form combobox text field with another
+// text string (which can be empty or non-empty). If there is no
+// selected text, this function will append the replacement text after
+// the current caret position. After the insertion, the inserted text
+// will be selected.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as Returned by FPDF_LoadPage().
+// wsText - The text to be inserted, in UTF-16LE format.
+// Return Value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV
+FORM_ReplaceAndKeepSelection(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ FPDF_WIDESTRING wsText);
+
+// Function: FORM_ReplaceSelection
+// Call this function to replace the selected text in a form
+// text field or user-editable form combobox text field with another
+// text string (which can be empty or non-empty). If there is no
+// selected text, this function will append the replacement text after
+// the current caret position. After the insertion, the selection range
+// will be set to empty.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as Returned by FPDF_LoadPage().
+// wsText - The text to be inserted, in UTF-16LE format.
+// Return Value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ FPDF_WIDESTRING wsText);
+
+// Experimental API
+// Function: FORM_SelectAllText
+// Call this function to select all the text within the currently focused
+// form text field or form combobox text field.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// Return Value:
+// Whether the operation succeeded or not.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_SelectAllText(FPDF_FORMHANDLE hHandle, FPDF_PAGE page);
+
+// Function: FORM_CanUndo
+// Find out if it is possible for the current focused widget in a given
+// form to perform an undo operation.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// Return Value:
+// True if it is possible to undo.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page);
+
+// Function: FORM_CanRedo
+// Find out if it is possible for the current focused widget in a given
+// form to perform a redo operation.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// Return Value:
+// True if it is possible to redo.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page);
+
+// Function: FORM_Undo
+// Make the current focused widget perform an undo operation.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// Return Value:
+// True if the undo operation succeeded.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page);
+
+// Function: FORM_Redo
+// Make the current focused widget perform a redo operation.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// Return Value:
+// True if the redo operation succeeded.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page);
+
+// Function: FORM_ForceToKillFocus.
+// Call this member function to force to kill the focus of the form
+// field which has focus. If it would kill the focus of a form field,
+// save the value of form field if was changed by theuser.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// True indicates success; otherwise false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
+
+// Experimental API.
+// Function: FORM_GetFocusedAnnot.
+// Call this member function to get the currently focused annotation.
+// Parameters:
+// handle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page_index - Buffer to hold the index number of the page which
+// contains the focused annotation. 0 for the first page.
+// Can't be NULL.
+// annot - Buffer to hold the focused annotation. Can't be NULL.
+// Return Value:
+// On success, return true and write to the out parameters. Otherwise
+// return false and leave the out parameters unmodified.
+// Comments:
+// Not currently supported for XFA forms - will report no focused
+// annotation.
+// Must call FPDFPage_CloseAnnot() when the annotation returned in |annot|
+// by this function is no longer needed.
+// This will return true and set |page_index| to -1 and |annot| to NULL,
+// if there is no focused annotation.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_GetFocusedAnnot(FPDF_FORMHANDLE handle,
+ int* page_index,
+ FPDF_ANNOTATION* annot);
+
+// Experimental API.
+// Function: FORM_SetFocusedAnnot.
+// Call this member function to set the currently focused annotation.
+// Parameters:
+// handle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// annot - Handle to an annotation.
+// Return Value:
+// True indicates success; otherwise false.
+// Comments:
+// |annot| can't be NULL. To kill focus, use FORM_ForceToKillFocus()
+// instead.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_SetFocusedAnnot(FPDF_FORMHANDLE handle, FPDF_ANNOTATION annot);
+
+// Form Field Types
+// The names of the defines are stable, but the specific values associated with
+// them are not, so do not hardcode their values.
+#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown.
+#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type.
+#define FPDF_FORMFIELD_CHECKBOX 2 // check box type.
+#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type.
+#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type.
+#define FPDF_FORMFIELD_LISTBOX 5 // list box type.
+#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type.
+#define FPDF_FORMFIELD_SIGNATURE 7 // text field type.
+#ifdef PDF_ENABLE_XFA
+#define FPDF_FORMFIELD_XFA 8 // Generic XFA type.
+#define FPDF_FORMFIELD_XFA_CHECKBOX 9 // XFA check box type.
+#define FPDF_FORMFIELD_XFA_COMBOBOX 10 // XFA combo box type.
+#define FPDF_FORMFIELD_XFA_IMAGEFIELD 11 // XFA image field type.
+#define FPDF_FORMFIELD_XFA_LISTBOX 12 // XFA list box type.
+#define FPDF_FORMFIELD_XFA_PUSHBUTTON 13 // XFA push button type.
+#define FPDF_FORMFIELD_XFA_SIGNATURE 14 // XFA signture field type.
+#define FPDF_FORMFIELD_XFA_TEXTFIELD 15 // XFA text field type.
+#endif // PDF_ENABLE_XFA
+
+#ifdef PDF_ENABLE_XFA
+#define FPDF_FORMFIELD_COUNT 16
+#else // PDF_ENABLE_XFA
+#define FPDF_FORMFIELD_COUNT 8
+#endif // PDF_ENABLE_XFA
+
+#ifdef PDF_ENABLE_XFA
+#define IS_XFA_FORMFIELD(type) \
+ (((type) == FPDF_FORMFIELD_XFA) || \
+ ((type) == FPDF_FORMFIELD_XFA_CHECKBOX) || \
+ ((type) == FPDF_FORMFIELD_XFA_COMBOBOX) || \
+ ((type) == FPDF_FORMFIELD_XFA_IMAGEFIELD) || \
+ ((type) == FPDF_FORMFIELD_XFA_LISTBOX) || \
+ ((type) == FPDF_FORMFIELD_XFA_PUSHBUTTON) || \
+ ((type) == FPDF_FORMFIELD_XFA_SIGNATURE) || \
+ ((type) == FPDF_FORMFIELD_XFA_TEXTFIELD))
+#endif // PDF_ENABLE_XFA
+
+// Function: FPDFPage_HasFormFieldAtPoint
+// Get the form field type by point.
+// Parameters:
+// hHandle - Handle to the form fill module. Returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page. Returned by FPDF_LoadPage().
+// page_x - X position in PDF "user space".
+// page_y - Y position in PDF "user space".
+// Return Value:
+// Return the type of the form field; -1 indicates no field.
+// See field types above.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ double page_x,
+ double page_y);
+
+// Function: FPDFPage_FormFieldZOrderAtPoint
+// Get the form field z-order by point.
+// Parameters:
+// hHandle - Handle to the form fill module. Returned by
+// FPDFDOC_InitFormFillEnvironment().
+// page - Handle to the page. Returned by FPDF_LoadPage().
+// page_x - X position in PDF "user space".
+// page_y - Y position in PDF "user space".
+// Return Value:
+// Return the z-order of the form field; -1 indicates no field.
+// Higher numbers are closer to the front.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ double page_x,
+ double page_y);
+
+// Function: FPDF_SetFormFieldHighlightColor
+// Set the highlight color of the specified (or all) form fields
+// in the document.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// doc - Handle to the document, as returned by
+// FPDF_LoadDocument().
+// fieldType - A 32-bit integer indicating the type of a form
+// field (defined above).
+// color - The highlight color of the form field. Constructed by
+// 0xxxrrggbb.
+// Return Value:
+// None.
+// Comments:
+// When the parameter fieldType is set to FPDF_FORMFIELD_UNKNOWN, the
+// highlight color will be applied to all the form fields in the
+// document.
+// Please refresh the client window to show the highlight immediately
+// if necessary.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle,
+ int fieldType,
+ unsigned long color);
+
+// Function: FPDF_SetFormFieldHighlightAlpha
+// Set the transparency of the form field highlight color in the
+// document.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// doc - Handle to the document, as returaned by
+// FPDF_LoadDocument().
+// alpha - The transparency of the form field highlight color,
+// between 0-255.
+// Return Value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
+
+// Function: FPDF_RemoveFormFieldHighlight
+// Remove the form field highlight color in the document.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// Return Value:
+// None.
+// Comments:
+// Please refresh the client window to remove the highlight immediately
+// if necessary.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
+
+// Function: FPDF_FFLDraw
+// Render FormFields and popup window on a page to a device independent
+// bitmap.
+// Parameters:
+// hHandle - Handle to the form fill module, as returned by
+// FPDFDOC_InitFormFillEnvironment().
+// bitmap - Handle to the device independent bitmap (as the
+// output buffer). Bitmap handles can be created by
+// FPDFBitmap_Create().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// start_x - Left pixel position of the display area in the
+// device coordinates.
+// start_y - Top pixel position of the display area in the device
+// coordinates.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
+// clockwise), 2 (rotated 180 degrees), 3 (rotated 90
+// degrees counter-clockwise).
+// flags - 0 for normal display, or combination of flags
+// defined above.
+// Return Value:
+// None.
+// Comments:
+// This function is designed to render annotations that are
+// user-interactive, which are widget annotations (for FormFields) and
+// popup annotations.
+// With the FPDF_ANNOT flag, this function will render a popup annotation
+// when users mouse-hover on a non-widget annotation. Regardless of
+// FPDF_ANNOT flag, this function will always render widget annotations
+// for FormFields.
+// In order to implement the FormFill functions, implementation should
+// call this function after rendering functions, such as
+// FPDF_RenderPageBitmap() or FPDF_RenderPageBitmap_Start(), have
+// finished rendering the page contents.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
+ FPDF_BITMAP bitmap,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags);
+
+#if defined(PDF_USE_SKIA)
+FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDrawSkia(FPDF_FORMHANDLE hHandle,
+ FPDF_SKIA_CANVAS canvas,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags);
+#endif
+
+// Experimental API
+// Function: FPDF_GetFormType
+// Returns the type of form contained in the PDF document.
+// Parameters:
+// document - Handle to document.
+// Return Value:
+// Integer value representing one of the FORMTYPE_ values.
+// Comments:
+// If |document| is NULL, then the return value is FORMTYPE_NONE.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document);
+
+// Experimental API
+// Function: FORM_SetIndexSelected
+// Selects/deselects the value at the given |index| of the focused
+// annotation.
+// Parameters:
+// hHandle - Handle to the form fill module. Returned by
+// FPDFDOC_InitFormFillEnvironment.
+// page - Handle to the page. Returned by FPDF_LoadPage
+// index - 0-based index of value to be set as
+// selected/unselected
+// selected - true to select, false to deselect
+// Return Value:
+// TRUE if the operation succeeded.
+// FALSE if the operation failed or widget is not a supported type.
+// Comments:
+// Intended for use with listbox/combobox widget types. Comboboxes
+// have at most a single value selected at a time which cannot be
+// deselected. Deselect on a combobox is a no-op that returns false.
+// Default implementation is a no-op that will return false for
+// other types.
+// Not currently supported for XFA forms - will return false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_SetIndexSelected(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ int index,
+ FPDF_BOOL selected);
+
+// Experimental API
+// Function: FORM_IsIndexSelected
+// Returns whether or not the value at |index| of the focused
+// annotation is currently selected.
+// Parameters:
+// hHandle - Handle to the form fill module. Returned by
+// FPDFDOC_InitFormFillEnvironment.
+// page - Handle to the page. Returned by FPDF_LoadPage
+// index - 0-based Index of value to check
+// Return Value:
+// TRUE if value at |index| is currently selected.
+// FALSE if value at |index| is not selected or widget is not a
+// supported type.
+// Comments:
+// Intended for use with listbox/combobox widget types. Default
+// implementation is a no-op that will return false for other types.
+// Not currently supported for XFA forms - will return false.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FORM_IsIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index);
+
+// Function: FPDF_LoadXFA
+// If the document consists of XFA fields, call this method to
+// attempt to load XFA fields.
+// Parameters:
+// document - Handle to document from FPDF_LoadDocument().
+// Return Value:
+// TRUE upon success, otherwise FALSE. If XFA support is not built
+// into PDFium, performs no action and always returns FALSE.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PUBLIC_FPDF_FORMFILL_H_
diff --git a/src/main/jni/include/fpdf_fwlevent.h b/src/main/jni/include/fpdf_fwlevent.h
index f77e7e39..e61606d3 100644
--- a/src/main/jni/include/fpdf_fwlevent.h
+++ b/src/main/jni/include/fpdf_fwlevent.h
@@ -1,98 +1,54 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FWL_EVENT_H
-#define _FWL_EVENT_H
+#ifndef PUBLIC_FPDF_FWLEVENT_H_
+#define PUBLIC_FPDF_FWLEVENT_H_
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-typedef int FPDF_INT32;
-typedef unsigned int FPDF_UINT32;
-typedef float FPDF_FLOAT;
-//event type
-typedef enum
-{
- FWL_EVENTTYPE_Mouse = 0 ,
- FWL_EVENTTYPE_MouseWheel,
- FWL_EVENTTYPE_Key ,
-} FWL_EVENTTYPE;
-
-//key flag
-typedef enum
-{
- FWL_EVENTFLAG_ShiftKey = 1 << 0,
- FWL_EVENTFLAG_ControlKey = 1 << 1,
- FWL_EVENTFLAG_AltKey = 1 << 2,
- FWL_EVENTFLAG_MetaKey = 1 << 3,
- FWL_EVENTFLAG_KeyPad = 1 << 4,
- FWL_EVENTFLAG_AutoRepeat = 1 << 5,
- FWL_EVENTFLAG_LeftButtonDown = 1 << 6,
- FWL_EVENTFLAG_MiddleButtonDown = 1 << 7,
- FWL_EVENTFLAG_RightButtonDown = 1 << 8,
-} FWL_EVENTFLAG;
-
-// Mouse message command
-typedef enum
-{
- FWL_EVENTMOUSECMD_LButtonDown = 1 ,
- FWL_EVENTMOUSECMD_LButtonUp ,
- FWL_EVENTMOUSECMD_LButtonDblClk ,
- FWL_EVENTMOUSECMD_RButtonDown ,
- FWL_EVENTMOUSECMD_RButtonUp ,
- FWL_EVENTMOUSECMD_RButtonDblClk ,
- FWL_EVENTMOUSECMD_MButtonDown ,
- FWL_EVENTMOUSECMD_MButtonUp ,
- FWL_EVENTMOUSECMD_MButtonDblClk ,
- FWL_EVENTMOUSECMD_MouseMove ,
- FWL_EVENTMOUSECMD_MouseEnter ,
- FWL_EVENTMOUSECMD_MouseHover ,
- FWL_EVENTMOUSECMD_MouseLeave ,
-} FWL_EVENT_MOUSECMD;
-
-//mouse event
-struct FWL_EVENT_MOUSE
-{
- FPDF_UINT32 command;
- FPDF_DWORD flag;
- FPDF_FLOAT x;
- FPDF_FLOAT y;
-};
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
-//mouse wheel
-struct FWL_EVENT_MOUSEWHEEL
-{
- FPDF_DWORD flag;
- FPDF_FLOAT x;
- FPDF_FLOAT y;
- FPDF_FLOAT deltaX;
- FPDF_FLOAT deltaY;
-};
+// Key flags.
+typedef enum {
+ FWL_EVENTFLAG_ShiftKey = 1 << 0,
+ FWL_EVENTFLAG_ControlKey = 1 << 1,
+ FWL_EVENTFLAG_AltKey = 1 << 2,
+ FWL_EVENTFLAG_MetaKey = 1 << 3,
+ FWL_EVENTFLAG_KeyPad = 1 << 4,
+ FWL_EVENTFLAG_AutoRepeat = 1 << 5,
+ FWL_EVENTFLAG_LeftButtonDown = 1 << 6,
+ FWL_EVENTFLAG_MiddleButtonDown = 1 << 7,
+ FWL_EVENTFLAG_RightButtonDown = 1 << 8,
+} FWL_EVENTFLAG;
-//virtual keycode
-typedef enum
-{
- FWL_VKEY_Back = 0x08,
- FWL_VKEY_Tab = 0x09,
- FWL_VKEY_Clear = 0x0C,
- FWL_VKEY_Return = 0x0D,
- FWL_VKEY_Shift = 0x10,
- FWL_VKEY_Control = 0x11,
- FWL_VKEY_Menu = 0x12,
- FWL_VKEY_Pause = 0x13,
- FWL_VKEY_Capital = 0x14,
- FWL_VKEY_Kana = 0x15,
- FWL_VKEY_Hangul = 0x15,
- FWL_VKEY_Junja = 0x17,
- FWL_VKEY_Final = 0x18,
- FWL_VKEY_Hanja = 0x19,
- FWL_VKEY_Kanji = 0x19,
- FWL_VKEY_Escape = 0x1B,
- FWL_VKEY_Convert = 0x1C,
+// Virtual keycodes.
+typedef enum {
+ FWL_VKEY_Back = 0x08,
+ FWL_VKEY_Tab = 0x09,
+ FWL_VKEY_NewLine = 0x0A,
+ FWL_VKEY_Clear = 0x0C,
+ FWL_VKEY_Return = 0x0D,
+ FWL_VKEY_Shift = 0x10,
+ FWL_VKEY_Control = 0x11,
+ FWL_VKEY_Menu = 0x12,
+ FWL_VKEY_Pause = 0x13,
+ FWL_VKEY_Capital = 0x14,
+ FWL_VKEY_Kana = 0x15,
+ FWL_VKEY_Hangul = 0x15,
+ FWL_VKEY_Junja = 0x17,
+ FWL_VKEY_Final = 0x18,
+ FWL_VKEY_Hanja = 0x19,
+ FWL_VKEY_Kanji = 0x19,
+ FWL_VKEY_Escape = 0x1B,
+ FWL_VKEY_Convert = 0x1C,
FWL_VKEY_NonConvert = 0x1D,
- FWL_VKEY_Accept = 0x1E,
+ FWL_VKEY_Accept = 0x1E,
FWL_VKEY_ModeChange = 0x1F,
FWL_VKEY_Space = 0x20,
FWL_VKEY_Prior = 0x21,
@@ -244,43 +200,8 @@ typedef enum
FWL_VKEY_Unknown = 0,
} FWL_VKEYCODE;
-//key event command
-typedef enum
-{
- FWL_EVENTKEYCMD_KeyDown = 1 ,
- FWL_EVENTKEYCMD_KeyUp ,
- FWL_EVENTKEYCMD_Char ,
-} FWL_EVENTKEYCMD;
-
-//key event
-struct FWL_EVENT_KEY
-{
- FPDF_UINT32 command;
- FPDF_DWORD flag;
- union
- {
- //Virtual key code.
- FPDF_UINT32 vkcode;
- //Character code.
- FPDF_DWORD charcode;
- }code;
-};
-
-//event type
-struct FWL_EVENT
-{
- //structure size.
- FPDF_UINT32 size;
- //FWL_EVENTTYPE.
- FPDF_UINT32 type;
- union
- {
- struct FWL_EVENT_MOUSE mouse;
- struct FWL_EVENT_MOUSEWHEEL wheel;
- struct FWL_EVENT_KEY key;
- }s;
-};
-
-#endif //_FWL_EVENT_H
-
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+#endif // PUBLIC_FPDF_FWLEVENT_H_
diff --git a/src/main/jni/include/fpdf_javascript.h b/src/main/jni/include/fpdf_javascript.h
new file mode 100644
index 00000000..2b024056
--- /dev/null
+++ b/src/main/jni/include/fpdf_javascript.h
@@ -0,0 +1,77 @@
+// Copyright 2019 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_FPDF_JAVASCRIPT_H_
+#define PUBLIC_FPDF_JAVASCRIPT_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Experimental API.
+// Get the number of JavaScript actions in |document|.
+//
+// document - handle to a document.
+//
+// Returns the number of JavaScript actions in |document| or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFDoc_GetJavaScriptActionCount(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Get the JavaScript action at |index| in |document|.
+//
+// document - handle to a document.
+// index - the index of the requested JavaScript action.
+//
+// Returns the handle to the JavaScript action, or NULL on failure.
+// Caller owns the returned handle and must close it with
+// FPDFDoc_CloseJavaScriptAction().
+FPDF_EXPORT FPDF_JAVASCRIPT_ACTION FPDF_CALLCONV
+FPDFDoc_GetJavaScriptAction(FPDF_DOCUMENT document, int index);
+
+// Experimental API.
+// Close a loaded FPDF_JAVASCRIPT_ACTION object.
+
+// javascript - Handle to a JavaScript action.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDFDoc_CloseJavaScriptAction(FPDF_JAVASCRIPT_ACTION javascript);
+
+// Experimental API.
+// Get the name from the |javascript| handle. |buffer| is only modified if
+// |buflen| is longer than the length of the name. On errors, |buffer| is
+// unmodified and the returned length is 0.
+//
+// javascript - handle to an JavaScript action.
+// buffer - buffer for holding the name, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the JavaScript action name in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFJavaScriptAction_GetName(FPDF_JAVASCRIPT_ACTION javascript,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Get the script from the |javascript| handle. |buffer| is only modified if
+// |buflen| is longer than the length of the script. On errors, |buffer| is
+// unmodified and the returned length is 0.
+//
+// javascript - handle to an JavaScript action.
+// buffer - buffer for holding the name, encoded in UTF-16LE.
+// buflen - length of the buffer in bytes.
+//
+// Returns the length of the JavaScript action name in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFJavaScriptAction_GetScript(FPDF_JAVASCRIPT_ACTION javascript,
+ FPDF_WCHAR* buffer,
+ unsigned long buflen);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_JAVASCRIPT_H_
diff --git a/src/main/jni/include/fpdf_ppo.h b/src/main/jni/include/fpdf_ppo.h
new file mode 100644
index 00000000..1734bc68
--- /dev/null
+++ b/src/main/jni/include/fpdf_ppo.h
@@ -0,0 +1,115 @@
+// Copyright 2014 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_PPO_H_
+#define PUBLIC_FPDF_PPO_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Experimental API.
+// Import pages to a FPDF_DOCUMENT.
+//
+// dest_doc - The destination document for the pages.
+// src_doc - The document to be imported.
+// page_indices - An array of page indices to be imported. The first page is
+// zero. If |page_indices| is NULL, all pages from |src_doc|
+// are imported.
+// length - The length of the |page_indices| array.
+// index - The page index at which to insert the first imported page
+// into |dest_doc|. The first page is zero.
+//
+// Returns TRUE on success. Returns FALSE if any pages in |page_indices| is
+// invalid.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_ImportPagesByIndex(FPDF_DOCUMENT dest_doc,
+ FPDF_DOCUMENT src_doc,
+ const int* page_indices,
+ unsigned long length,
+ int index);
+
+// Import pages to a FPDF_DOCUMENT.
+//
+// dest_doc - The destination document for the pages.
+// src_doc - The document to be imported.
+// pagerange - A page range string, Such as "1,3,5-7". The first page is one.
+// If |pagerange| is NULL, all pages from |src_doc| are imported.
+// index - The page index at which to insert the first imported page into
+// |dest_doc|. The first page is zero.
+//
+// Returns TRUE on success. Returns FALSE if any pages in |pagerange| is
+// invalid or if |pagerange| cannot be read.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
+ FPDF_DOCUMENT src_doc,
+ FPDF_BYTESTRING pagerange,
+ int index);
+
+// Experimental API.
+// Create a new document from |src_doc|. The pages of |src_doc| will be
+// combined to provide |num_pages_on_x_axis x num_pages_on_y_axis| pages per
+// |output_doc| page.
+//
+// src_doc - The document to be imported.
+// output_width - The output page width in PDF "user space" units.
+// output_height - The output page height in PDF "user space" units.
+// num_pages_on_x_axis - The number of pages on X Axis.
+// num_pages_on_y_axis - The number of pages on Y Axis.
+//
+// Return value:
+// A handle to the created document, or NULL on failure.
+//
+// Comments:
+// number of pages per page = num_pages_on_x_axis * num_pages_on_y_axis
+//
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
+FPDF_ImportNPagesToOne(FPDF_DOCUMENT src_doc,
+ float output_width,
+ float output_height,
+ size_t num_pages_on_x_axis,
+ size_t num_pages_on_y_axis);
+
+// Experimental API.
+// Create a template to generate form xobjects from |src_doc|'s page at
+// |src_page_index|, for use in |dest_doc|.
+//
+// Returns a handle on success, or NULL on failure. Caller owns the newly
+// created object.
+FPDF_EXPORT FPDF_XOBJECT FPDF_CALLCONV
+FPDF_NewXObjectFromPage(FPDF_DOCUMENT dest_doc,
+ FPDF_DOCUMENT src_doc,
+ int src_page_index);
+
+// Experimental API.
+// Close an FPDF_XOBJECT handle created by FPDF_NewXObjectFromPage().
+// FPDF_PAGEOBJECTs created from the FPDF_XOBJECT handle are not affected.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseXObject(FPDF_XOBJECT xobject);
+
+// Experimental API.
+// Create a new form object from an FPDF_XOBJECT object.
+//
+// Returns a new form object on success, or NULL on failure. Caller owns the
+// newly created object.
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDF_NewFormObjectFromXObject(FPDF_XOBJECT xobject);
+
+// Copy the viewer preferences from |src_doc| into |dest_doc|.
+//
+// dest_doc - Document to write the viewer preferences into.
+// src_doc - Document to read the viewer preferences from.
+//
+// Returns TRUE on success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_PPO_H_
diff --git a/src/main/jni/include/fpdf_progressive.h b/src/main/jni/include/fpdf_progressive.h
index 029264ea..0505a54b 100644
--- a/src/main/jni/include/fpdf_progressive.h
+++ b/src/main/jni/include/fpdf_progressive.h
@@ -1,94 +1,155 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FPDF_PROGRESSIVE_H_
-#define _FPDF_PROGRESSIVE_H_
+#ifndef PUBLIC_FPDF_PROGRESSIVE_H_
+#define PUBLIC_FPDF_PROGRESSIVE_H_
+// clang-format off
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-//Flags for progressive process status.
-#define FPDF_RENDER_READER 0
-#define FPDF_RENDER_TOBECOUNTINUED 1
-#define FPDF_RENDER_DONE 2
-#define FPDF_RENDER_FAILED 3
-
+// Flags for progressive process status.
+#define FPDF_RENDER_READY 0
+#define FPDF_RENDER_TOBECONTINUED 1
+#define FPDF_RENDER_DONE 2
+#define FPDF_RENDER_FAILED 3
#ifdef __cplusplus
extern "C" {
#endif
+// IFPDF_RENDERINFO interface.
+typedef struct _IFSDK_PAUSE {
+ // Version number of the interface. Currently must be 1.
+ int version;
-//IFPDF_RENDERINFO interface.
-typedef struct _IFSDK_PAUSE
-{
- /**
- * Version number of the interface. Currently must be 1.
- **/
- int version;
+ // Method: NeedToPauseNow
+ // Check if we need to pause a progressive process now.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // Return Value:
+ // Non-zero for pause now, 0 for continue.
+ FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis);
- /*
- * Method: NeedToPauseNow
- * Check if we need to pause a progressive process now.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * Return Value:
- * Non-zero for pause now, 0 for continue.
- *
- */
- FPDF_BOOL (*NeedToPauseNow) (struct _IFSDK_PAUSE* pThis);
-
- //A user defined data pointer, used by user's application. Can be NULL.
- void* user;
+ // A user defined data pointer, used by user's application. Can be NULL.
+ void* user;
} IFSDK_PAUSE;
+// Experimental API.
+// Function: FPDF_RenderPageBitmapWithColorScheme_Start
+// Start to render page contents to a device independent bitmap
+// progressively with a specified color scheme for the content.
+// Parameters:
+// bitmap - Handle to the device independent bitmap (as the
+// output buffer). Bitmap handle can be created by
+// FPDFBitmap_Create function.
+// page - Handle to the page as returned by FPDF_LoadPage
+// function.
+// start_x - Left pixel position of the display area in the
+// bitmap coordinate.
+// start_y - Top pixel position of the display area in the
+// bitmap coordinate.
+// size_x - Horizontal size (in pixels) for displaying the
+// page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90
+// degrees clockwise), 2 (rotated 180 degrees),
+// 3 (rotated 90 degrees counter-clockwise).
+// flags - 0 for normal display, or combination of flags
+// defined in fpdfview.h. With FPDF_ANNOT flag, it
+// renders all annotations that does not require
+// user-interaction, which are all annotations except
+// widget and popup annotations.
+// color_scheme - Color scheme to be used in rendering the |page|.
+// If null, this function will work similar to
+// FPDF_RenderPageBitmap_Start().
+// pause - The IFSDK_PAUSE interface. A callback mechanism
+// allowing the page rendering process.
+// Return value:
+// Rendering Status. See flags for progressive process status for the
+// details.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_RenderPageBitmapWithColorScheme_Start(FPDF_BITMAP bitmap,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags,
+ const FPDF_COLORSCHEME* color_scheme,
+ IFSDK_PAUSE* pause);
+
// Function: FPDF_RenderPageBitmap_Start
-// Start to render page contents to a device independent bitmap progressively.
-// Parameters:
-// bitmap - Handle to the device independent bitmap (as the output buffer).
-// Bitmap handle can be created by FPDFBitmap_Create function.
-// page - Handle to the page. Returned by FPDF_LoadPage function.
-// start_x - Left pixel position of the display area in the bitmap coordinate.
-// start_y - Top pixel position of the display area in the bitmap coordinate.
-// size_x - Horizontal size (in pixels) for displaying the page.
-// size_y - Vertical size (in pixels) for displaying the page.
-// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
-// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
-// flags - 0 for normal display, or combination of flags defined above.
-// pause - The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process
+// Start to render page contents to a device independent bitmap
+// progressively.
+// Parameters:
+// bitmap - Handle to the device independent bitmap (as the
+// output buffer). Bitmap handle can be created by
+// FPDFBitmap_Create().
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// start_x - Left pixel position of the display area in the
+// bitmap coordinates.
+// start_y - Top pixel position of the display area in the bitmap
+// coordinates.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
+// clockwise), 2 (rotated 180 degrees), 3 (rotated 90
+// degrees counter-clockwise).
+// flags - 0 for normal display, or combination of flags
+// defined in fpdfview.h. With FPDF_ANNOT flag, it
+// renders all annotations that does not require
+// user-interaction, which are all annotations except
+// widget and popup annotations.
+// pause - The IFSDK_PAUSE interface.A callback mechanism
+// allowing the page rendering process
// Return value:
-// Rendering Status. See flags for progressive process status for the details.
-//
-DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x,
- int size_y, int rotate, int flags,IFSDK_PAUSE * pause);
+// Rendering Status. See flags for progressive process status for the
+// details.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags,
+ IFSDK_PAUSE* pause);
// Function: FPDF_RenderPage_Continue
-// Continue rendering a PDF page.
-// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function.
-// pause - The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process
-// to be paused before it's finished. This can be NULL if you don't want to pause.
+// Continue rendering a PDF page.
+// Parameters:
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// pause - The IFSDK_PAUSE interface (a callback mechanism
+// allowing the page rendering process to be paused
+// before it's finished). This can be NULL if you
+// don't want to pause.
// Return value:
-// The rendering status. See flags for progressive process status for the details.
-DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause);
+// The rendering status. See flags for progressive process status for
+// the details.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page,
+ IFSDK_PAUSE* pause);
// Function: FPDF_RenderPage_Close
-// Release the resource allocate during page rendering. Need to be called after finishing rendering or
-// cancel the rendering.
-// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function.
+// Release the resource allocate during page rendering. Need to be
+// called after finishing rendering or
+// cancel the rendering.
+// Parameters:
+// page - Handle to the page, as returned by FPDF_LoadPage().
// Return value:
-// NULL
-DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page);
#ifdef __cplusplus
}
#endif
-#endif //_FPDF_PROGRESSIVE_H_
+#endif // PUBLIC_FPDF_PROGRESSIVE_H_
diff --git a/src/main/jni/include/fpdf_save.h b/src/main/jni/include/fpdf_save.h
new file mode 100644
index 00000000..800d4e75
--- /dev/null
+++ b/src/main/jni/include/fpdf_save.h
@@ -0,0 +1,85 @@
+// Copyright 2014 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_SAVE_H_
+#define PUBLIC_FPDF_SAVE_H_
+
+// clang-format off
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Structure for custom file write
+typedef struct FPDF_FILEWRITE_ {
+ //
+ // Version number of the interface. Currently must be 1.
+ //
+ int version;
+
+ // Method: WriteBlock
+ // Output a block of data in your custom way.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Yes
+ // Comments:
+ // Called by function FPDF_SaveDocument
+ // Parameters:
+ // pThis - Pointer to the structure itself
+ // pData - Pointer to a buffer to output
+ // size - The size of the buffer.
+ // Return value:
+ // Should be non-zero if successful, zero for error.
+ int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis,
+ const void* pData,
+ unsigned long size);
+} FPDF_FILEWRITE;
+
+ // Flags for FPDF_SaveAsCopy()
+#define FPDF_INCREMENTAL 1
+#define FPDF_NO_INCREMENTAL 2
+#define FPDF_REMOVE_SECURITY 3
+
+// Function: FPDF_SaveAsCopy
+// Saves the copy of specified document in custom way.
+// Parameters:
+// document - Handle to document, as returned by
+// FPDF_LoadDocument() or FPDF_CreateNewDocument().
+// pFileWrite - A pointer to a custom file write structure.
+// flags - The creating flags.
+// Return value:
+// TRUE for succeed, FALSE for failed.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SaveAsCopy(FPDF_DOCUMENT document,
+ FPDF_FILEWRITE* pFileWrite,
+ FPDF_DWORD flags);
+
+// Function: FPDF_SaveWithVersion
+// Same as FPDF_SaveAsCopy(), except the file version of the
+// saved document can be specified by the caller.
+// Parameters:
+// document - Handle to document.
+// pFileWrite - A pointer to a custom file write structure.
+// flags - The creating flags.
+// fileVersion - The PDF file version. File version: 14 for 1.4,
+// 15 for 1.5, ...
+// Return value:
+// TRUE if succeed, FALSE if failed.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_SaveWithVersion(FPDF_DOCUMENT document,
+ FPDF_FILEWRITE* pFileWrite,
+ FPDF_DWORD flags,
+ int fileVersion);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PUBLIC_FPDF_SAVE_H_
diff --git a/src/main/jni/include/fpdf_searchex.h b/src/main/jni/include/fpdf_searchex.h
index d70dddc9..9c980dbe 100644
--- a/src/main/jni/include/fpdf_searchex.h
+++ b/src/main/jni/include/fpdf_searchex.h
@@ -1,33 +1,39 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FPDF_SEARCH_EX_H
-#define _FPDF_SEARCH_EX_H
-
-#ifndef _FPDFVIEW_H_
+#ifndef PUBLIC_FPDF_SEARCHEX_H_
+#define PUBLIC_FPDF_SEARCHEX_H_
+
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-#endif
#ifdef __cplusplus
extern "C" {
-#endif
+#endif // __cplusplus
-// Function: FPDFText_GetCharIndexFromTextIndex
-// Get the actually char index in text_page's internal char list.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// nTextIndex - The index of the text in the string get from FPDFText_GetText.
-// Return value:
-// The index of the character in internal charlist. -1 for error.
-DLLEXPORT int STDCALL FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
+// Get the character index in |text_page| internal character list.
+//
+// text_page - a text page information structure.
+// nTextIndex - index of the text returned from FPDFText_GetText().
+//
+// Returns the index of the character in internal character list. -1 for error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
-#ifdef __cplusplus
-};
-#endif
+// Get the text index in |text_page| internal character list.
+//
+// text_page - a text page information structure.
+// nCharIndex - index of the character in internal character list.
+//
+// Returns the index of the text returned from FPDFText_GetText(). -1 for error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex);
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
-#endif
-
+#endif // PUBLIC_FPDF_SEARCHEX_H_
diff --git a/src/main/jni/include/fpdf_signature.h b/src/main/jni/include/fpdf_signature.h
new file mode 100644
index 00000000..9a075e5f
--- /dev/null
+++ b/src/main/jni/include/fpdf_signature.h
@@ -0,0 +1,155 @@
+// Copyright 2020 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_FPDF_SIGNATURE_H_
+#define PUBLIC_FPDF_SIGNATURE_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Experimental API.
+// Function: FPDF_GetSignatureCount
+// Get total number of signatures in the document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument().
+// Return value:
+// Total number of signatures in the document on success, -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_GetSignatureCount(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Function: FPDF_GetSignatureObject
+// Get the Nth signature of the document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument().
+// index - Index into the array of signatures of the document.
+// Return value:
+// Returns the handle to the signature, or NULL on failure. The caller
+// does not take ownership of the returned FPDF_SIGNATURE. Instead, it
+// remains valid until FPDF_CloseDocument() is called for the document.
+FPDF_EXPORT FPDF_SIGNATURE FPDF_CALLCONV
+FPDF_GetSignatureObject(FPDF_DOCUMENT document, int index);
+
+// Experimental API.
+// Function: FPDFSignatureObj_GetContents
+// Get the contents of a signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// buffer - The address of a buffer that receives the contents.
+// length - The size, in bytes, of |buffer|.
+// Return value:
+// Returns the number of bytes in the contents on success, 0 on error.
+//
+// For public-key signatures, |buffer| is either a DER-encoded PKCS#1 binary or
+// a DER-encoded PKCS#7 binary. If |length| is less than the returned length, or
+// |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFSignatureObj_GetContents(FPDF_SIGNATURE signature,
+ void* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Function: FPDFSignatureObj_GetByteRange
+// Get the byte range of a signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// buffer - The address of a buffer that receives the
+// byte range.
+// length - The size, in ints, of |buffer|.
+// Return value:
+// Returns the number of ints in the byte range on
+// success, 0 on error.
+//
+// |buffer| is an array of pairs of integers (starting byte offset,
+// length in bytes) that describes the exact byte range for the digest
+// calculation. If |length| is less than the returned length, or
+// |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFSignatureObj_GetByteRange(FPDF_SIGNATURE signature,
+ int* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Function: FPDFSignatureObj_GetSubFilter
+// Get the encoding of the value of a signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// buffer - The address of a buffer that receives the encoding.
+// length - The size, in bytes, of |buffer|.
+// Return value:
+// Returns the number of bytes in the encoding name (including the
+// trailing NUL character) on success, 0 on error.
+//
+// The |buffer| is always encoded in 7-bit ASCII. If |length| is less than the
+// returned length, or |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFSignatureObj_GetSubFilter(FPDF_SIGNATURE signature,
+ char* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Function: FPDFSignatureObj_GetReason
+// Get the reason (comment) of the signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// buffer - The address of a buffer that receives the reason.
+// length - The size, in bytes, of |buffer|.
+// Return value:
+// Returns the number of bytes in the reason on success, 0 on error.
+//
+// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The
+// string is terminated by a UTF16 NUL character. If |length| is less than the
+// returned length, or |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFSignatureObj_GetReason(FPDF_SIGNATURE signature,
+ void* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Function: FPDFSignatureObj_GetTime
+// Get the time of signing of a signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// buffer - The address of a buffer that receives the time.
+// length - The size, in bytes, of |buffer|.
+// Return value:
+// Returns the number of bytes in the encoding name (including the
+// trailing NUL character) on success, 0 on error.
+//
+// The |buffer| is always encoded in 7-bit ASCII. If |length| is less than the
+// returned length, or |buffer| is NULL, |buffer| will not be modified.
+//
+// The format of time is expected to be D:YYYYMMDDHHMMSS+XX'YY', i.e. it's
+// percision is seconds, with timezone information. This value should be used
+// only when the time of signing is not available in the (PKCS#7 binary)
+// signature.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFSignatureObj_GetTime(FPDF_SIGNATURE signature,
+ char* buffer,
+ unsigned long length);
+
+// Experimental API.
+// Function: FPDFSignatureObj_GetDocMDPPermission
+// Get the DocMDP permission of a signature object.
+// Parameters:
+// signature - Handle to the signature object. Returned by
+// FPDF_GetSignatureObject().
+// Return value:
+// Returns the permission (1, 2 or 3) on success, 0 on error.
+FPDF_EXPORT unsigned int FPDF_CALLCONV
+FPDFSignatureObj_GetDocMDPPermission(FPDF_SIGNATURE signature);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // PUBLIC_FPDF_SIGNATURE_H_
diff --git a/src/main/jni/include/fpdf_structtree.h b/src/main/jni/include/fpdf_structtree.h
new file mode 100644
index 00000000..ea67fefd
--- /dev/null
+++ b/src/main/jni/include/fpdf_structtree.h
@@ -0,0 +1,524 @@
+// Copyright 2016 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_STRUCTTREE_H_
+#define PUBLIC_FPDF_STRUCTTREE_H_
+
+// clang-format off
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDF_StructTree_GetForPage
+// Get the structure tree for a page.
+// Parameters:
+// page - Handle to the page, as returned by FPDF_LoadPage().
+// Return value:
+// A handle to the structure tree or NULL on error. The caller owns the
+// returned handle and must use FPDF_StructTree_Close() to release it.
+// The handle should be released before |page| gets released.
+FPDF_EXPORT FPDF_STRUCTTREE FPDF_CALLCONV
+FPDF_StructTree_GetForPage(FPDF_PAGE page);
+
+// Function: FPDF_StructTree_Close
+// Release a resource allocated by FPDF_StructTree_GetForPage().
+// Parameters:
+// struct_tree - Handle to the structure tree, as returned by
+// FPDF_StructTree_LoadPage().
+// Return value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
+
+// Function: FPDF_StructTree_CountChildren
+// Count the number of children for the structure tree.
+// Parameters:
+// struct_tree - Handle to the structure tree, as returned by
+// FPDF_StructTree_LoadPage().
+// Return value:
+// The number of children, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
+
+// Function: FPDF_StructTree_GetChildAtIndex
+// Get a child in the structure tree.
+// Parameters:
+// struct_tree - Handle to the structure tree, as returned by
+// FPDF_StructTree_LoadPage().
+// index - The index for the child, 0-based.
+// Return value:
+// The child at the n-th index or NULL on error. The caller does not
+// own the handle. The handle remains valid as long as |struct_tree|
+// remains valid.
+// Comments:
+// The |index| must be less than the FPDF_StructTree_CountChildren()
+// return value.
+FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
+FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
+
+// Function: FPDF_StructElement_GetAltText
+// Get the alt text for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output the alt text. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the alt text, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetActualText
+// Get the actual text for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output the actual text. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the actual text, including the terminating
+// NUL character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetActualText(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FPDF_StructElement_GetID
+// Get the ID for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output the ID string. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the ID string, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetID(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetLang
+// Get the case-insensitive IETF BCP 47 language code for an element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output the lang string. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the ID string, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetLang(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetStringAttribute
+// Get a struct element attribute of type "name" or "string".
+// Parameters:
+// struct_element - Handle to the struct element.
+// attr_name - The name of the attribute to retrieve.
+// buffer - A buffer for output. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the attribute value, including the
+// terminating NUL character. The number of bytes is returned
+// regardless of the |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetStringAttribute(FPDF_STRUCTELEMENT struct_element,
+ FPDF_BYTESTRING attr_name,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FPDF_StructElement_GetMarkedContentID
+// Get the marked content ID for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// Return value:
+// The marked content ID of the element. If no ID exists, returns
+// -1.
+// Comments:
+// FPDF_StructElement_GetMarkedContentIdAtIndex() may be able to
+// extract more marked content IDs out of |struct_element|. This API
+// may be deprecated in the future.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_GetMarkedContentID(FPDF_STRUCTELEMENT struct_element);
+
+// Function: FPDF_StructElement_GetType
+// Get the type (/S) for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the type, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetObjType
+// Get the object type (/Type) for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the object type, including the terminating
+// NUL character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetObjType(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FPDF_StructElement_GetTitle
+// Get the title (/T) for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// buffer - A buffer for output. May be NULL.
+// buflen - The length of the buffer, in bytes. May be 0.
+// Return value:
+// The number of bytes in the title, including the terminating NUL
+// character. The number of bytes is returned regardless of the
+// |buffer| and |buflen| parameters.
+// Comments:
+// Regardless of the platform, the |buffer| is always in UTF-16LE
+// encoding. The string is terminated by a UTF16 NUL character. If
+// |buflen| is less than the required length, or |buffer| is NULL,
+// |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FPDF_StructElement_CountChildren
+// Count the number of children for the structure element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// Return value:
+// The number of children, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
+
+// Function: FPDF_StructElement_GetChildAtIndex
+// Get a child in the structure element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// index - The index for the child, 0-based.
+// Return value:
+// The child at the n-th index or NULL on error.
+// Comments:
+// If the child exists but is not an element, then this function will
+// return NULL. This will also return NULL for out of bounds indices.
+// The |index| must be less than the FPDF_StructElement_CountChildren()
+// return value.
+FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
+FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
+ int index);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetChildMarkedContentID
+// Get the child's content id
+// Parameters:
+// struct_element - Handle to the struct element.
+// index - The index for the child, 0-based.
+// Return value:
+// The marked content ID of the child. If no ID exists, returns -1.
+// Comments:
+// If the child exists but is not a stream or object, then this
+// function will return -1. This will also return -1 for out of bounds
+// indices. Compared to FPDF_StructElement_GetMarkedContentIdAtIndex,
+// it is scoped to the current page.
+// The |index| must be less than the FPDF_StructElement_CountChildren()
+// return value.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_GetChildMarkedContentID(FPDF_STRUCTELEMENT struct_element,
+ int index);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetParent
+// Get the parent of the structure element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// Return value:
+// The parent structure element or NULL on error.
+// Comments:
+// If structure element is StructTreeRoot, then this function will
+// return NULL.
+FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
+FPDF_StructElement_GetParent(FPDF_STRUCTELEMENT struct_element);
+
+// Function: FPDF_StructElement_GetAttributeCount
+// Count the number of attributes for the structure element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// Return value:
+// The number of attributes, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_GetAttributeCount(FPDF_STRUCTELEMENT struct_element);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetAttributeAtIndex
+// Get an attribute object in the structure element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// index - The index for the attribute object, 0-based.
+// Return value:
+// The attribute object at the n-th index or NULL on error.
+// Comments:
+// If the attribute object exists but is not a dict, then this
+// function will return NULL. This will also return NULL for out of
+// bounds indices. The caller does not own the handle. The handle
+// remains valid as long as |struct_element| remains valid.
+// The |index| must be less than the
+// FPDF_StructElement_GetAttributeCount() return value.
+FPDF_EXPORT FPDF_STRUCTELEMENT_ATTR FPDF_CALLCONV
+FPDF_StructElement_GetAttributeAtIndex(FPDF_STRUCTELEMENT struct_element, int index);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetCount
+// Count the number of attributes in a structure element attribute map.
+// Parameters:
+// struct_attribute - Handle to the struct element attribute.
+// Return value:
+// The number of attributes, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_Attr_GetCount(FPDF_STRUCTELEMENT_ATTR struct_attribute);
+
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetName
+// Get the name of an attribute in a structure element attribute map.
+// Parameters:
+// struct_attribute - Handle to the struct element attribute.
+// index - The index of attribute in the map.
+// buffer - A buffer for output. May be NULL. This is only
+// modified if |buflen| is longer than the length
+// of the key. Optional, pass null to just
+// retrieve the size of the buffer needed.
+// buflen - The length of the buffer.
+// out_buflen - A pointer to variable that will receive the
+// minimum buffer size to contain the key. Not
+// filled if FALSE is returned.
+// Return value:
+// TRUE if the operation was successful, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_StructElement_Attr_GetName(FPDF_STRUCTELEMENT_ATTR struct_attribute,
+ int index,
+ void* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetValue
+// Get a handle to a value for an attribute in a structure element
+// attribute map.
+// Parameters:
+// struct_attribute - Handle to the struct element attribute.
+// name - The attribute name.
+// Return value:
+// Returns a handle to the value associated with the input, if any.
+// Returns NULL on failure. The caller does not own the handle.
+// The handle remains valid as long as |struct_attribute| remains
+// valid.
+FPDF_EXPORT FPDF_STRUCTELEMENT_ATTR_VALUE FPDF_CALLCONV
+FPDF_StructElement_Attr_GetValue(FPDF_STRUCTELEMENT_ATTR struct_attribute,
+ FPDF_BYTESTRING name);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetType
+// Get the type of an attribute in a structure element attribute map.
+// Parameters:
+// value - Handle to the value.
+// Return value:
+// Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of
+// failure. Note that this will never return FPDF_OBJECT_REFERENCE, as
+// references are always dereferenced.
+FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV
+FPDF_StructElement_Attr_GetType(FPDF_STRUCTELEMENT_ATTR_VALUE value);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetBooleanValue
+// Get the value of a boolean attribute in an attribute map as
+// FPDF_BOOL. FPDF_StructElement_Attr_GetType() should have returned
+// FPDF_OBJECT_BOOLEAN for this property.
+// Parameters:
+// value - Handle to the value.
+// out_value - A pointer to variable that will receive the value. Not
+// filled if false is returned.
+// Return value:
+// Returns TRUE if the attribute maps to a boolean value, FALSE
+// otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_StructElement_Attr_GetBooleanValue(FPDF_STRUCTELEMENT_ATTR_VALUE value,
+ FPDF_BOOL* out_value);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetNumberValue
+// Get the value of a number attribute in an attribute map as float.
+// FPDF_StructElement_Attr_GetType() should have returned
+// FPDF_OBJECT_NUMBER for this property.
+// Parameters:
+// value - Handle to the value.
+// out_value - A pointer to variable that will receive the value. Not
+// filled if false is returned.
+// Return value:
+// Returns TRUE if the attribute maps to a number value, FALSE
+// otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_StructElement_Attr_GetNumberValue(FPDF_STRUCTELEMENT_ATTR_VALUE value,
+ float* out_value);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetStringValue
+// Get the value of a string attribute in an attribute map as string.
+// FPDF_StructElement_Attr_GetType() should have returned
+// FPDF_OBJECT_STRING or FPDF_OBJECT_NAME for this property.
+// Parameters:
+// value - Handle to the value.
+// buffer - A buffer for holding the returned key in UTF-16LE.
+// This is only modified if |buflen| is longer than the
+// length of the key. Optional, pass null to just
+// retrieve the size of the buffer needed.
+// buflen - The length of the buffer.
+// out_buflen - A pointer to variable that will receive the minimum
+// buffer size to contain the key. Not filled if FALSE is
+// returned.
+// Return value:
+// Returns TRUE if the attribute maps to a string value, FALSE
+// otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_StructElement_Attr_GetStringValue(FPDF_STRUCTELEMENT_ATTR_VALUE value,
+ void* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetBlobValue
+// Get the value of a blob attribute in an attribute map as string.
+// Parameters:
+// value - Handle to the value.
+// buffer - A buffer for holding the returned value. This is only
+// modified if |buflen| is at least as long as the length
+// of the value. Optional, pass null to just retrieve the
+// size of the buffer needed.
+// buflen - The length of the buffer.
+// out_buflen - A pointer to variable that will receive the minimum
+// buffer size to contain the key. Not filled if FALSE is
+// returned.
+// Return value:
+// Returns TRUE if the attribute maps to a string value, FALSE
+// otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_StructElement_Attr_GetBlobValue(FPDF_STRUCTELEMENT_ATTR_VALUE value,
+ void* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_CountChildren
+// Count the number of children values in an attribute.
+// Parameters:
+// value - Handle to the value.
+// Return value:
+// The number of children, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_Attr_CountChildren(FPDF_STRUCTELEMENT_ATTR_VALUE value);
+
+// Experimental API.
+// Function: FPDF_StructElement_Attr_GetChildAtIndex
+// Get a child from an attribute.
+// Parameters:
+// value - Handle to the value.
+// index - The index for the child, 0-based.
+// Return value:
+// The child at the n-th index or NULL on error.
+// Comments:
+// The |index| must be less than the
+// FPDF_StructElement_Attr_CountChildren() return value.
+FPDF_EXPORT FPDF_STRUCTELEMENT_ATTR_VALUE FPDF_CALLCONV
+FPDF_StructElement_Attr_GetChildAtIndex(FPDF_STRUCTELEMENT_ATTR_VALUE value,
+ int index);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetMarkedContentIdCount
+// Get the count of marked content ids for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// Return value:
+// The count of marked content ids or -1 if none exists.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_GetMarkedContentIdCount(FPDF_STRUCTELEMENT struct_element);
+
+// Experimental API.
+// Function: FPDF_StructElement_GetMarkedContentIdAtIndex
+// Get the marked content id at a given index for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// index - The index of the marked content id, 0-based.
+// Return value:
+// The marked content ID of the element. If no ID exists, returns
+// -1.
+// Comments:
+// The |index| must be less than the
+// FPDF_StructElement_GetMarkedContentIdCount() return value.
+// This will likely supersede FPDF_StructElement_GetMarkedContentID().
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_StructElement_GetMarkedContentIdAtIndex(FPDF_STRUCTELEMENT struct_element,
+ int index);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // PUBLIC_FPDF_STRUCTTREE_H_
diff --git a/src/main/jni/include/fpdf_sysfontinfo.h b/src/main/jni/include/fpdf_sysfontinfo.h
index 00c9fab0..2dac855a 100644
--- a/src/main/jni/include/fpdf_sysfontinfo.h
+++ b/src/main/jni/include/fpdf_sysfontinfo.h
@@ -1,241 +1,317 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FPDF_SYSFONTINFO_H
-#define _FPDF_SYSFONTINFO_H
+#ifndef PUBLIC_FPDF_SYSFONTINFO_H_
+#define PUBLIC_FPDF_SYSFONTINFO_H_
+
+#include
+// clang-format off
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
-/* Character sets for the font */
-#define FXFONT_ANSI_CHARSET 0
-#define FXFONT_DEFAULT_CHARSET 1
-#define FXFONT_SYMBOL_CHARSET 2
-#define FXFONT_SHIFTJIS_CHARSET 128
-#define FXFONT_HANGEUL_CHARSET 129
-#define FXFONT_GB2312_CHARSET 134
-#define FXFONT_CHINESEBIG5_CHARSET 136
+// Character sets for the font
+#define FXFONT_ANSI_CHARSET 0
+#define FXFONT_DEFAULT_CHARSET 1
+#define FXFONT_SYMBOL_CHARSET 2
+#define FXFONT_SHIFTJIS_CHARSET 128
+#define FXFONT_HANGEUL_CHARSET 129
+#define FXFONT_GB2312_CHARSET 134
+#define FXFONT_CHINESEBIG5_CHARSET 136
+#define FXFONT_GREEK_CHARSET 161
+#define FXFONT_VIETNAMESE_CHARSET 163
+#define FXFONT_HEBREW_CHARSET 177
+#define FXFONT_ARABIC_CHARSET 178
+#define FXFONT_CYRILLIC_CHARSET 204
+#define FXFONT_THAI_CHARSET 222
+#define FXFONT_EASTERNEUROPEAN_CHARSET 238
-/* Font pitch and family flags */
-#define FXFONT_FF_FIXEDPITCH 1
-#define FXFONT_FF_ROMAN (1<<4)
-#define FXFONT_FF_SCRIPT (4<<4)
+// Font pitch and family flags
+#define FXFONT_FF_FIXEDPITCH (1 << 0)
+#define FXFONT_FF_ROMAN (1 << 4)
+#define FXFONT_FF_SCRIPT (4 << 4)
-/* Typical weight values */
-#define FXFONT_FW_NORMAL 400
-#define FXFONT_FW_BOLD 700
+// Typical weight values
+#define FXFONT_FW_NORMAL 400
+#define FXFONT_FW_BOLD 700
// Exported Functions
#ifdef __cplusplus
extern "C" {
#endif
-
-/**
- * Interface: FPDF_SYSFONTINFO
- * Interface for getting system font information and font mapping
- */
+// Interface: FPDF_SYSFONTINFO
+// Interface for getting system font information and font mapping
typedef struct _FPDF_SYSFONTINFO {
- /**
- * Version number of the interface. Currently must be 1.
- **/
- int version;
-
- /**
- * Method: Release
- * Give implementation a chance to release any data after the interface is no longer used
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Comments:
- * Called by Foxit SDK during the final cleanup process.
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * Return Value:
- * None
- */
- void (*Release)(struct _FPDF_SYSFONTINFO* pThis);
-
- /**
- * Method: EnumFonts
- * Enumerate all fonts installed on the system
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Comments:
- * Implementation should call FPDF_AddIntalledFont() function for each font found.
- * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * pMapper - An opaque pointer to internal font mapper, used when calling FPDF_AddInstalledFont
- * Return Value:
- * None
- */
- void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper);
-
- /**
- * Method: MapFont
- * Use the system font mapper to get a font handle from requested parameters
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes only if GetFont method is not implemented.
- * Comments:
- * If the system supports native font mapper (like Windows), implementation can implement this method to get a font handle.
- * Otherwise, Foxit SDK will do the mapping and then call GetFont method.
- * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * weight - Weight of the requested font. 400 is normal and 700 is bold.
- * bItalic - Italic option of the requested font, TRUE or FALSE.
- * charset - Character set identifier for the requested font. See above defined constants.
- * pitch_family - A combination of flags. See above defined constants.
- * face - Typeface name. Currently use system local encoding only.
- * bExact - Pointer to an boolean value receiving the indicator whether mapper found the exact match.
- * If mapper is not sure whether it's exact match, ignore this paramter.
- * Return Value:
- * An opaque pointer for font handle, or NULL if system mapping is not supported.
- **/
- void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, int weight, int bItalic, int charset, int pitch_family,
- const char* face, int* bExact);
-
- /**
- * Method: GetFont
- * Get a handle to a particular font by its internal ID
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes only if MapFont method is not implemented.
- * Comments:
- * If the system mapping not supported, Foxit SDK will do the font mapping and use this method to get a font handle.
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * face - Typeface name. Currently use system local encoding only.
- * Return Value:
- * An opaque pointer for font handle.
- **/
- void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face);
-
- /**
- * Method: GetFontData
- * Get font data from a font
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes
- * Comments:
- * Can read either full font file, or a particular TrueType/OpenType table
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * hFont - Font handle returned by MapFont or GetFont method
- * table - TrueType/OpenType table identifier (refer to TrueType specification).
- * 0 for the whole font file.
- * buffer - The buffer receiving the font data. Can be NULL if not provided
- * buf_size - Buffer size, can be zero if not provided
- * Return Value:
- * Number of bytes needed, if buffer not provided or not large enough,
- * or number of bytes written into buffer otherwise.
- **/
- unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, void* hFont,
- unsigned int table, unsigned char* buffer, unsigned long buf_size);
-
- /**
- * Method: GetFaceName
- * Get face name from a font handle
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * hFont - Font handle returned by MapFont or GetFont method
- * buffer - The buffer receiving the face name. Can be NULL if not provided
- * buf_size - Buffer size, can be zero if not provided
- * Return Value:
- * Number of bytes needed, if buffer not provided or not large enough,
- * or number of bytes written into buffer otherwise.
- **/
- unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, void* hFont, char* buffer, unsigned long buf_size);
-
- /**
- * Method: GetFontCharset
- * Get character set information for a font handle
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * hFont - Font handle returned by MapFont or GetFont method
- * Return Value:
- * Character set identifier. See defined constants above.
- **/
- int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
-
- /**
- * Method: DeleteFont
- * Delete a font handle
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * hFont - Font handle returned by MapFont or GetFont method
- * Return Value:
- * None
- **/
- void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
+ // Version number of the interface. Currently must be 1.
+ int version;
+
+ // Method: Release
+ // Give implementation a chance to release any data after the
+ // interface is no longer used.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // Return Value:
+ // None
+ // Comments:
+ // Called by PDFium during the final cleanup process.
+ void (*Release)(struct _FPDF_SYSFONTINFO* pThis);
+
+ // Method: EnumFonts
+ // Enumerate all fonts installed on the system
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // pMapper - An opaque pointer to internal font mapper, used
+ // when calling FPDF_AddInstalledFont().
+ // Return Value:
+ // None
+ // Comments:
+ // Implementations should call FPDF_AddInstalledFont() function for
+ // each font found. Only TrueType/OpenType and Type1 fonts are
+ // accepted by PDFium.
+ void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper);
+
+ // Method: MapFont
+ // Use the system font mapper to get a font handle from requested
+ // parameters.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Required if GetFont method is not implemented.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // weight - Weight of the requested font. 400 is normal and
+ // 700 is bold.
+ // bItalic - Italic option of the requested font, TRUE or
+ // FALSE.
+ // charset - Character set identifier for the requested font.
+ // See above defined constants.
+ // pitch_family - A combination of flags. See above defined
+ // constants.
+ // face - Typeface name. Currently use system local encoding
+ // only.
+ // bExact - Obsolete: this parameter is now ignored.
+ // Return Value:
+ // An opaque pointer for font handle, or NULL if system mapping is
+ // not supported.
+ // Comments:
+ // If the system supports native font mapper (like Windows),
+ // implementation can implement this method to get a font handle.
+ // Otherwise, PDFium will do the mapping and then call GetFont
+ // method. Only TrueType/OpenType and Type1 fonts are accepted
+ // by PDFium.
+ void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis,
+ int weight,
+ FPDF_BOOL bItalic,
+ int charset,
+ int pitch_family,
+ const char* face,
+ FPDF_BOOL* bExact);
+
+ // Method: GetFont
+ // Get a handle to a particular font by its internal ID
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Required if MapFont method is not implemented.
+ // Return Value:
+ // An opaque pointer for font handle.
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // face - Typeface name in system local encoding.
+ // Comments:
+ // If the system mapping not supported, PDFium will do the font
+ // mapping and use this method to get a font handle.
+ void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face);
+
+ // Method: GetFontData
+ // Get font data from a font
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // hFont - Font handle returned by MapFont or GetFont method
+ // table - TrueType/OpenType table identifier (refer to
+ // TrueType specification), or 0 for the whole file.
+ // buffer - The buffer receiving the font data. Can be NULL if
+ // not provided.
+ // buf_size - Buffer size, can be zero if not provided.
+ // Return Value:
+ // Number of bytes needed, if buffer not provided or not large
+ // enough, or number of bytes written into buffer otherwise.
+ // Comments:
+ // Can read either the full font file, or a particular
+ // TrueType/OpenType table.
+ unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis,
+ void* hFont,
+ unsigned int table,
+ unsigned char* buffer,
+ unsigned long buf_size);
+
+ // Method: GetFaceName
+ // Get face name from a font handle
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // hFont - Font handle returned by MapFont or GetFont method
+ // buffer - The buffer receiving the face name. Can be NULL if
+ // not provided
+ // buf_size - Buffer size, can be zero if not provided
+ // Return Value:
+ // Number of bytes needed, if buffer not provided or not large
+ // enough, or number of bytes written into buffer otherwise.
+ unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis,
+ void* hFont,
+ char* buffer,
+ unsigned long buf_size);
+
+ // Method: GetFontCharset
+ // Get character set information for a font handle
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // No
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // hFont - Font handle returned by MapFont or GetFont method
+ // Return Value:
+ // Character set identifier. See defined constants above.
+ int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
+
+ // Method: DeleteFont
+ // Delete a font handle
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Yes
+ // Parameters:
+ // pThis - Pointer to the interface structure itself
+ // hFont - Font handle returned by MapFont or GetFont method
+ // Return Value:
+ // None
+ void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
} FPDF_SYSFONTINFO;
-/**
- * Function: FPDF_AddInstalledFont
- * Add a system font to the list in Foxit SDK.
- * Comments:
- * This function is only called during the system font list building process.
- * Parameters:
- * mapper - Opaque pointer to Foxit font mapper
- * face - The font face name
- * charset - Font character set. See above defined constants.
- * Return Value:
- * None.
- **/
-DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* face, int charset);
-
-/**
- * Function: FPDF_SetSystemFontInfo
- * Set the system font info interface into Foxit SDK
- * Comments:
- * Platform support implementation should implement required methods of FFDF_SYSFONTINFO interface,
- * then call this function during SDK initialization process.
- * Parameters:
- * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure
- * Return Value:
- * None
- **/
-DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
-
-/**
- * Function: FPDF_GetDefaultSystemFontInfo
- * Get default system font info interface for current platform
- * Comments:
- * For some platforms Foxit SDK implement a default version of system font info interface.
- * The default implementation can be used in FPDF_SetSystemFontInfo function.
- * Parameters:
- * None
- * Return Value:
- * Pointer to a FPDF_SYSFONTINFO structure describing the default interface.
- * Or NULL if the platform doesn't have a default interface.
- * Application should call FPDF_FreeMemory to free the returned pointer.
- **/
-DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo();
+// Struct: FPDF_CharsetFontMap
+// Provides the name of a font to use for a given charset value.
+typedef struct FPDF_CharsetFontMap_ {
+ int charset; // Character Set Enum value, see FXFONT_*_CHARSET above.
+ const char* fontname; // Name of default font to use with that charset.
+} FPDF_CharsetFontMap;
+
+// Function: FPDF_GetDefaultTTFMap
+// Returns a pointer to the default character set to TT Font name map. The
+// map is an array of FPDF_CharsetFontMap structs, with its end indicated
+// by a { -1, NULL } entry.
+// Parameters:
+// None.
+// Return Value:
+// Pointer to the Charset Font Map.
+// Note:
+// Once FPDF_GetDefaultTTFMapCount() and FPDF_GetDefaultTTFMapEntry() are no
+// longer experimental, this API will be marked as deprecated.
+// See https://crbug.com/348468114
+FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMap();
+
+// Experimental API.
+//
+// Function: FPDF_GetDefaultTTFMapCount
+// Returns the number of entries in the default character set to TT Font name
+// map.
+// Parameters:
+// None.
+// Return Value:
+// The number of entries in the map.
+FPDF_EXPORT size_t FPDF_CALLCONV FPDF_GetDefaultTTFMapCount();
+
+// Experimental API.
+//
+// Function: FPDF_GetDefaultTTFMapEntry
+// Returns an entry in the default character set to TT Font name map.
+// Parameters:
+// index - The index to the entry in the map to retrieve.
+// Return Value:
+// A pointer to the entry, if it is in the map, or NULL if the index is out
+// of bounds.
+FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV
+FPDF_GetDefaultTTFMapEntry(size_t index);
+
+// Function: FPDF_AddInstalledFont
+// Add a system font to the list in PDFium.
+// Comments:
+// This function is only called during the system font list building
+// process.
+// Parameters:
+// mapper - Opaque pointer to Foxit font mapper
+// face - The font face name
+// charset - Font character set. See above defined constants.
+// Return Value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper,
+ const char* face,
+ int charset);
+
+// Function: FPDF_SetSystemFontInfo
+// Set the system font info interface into PDFium
+// Parameters:
+// pFontInfo - Pointer to a FPDF_SYSFONTINFO structure
+// Return Value:
+// None
+// Comments:
+// Platform support implementation should implement required methods of
+// FFDF_SYSFONTINFO interface, then call this function during PDFium
+// initialization process.
+//
+// Call this with NULL to tell PDFium to stop using a previously set
+// |FPDF_SYSFONTINFO|.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
+
+// Function: FPDF_GetDefaultSystemFontInfo
+// Get default system font info interface for current platform
+// Parameters:
+// None
+// Return Value:
+// Pointer to a FPDF_SYSFONTINFO structure describing the default
+// interface, or NULL if the platform doesn't have a default interface.
+// Application should call FPDF_FreeDefaultSystemFontInfo to free the
+// returned pointer.
+// Comments:
+// For some platforms, PDFium implements a default version of system
+// font info interface. The default implementation can be passed to
+// FPDF_SetSystemFontInfo().
+FPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo();
+
+// Function: FPDF_FreeDefaultSystemFontInfo
+// Free a default system font info interface
+// Parameters:
+// pFontInfo - Pointer to a FPDF_SYSFONTINFO structure
+// Return Value:
+// None
+// Comments:
+// This function should be called on the output from
+// FPDF_GetDefaultSystemFontInfo() once it is no longer needed.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
#ifdef __cplusplus
-};
+}
#endif
-#endif // _FPDF_SYSFONTINFO_H
+#endif // PUBLIC_FPDF_SYSFONTINFO_H_
diff --git a/src/main/jni/include/fpdf_text.h b/src/main/jni/include/fpdf_text.h
new file mode 100644
index 00000000..fe96ccd5
--- /dev/null
+++ b/src/main/jni/include/fpdf_text.h
@@ -0,0 +1,685 @@
+// Copyright 2014 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_TEXT_H_
+#define PUBLIC_FPDF_TEXT_H_
+
+// clang-format off
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFText_LoadPage
+// Prepare information about all characters in a page.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function
+// (in FPDFVIEW module).
+// Return value:
+// A handle to the text page information structure.
+// NULL if something goes wrong.
+// Comments:
+// Application must call FPDFText_ClosePage to release the text page
+// information.
+//
+FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page);
+
+// Function: FPDFText_ClosePage
+// Release all resources allocated for a text page information
+// structure.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// Return Value:
+// None.
+//
+FPDF_EXPORT void FPDF_CALLCONV FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFText_CountChars
+// Get number of characters in a page.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// Return value:
+// Number of characters in the page. Return -1 for error.
+// Generated characters, like additional space characters, new line
+// characters, are also counted.
+// Comments:
+// Characters in a page form a "stream", inside the stream, each
+// character has an index.
+// We will use the index parameters in many of FPDFTEXT functions. The
+// first character in the page
+// has an index value of zero.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountChars(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFText_GetUnicode
+// Get Unicode of a character in a page.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// The Unicode of the particular character.
+// If a character is not encoded in Unicode and Foxit engine can't
+// convert to Unicode,
+// the return value will be zero.
+//
+FPDF_EXPORT unsigned int FPDF_CALLCONV
+FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
+
+// Experimental API.
+// Function: FPDFText_GetTextObject
+// Get the FPDF_PAGEOBJECT associated with a given character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// The associated text object for the character at |index|, or NULL on
+// error. The returned text object, if non-null, is of type
+// |FPDF_PAGEOBJ_TEXT|. The caller does not own the returned object.
+//
+FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+FPDFText_GetTextObject(FPDF_TEXTPAGE text_page, int index);
+
+// Experimental API.
+// Function: FPDFText_IsGenerated
+// Get if a character in a page is generated by PDFium.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// 1 if the character is generated by PDFium.
+// 0 if the character is not generated by PDFium.
+// -1 if there was an error.
+//
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFText_IsGenerated(FPDF_TEXTPAGE text_page, int index);
+
+// Experimental API.
+// Function: FPDFText_IsHyphen
+// Get if a character in a page is a hyphen.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// 1 if the character is a hyphen.
+// 0 if the character is not a hyphen.
+// -1 if there was an error.
+//
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFText_IsHyphen(FPDF_TEXTPAGE text_page, int index);
+
+// Experimental API.
+// Function: FPDFText_HasUnicodeMapError
+// Get if a character in a page has an invalid unicode mapping.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// 1 if the character has an invalid unicode mapping.
+// 0 if the character has no known unicode mapping issues.
+// -1 if there was an error.
+//
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFText_HasUnicodeMapError(FPDF_TEXTPAGE text_page, int index);
+
+// Function: FPDFText_GetFontSize
+// Get the font size of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// The font size of the particular character, measured in points (about
+// 1/72 inch). This is the typographic size of the font (so called
+// "em size").
+//
+FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
+ int index);
+
+// Experimental API.
+// Function: FPDFText_GetFontInfo
+// Get the font name and flags of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// buffer - A buffer receiving the font name.
+// buflen - The length of |buffer| in bytes.
+// flags - Optional pointer to an int receiving the font flags.
+// These flags should be interpreted per PDF spec 1.7
+// Section 5.7.1 Font Descriptor Flags.
+// Return value:
+// On success, return the length of the font name, including the
+// trailing NUL character, in bytes. If this length is less than or
+// equal to |length|, |buffer| is set to the font name, |flags| is
+// set to the font flags. |buffer| is in UTF-8 encoding. Return 0 on
+// failure.
+//
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFText_GetFontInfo(FPDF_TEXTPAGE text_page,
+ int index,
+ void* buffer,
+ unsigned long buflen,
+ int* flags);
+
+// Experimental API.
+// Function: FPDFText_GetFontWeight
+// Get the font weight of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// On success, return the font weight of the particular character. If
+// |text_page| is invalid, if |index| is out of bounds, or if the
+// character's text object is undefined, return -1.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetFontWeight(FPDF_TEXTPAGE text_page,
+ int index);
+
+// Experimental API.
+// Function: FPDFText_GetFillColor
+// Get the fill color of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// R - Pointer to an unsigned int number receiving the
+// red value of the fill color.
+// G - Pointer to an unsigned int number receiving the
+// green value of the fill color.
+// B - Pointer to an unsigned int number receiving the
+// blue value of the fill color.
+// A - Pointer to an unsigned int number receiving the
+// alpha value of the fill color.
+// Return value:
+// Whether the call succeeded. If false, |R|, |G|, |B| and |A| are
+// unchanged.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_GetFillColor(FPDF_TEXTPAGE text_page,
+ int index,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A);
+
+// Experimental API.
+// Function: FPDFText_GetStrokeColor
+// Get the stroke color of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// R - Pointer to an unsigned int number receiving the
+// red value of the stroke color.
+// G - Pointer to an unsigned int number receiving the
+// green value of the stroke color.
+// B - Pointer to an unsigned int number receiving the
+// blue value of the stroke color.
+// A - Pointer to an unsigned int number receiving the
+// alpha value of the stroke color.
+// Return value:
+// Whether the call succeeded. If false, |R|, |G|, |B| and |A| are
+// unchanged.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_GetStrokeColor(FPDF_TEXTPAGE text_page,
+ int index,
+ unsigned int* R,
+ unsigned int* G,
+ unsigned int* B,
+ unsigned int* A);
+
+// Experimental API.
+// Function: FPDFText_GetCharAngle
+// Get character rotation angle.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return Value:
+// On success, return the angle value in radian. Value will always be
+// greater or equal to 0. If |text_page| is invalid, or if |index| is
+// out of bounds, then return -1.
+//
+FPDF_EXPORT float FPDF_CALLCONV FPDFText_GetCharAngle(FPDF_TEXTPAGE text_page,
+ int index);
+
+// Function: FPDFText_GetCharBox
+// Get bounding box of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// left - Pointer to a double number receiving left position
+// of the character box.
+// right - Pointer to a double number receiving right position
+// of the character box.
+// bottom - Pointer to a double number receiving bottom position
+// of the character box.
+// top - Pointer to a double number receiving top position of
+// the character box.
+// Return Value:
+// On success, return TRUE and fill in |left|, |right|, |bottom|, and
+// |top|. If |text_page| is invalid, or if |index| is out of bounds,
+// then return FALSE, and the out parameters remain unmodified.
+// Comments:
+// All positions are measured in PDF "user space".
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
+ int index,
+ double* left,
+ double* right,
+ double* bottom,
+ double* top);
+
+// Experimental API.
+// Function: FPDFText_GetLooseCharBox
+// Get a "loose" bounding box of a particular character, i.e., covering
+// the entire glyph bounds, without taking the actual glyph shape into
+// account.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// rect - Pointer to a FS_RECTF receiving the character box.
+// Return Value:
+// On success, return TRUE and fill in |rect|. If |text_page| is
+// invalid, or if |index| is out of bounds, then return FALSE, and the
+// |rect| out parameter remains unmodified.
+// Comments:
+// All positions are measured in PDF "user space".
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_GetLooseCharBox(FPDF_TEXTPAGE text_page, int index, FS_RECTF* rect);
+
+// Experimental API.
+// Function: FPDFText_GetMatrix
+// Get the effective transformation matrix for a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage().
+// index - Zero-based index of the character.
+// matrix - Pointer to a FS_MATRIX receiving the transformation
+// matrix.
+// Return Value:
+// On success, return TRUE and fill in |matrix|. If |text_page| is
+// invalid, or if |index| is out of bounds, or if |matrix| is NULL,
+// then return FALSE, and |matrix| remains unmodified.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_TEXTPAGE text_page,
+ int index,
+ FS_MATRIX* matrix);
+
+// Function: FPDFText_GetCharOrigin
+// Get origin of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// x - Pointer to a double number receiving x coordinate of
+// the character origin.
+// y - Pointer to a double number receiving y coordinate of
+// the character origin.
+// Return Value:
+// Whether the call succeeded. If false, x and y are unchanged.
+// Comments:
+// All positions are measured in PDF "user space".
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_GetCharOrigin(FPDF_TEXTPAGE text_page,
+ int index,
+ double* x,
+ double* y);
+
+// Function: FPDFText_GetCharIndexAtPos
+// Get the index of a character at or nearby a certain position on the
+// page.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// x - X position in PDF "user space".
+// y - Y position in PDF "user space".
+// xTolerance - An x-axis tolerance value for character hit
+// detection, in point units.
+// yTolerance - A y-axis tolerance value for character hit
+// detection, in point units.
+// Return Value:
+// The zero-based index of the character at, or nearby the point (x,y).
+// If there is no character at or nearby the point, return value will
+// be -1. If an error occurs, -3 will be returned.
+//
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
+ double x,
+ double y,
+ double xTolerance,
+ double yTolerance);
+
+// Function: FPDFText_GetText
+// Extract unicode text string from the page.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// start_index - Index for the start characters.
+// count - Number of UCS-2 values to be extracted.
+// result - A buffer (allocated by application) receiving the
+// extracted UCS-2 values. The buffer must be able to
+// hold `count` UCS-2 values plus a terminator.
+// Return Value:
+// Number of characters written into the result buffer, including the
+// trailing terminator.
+// Comments:
+// This function ignores characters without UCS-2 representations.
+// It considers all characters on the page, even those that are not
+// visible when the page has a cropbox. To filter out the characters
+// outside of the cropbox, use FPDF_GetPageBoundingBox() and
+// FPDFText_GetCharBox().
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page,
+ int start_index,
+ int count,
+ unsigned short* result);
+
+// Function: FPDFText_CountRects
+// Counts number of rectangular areas occupied by a segment of text,
+// and caches the result for subsequent FPDFText_GetRect() calls.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// start_index - Index for the start character.
+// count - Number of characters, or -1 for all remaining.
+// Return value:
+// Number of rectangles, 0 if text_page is null, or -1 on bad
+// start_index.
+// Comments:
+// This function, along with FPDFText_GetRect can be used by
+// applications to detect the position on the page for a text segment,
+// so proper areas can be highlighted. The FPDFText_* functions will
+// automatically merge small character boxes into bigger one if those
+// characters are on the same line and use same font settings.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page,
+ int start_index,
+ int count);
+
+// Function: FPDFText_GetRect
+// Get a rectangular area from the result generated by
+// FPDFText_CountRects.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// rect_index - Zero-based index for the rectangle.
+// left - Pointer to a double value receiving the rectangle
+// left boundary.
+// top - Pointer to a double value receiving the rectangle
+// top boundary.
+// right - Pointer to a double value receiving the rectangle
+// right boundary.
+// bottom - Pointer to a double value receiving the rectangle
+// bottom boundary.
+// Return Value:
+// On success, return TRUE and fill in |left|, |top|, |right|, and
+// |bottom|. If |text_page| is invalid then return FALSE, and the out
+// parameters remain unmodified. If |text_page| is valid but
+// |rect_index| is out of bounds, then return FALSE and set the out
+// parameters to 0.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetRect(FPDF_TEXTPAGE text_page,
+ int rect_index,
+ double* left,
+ double* top,
+ double* right,
+ double* bottom);
+
+// Function: FPDFText_GetBoundedText
+// Extract unicode text within a rectangular boundary on the page.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// left - Left boundary.
+// top - Top boundary.
+// right - Right boundary.
+// bottom - Bottom boundary.
+// buffer - Caller-allocated buffer to receive UTF-16 values.
+// buflen - Number of UTF-16 values (not bytes) that `buffer`
+// is capable of holding.
+// Return Value:
+// If buffer is NULL or buflen is zero, return number of UTF-16
+// values (not bytes) of text present within the rectangle, excluding
+// a terminating NUL. Generally you should pass a buffer at least one
+// larger than this if you want a terminating NUL, which will be
+// provided if space is available. Otherwise, return number of UTF-16
+// values copied into the buffer, including the terminating NUL when
+// space for it is available.
+// Comment:
+// If the buffer is too small, as much text as will fit is copied into
+// it. May return a split surrogate in that case.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
+ double left,
+ double top,
+ double right,
+ double bottom,
+ unsigned short* buffer,
+ int buflen);
+
+// Flags used by FPDFText_FindStart function.
+//
+// If not set, it will not match case by default.
+#define FPDF_MATCHCASE 0x00000001
+// If not set, it will not match the whole word by default.
+#define FPDF_MATCHWHOLEWORD 0x00000002
+// If not set, it will skip past the current match to look for the next match.
+#define FPDF_CONSECUTIVE 0x00000004
+
+// Function: FPDFText_FindStart
+// Start a search.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// findwhat - A unicode match pattern.
+// flags - Option flags.
+// start_index - Start from this character. -1 for end of the page.
+// Return Value:
+// A handle for the search context. FPDFText_FindClose must be called
+// to release this handle.
+//
+FPDF_EXPORT FPDF_SCHHANDLE FPDF_CALLCONV
+FPDFText_FindStart(FPDF_TEXTPAGE text_page,
+ FPDF_WIDESTRING findwhat,
+ unsigned long flags,
+ int start_index);
+
+// Function: FPDFText_FindNext
+// Search in the direction from page start to end.
+// Parameters:
+// handle - A search context handle returned by
+// FPDFText_FindStart.
+// Return Value:
+// Whether a match is found.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindNext(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_FindPrev
+// Search in the direction from page end to start.
+// Parameters:
+// handle - A search context handle returned by
+// FPDFText_FindStart.
+// Return Value:
+// Whether a match is found.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindPrev(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_GetSchResultIndex
+// Get the starting character index of the search result.
+// Parameters:
+// handle - A search context handle returned by
+// FPDFText_FindStart.
+// Return Value:
+// Index for the starting character.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_GetSchCount
+// Get the number of matched characters in the search result.
+// Parameters:
+// handle - A search context handle returned by
+// FPDFText_FindStart.
+// Return Value:
+// Number of matched characters.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_FindClose
+// Release a search context.
+// Parameters:
+// handle - A search context handle returned by
+// FPDFText_FindStart.
+// Return Value:
+// None.
+//
+FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle);
+
+// Function: FPDFLink_LoadWebLinks
+// Prepare information about weblinks in a page.
+// Parameters:
+// text_page - Handle to a text page information structure.
+// Returned by FPDFText_LoadPage function.
+// Return Value:
+// A handle to the page's links information structure, or
+// NULL if something goes wrong.
+// Comments:
+// Weblinks are those links implicitly embedded in PDF pages. PDF also
+// has a type of annotation called "link" (FPDFTEXT doesn't deal with
+// that kind of link). FPDFTEXT weblink feature is useful for
+// automatically detecting links in the page contents. For example,
+// things like "https://www.example.com" will be detected, so
+// applications can allow user to click on those characters to activate
+// the link, even the PDF doesn't come with link annotations.
+//
+// FPDFLink_CloseWebLinks must be called to release resources.
+//
+FPDF_EXPORT FPDF_PAGELINK FPDF_CALLCONV
+FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFLink_CountWebLinks
+// Count number of detected web links.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// Return Value:
+// Number of detected web links.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
+
+// Function: FPDFLink_GetURL
+// Fetch the URL information for a detected web link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// buffer - A unicode buffer for the result.
+// buflen - Number of 16-bit code units (not bytes) for the
+// buffer, including an additional terminator.
+// Return Value:
+// If |buffer| is NULL or |buflen| is zero, return the number of 16-bit
+// code units (not bytes) needed to buffer the result (an additional
+// terminator is included in this count).
+// Otherwise, copy the result into |buffer|, truncating at |buflen| if
+// the result is too large to fit, and return the number of 16-bit code
+// units actually copied into the buffer (the additional terminator is
+// also included in this count).
+// If |link_index| does not correspond to a valid link, then the result
+// is an empty string.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetURL(FPDF_PAGELINK link_page,
+ int link_index,
+ unsigned short* buffer,
+ int buflen);
+
+// Function: FPDFLink_CountRects
+// Count number of rectangular areas for the link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// Return Value:
+// Number of rectangular areas for the link. If |link_index| does
+// not correspond to a valid link, then 0 is returned.
+//
+FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountRects(FPDF_PAGELINK link_page,
+ int link_index);
+
+// Function: FPDFLink_GetRect
+// Fetch the boundaries of a rectangle for a link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// rect_index - Zero-based index for a rectangle.
+// left - Pointer to a double value receiving the rectangle
+// left boundary.
+// top - Pointer to a double value receiving the rectangle
+// top boundary.
+// right - Pointer to a double value receiving the rectangle
+// right boundary.
+// bottom - Pointer to a double value receiving the rectangle
+// bottom boundary.
+// Return Value:
+// On success, return TRUE and fill in |left|, |top|, |right|, and
+// |bottom|. If |link_page| is invalid or if |link_index| does not
+// correspond to a valid link, then return FALSE, and the out
+// parameters remain unmodified.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetRect(FPDF_PAGELINK link_page,
+ int link_index,
+ int rect_index,
+ double* left,
+ double* top,
+ double* right,
+ double* bottom);
+
+// Experimental API.
+// Function: FPDFLink_GetTextRange
+// Fetch the start char index and char count for a link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// start_char_index - pointer to int receiving the start char index
+// char_count - pointer to int receiving the char count
+// Return Value:
+// On success, return TRUE and fill in |start_char_index| and
+// |char_count|. if |link_page| is invalid or if |link_index| does
+// not correspond to a valid link, then return FALSE and the out
+// parameters remain unmodified.
+//
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFLink_GetTextRange(FPDF_PAGELINK link_page,
+ int link_index,
+ int* start_char_index,
+ int* char_count);
+
+// Function: FPDFLink_CloseWebLinks
+// Release resources used by weblink feature.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// Return Value:
+// None.
+//
+FPDF_EXPORT void FPDF_CALLCONV FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PUBLIC_FPDF_TEXT_H_
diff --git a/src/main/jni/include/fpdf_thumbnail.h b/src/main/jni/include/fpdf_thumbnail.h
new file mode 100644
index 00000000..27b6d497
--- /dev/null
+++ b/src/main/jni/include/fpdf_thumbnail.h
@@ -0,0 +1,59 @@
+// Copyright 2019 The PDFium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PUBLIC_FPDF_THUMBNAIL_H_
+#define PUBLIC_FPDF_THUMBNAIL_H_
+
+#include
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Experimental API.
+// Gets the decoded data from the thumbnail of |page| if it exists.
+// This only modifies |buffer| if |buflen| less than or equal to the
+// size of the decoded data. Returns the size of the decoded
+// data or 0 if thumbnail DNE. Optional, pass null to just retrieve
+// the size of the buffer needed.
+//
+// page - handle to a page.
+// buffer - buffer for holding the decoded image data.
+// buflen - length of the buffer in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFPage_GetDecodedThumbnailData(FPDF_PAGE page,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Gets the raw data from the thumbnail of |page| if it exists.
+// This only modifies |buffer| if |buflen| is less than or equal to
+// the size of the raw data. Returns the size of the raw data or 0
+// if thumbnail DNE. Optional, pass null to just retrieve the size
+// of the buffer needed.
+//
+// page - handle to a page.
+// buffer - buffer for holding the raw image data.
+// buflen - length of the buffer in bytes.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDFPage_GetRawThumbnailData(FPDF_PAGE page,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Returns the thumbnail of |page| as a FPDF_BITMAP. Returns a nullptr
+// if unable to access the thumbnail's stream.
+//
+// page - handle to a page.
+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
+FPDFPage_GetThumbnailAsBitmap(FPDF_PAGE page);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PUBLIC_FPDF_THUMBNAIL_H_
diff --git a/src/main/jni/include/fpdf_transformpage.h b/src/main/jni/include/fpdf_transformpage.h
index 69ffe240..3df743bd 100644
--- a/src/main/jni/include/fpdf_transformpage.h
+++ b/src/main/jni/include/fpdf_transformpage.h
@@ -1,113 +1,278 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _TRANSFORMPAGE_H_
-#define _TRANSFORMPAGE_H_
+#ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_
+#define PUBLIC_FPDF_TRANSFORMPAGE_H_
-#ifndef _FPDFVIEW_H_
+// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
#endif
-typedef void* FPDF_PAGEARCSAVER;
-typedef void* FPDF_PAGEARCLOADER;
-/**
-* Set "MediaBox" entry to the page dictionary.
-* @param[in] page - Handle to a page.
-* @param[in] left - The left of the rectangle.
-* @param[in] bottom - The bottom of the rectangle.
-* @param[in] right - The right of the rectangle.
-* @param[in] top - The top of the rectangle.
-* @retval None.
-*/
-DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);
-
-/**
-* Set "CropBox" entry to the page dictionary.
-* @param[in] page - Handle to a page.
-* @param[in] left - The left of the rectangle.
-* @param[in] bottom - The bottom of the rectangle.
-* @param[in] right - The right of the rectangle.
-* @param[in] top - The top of the rectangle.
-* @retval None.
-*/
-DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);
-
-
-/** Get "MediaBox" entry from the page dictionary.
-* @param[in] page - Handle to a page.
-* @param[in] left - Pointer to a double value receiving the left of the rectangle.
-* @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
-* @param[in] right - Pointer to a double value receiving the right of the rectangle.
-* @param[in] top - Pointer to a double value receiving the top of the rectangle.
-* @retval True if success,else fail.
-*/
-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
-
-/** Get "CropBox" entry from the page dictionary.
-* @param[in] page - Handle to a page.
-* @param[in] left - Pointer to a double value receiving the left of the rectangle.
-* @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
-* @param[in] right - Pointer to a double value receiving the right of the rectangle.
-* @param[in] top - Pointer to a double value receiving the top of the rectangle.
-* @retval True if success,else fail.
-*/
-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
-
-/**
-* Transform the whole page with a specified matrix, then clip the page content region.
-*
-* @param[in] page - A page handle.
-* @param[in] matrix - The transform matrix.
-* @param[in] clipRect - A rectangle page area to be clipped.
-* @Note. This function will transform the whole page, and would take effect to all the objects in the page.
-*/
-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);
-
-/**
-* Transform (scale, rotate, shear, move) the clip path of page object.
-* @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
-* @param[in] a - The coefficient "a" of the matrix.
-* @param[in] b - The coefficient "b" of the matrix.
-* @param[in] c - The coefficient "c" of the matrix.
-* @param[in] d - The coefficient "d" of the matrix.
-* @param[in] e - The coefficient "e" of the matrix.
-* @param[in] f - The coefficient "f" of the matrix.
-* @retval None.
-*/
-DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);
-
-/**
-* Create a new clip path, with a rectangle inserted.
-*
-* @param[in] left - The left of the clip box.
-* @param[in] bottom - The bottom of the clip box.
-* @param[in] right - The right of the clip box.
-* @param[in] top - The top of the clip box.
-* @retval a handle to the clip path.
-*/
-DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);
-
-/**
-* Destroy the clip path.
-*
-* @param[in] clipPath - A handle to the clip path.
-* Destroy the clip path.
-* @retval None.
-*/
-DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
-
-/**
-* Clip the page content, the page content that outside the clipping region become invisible.
-*
-* @param[in] page - A page handle.
-* @param[in] clipPath - A handle to the clip path.
-* @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped
-* by this clip path.
-*/
-DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);
+// Set "MediaBox" entry to the page dictionary.
+//
+// page - Handle to a page.
+// left - The left of the rectangle.
+// bottom - The bottom of the rectangle.
+// right - The right of the rectangle.
+// top - The top of the rectangle.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page,
+ float left,
+ float bottom,
+ float right,
+ float top);
+
+// Set "CropBox" entry to the page dictionary.
+//
+// page - Handle to a page.
+// left - The left of the rectangle.
+// bottom - The bottom of the rectangle.
+// right - The right of the rectangle.
+// top - The top of the rectangle.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
+ float left,
+ float bottom,
+ float right,
+ float top);
+
+// Set "BleedBox" entry to the page dictionary.
+//
+// page - Handle to a page.
+// left - The left of the rectangle.
+// bottom - The bottom of the rectangle.
+// right - The right of the rectangle.
+// top - The top of the rectangle.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetBleedBox(FPDF_PAGE page,
+ float left,
+ float bottom,
+ float right,
+ float top);
+
+// Set "TrimBox" entry to the page dictionary.
+//
+// page - Handle to a page.
+// left - The left of the rectangle.
+// bottom - The bottom of the rectangle.
+// right - The right of the rectangle.
+// top - The top of the rectangle.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetTrimBox(FPDF_PAGE page,
+ float left,
+ float bottom,
+ float right,
+ float top);
+
+// Set "ArtBox" entry to the page dictionary.
+//
+// page - Handle to a page.
+// left - The left of the rectangle.
+// bottom - The bottom of the rectangle.
+// right - The right of the rectangle.
+// top - The top of the rectangle.
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetArtBox(FPDF_PAGE page,
+ float left,
+ float bottom,
+ float right,
+ float top);
+
+// Get "MediaBox" entry from the page dictionary.
+//
+// page - Handle to a page.
+// left - Pointer to a float value receiving the left of the rectangle.
+// bottom - Pointer to a float value receiving the bottom of the rectangle.
+// right - Pointer to a float value receiving the right of the rectangle.
+// top - Pointer to a float value receiving the top of the rectangle.
+//
+// On success, return true and write to the out parameters. Otherwise return
+// false and leave the out parameters unmodified.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
+// Get "CropBox" entry from the page dictionary.
+//
+// page - Handle to a page.
+// left - Pointer to a float value receiving the left of the rectangle.
+// bottom - Pointer to a float value receiving the bottom of the rectangle.
+// right - Pointer to a float value receiving the right of the rectangle.
+// top - Pointer to a float value receiving the top of the rectangle.
+//
+// On success, return true and write to the out parameters. Otherwise return
+// false and leave the out parameters unmodified.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
+// Get "BleedBox" entry from the page dictionary.
+//
+// page - Handle to a page.
+// left - Pointer to a float value receiving the left of the rectangle.
+// bottom - Pointer to a float value receiving the bottom of the rectangle.
+// right - Pointer to a float value receiving the right of the rectangle.
+// top - Pointer to a float value receiving the top of the rectangle.
+//
+// On success, return true and write to the out parameters. Otherwise return
+// false and leave the out parameters unmodified.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetBleedBox(FPDF_PAGE page,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
+// Get "TrimBox" entry from the page dictionary.
+//
+// page - Handle to a page.
+// left - Pointer to a float value receiving the left of the rectangle.
+// bottom - Pointer to a float value receiving the bottom of the rectangle.
+// right - Pointer to a float value receiving the right of the rectangle.
+// top - Pointer to a float value receiving the top of the rectangle.
+//
+// On success, return true and write to the out parameters. Otherwise return
+// false and leave the out parameters unmodified.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetTrimBox(FPDF_PAGE page,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
+// Get "ArtBox" entry from the page dictionary.
+//
+// page - Handle to a page.
+// left - Pointer to a float value receiving the left of the rectangle.
+// bottom - Pointer to a float value receiving the bottom of the rectangle.
+// right - Pointer to a float value receiving the right of the rectangle.
+// top - Pointer to a float value receiving the top of the rectangle.
+//
+// On success, return true and write to the out parameters. Otherwise return
+// false and leave the out parameters unmodified.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetArtBox(FPDF_PAGE page,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
+// Apply transforms to |page|.
+//
+// If |matrix| is provided it will be applied to transform the page.
+// If |clipRect| is provided it will be used to clip the resulting page.
+// If neither |matrix| or |clipRect| are provided this method returns |false|.
+// Returns |true| if transforms are applied.
+//
+// This function will transform the whole page, and would take effect to all the
+// objects in the page.
+//
+// page - Page handle.
+// matrix - Transform matrix.
+// clipRect - Clipping rectangle.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPage_TransFormWithClip(FPDF_PAGE page,
+ const FS_MATRIX* matrix,
+ const FS_RECTF* clipRect);
+
+// Transform (scale, rotate, shear, move) the clip path of page object.
+// page_object - Handle to a page object. Returned by
+// FPDFPageObj_NewImageObj().
+//
+// a - The coefficient "a" of the matrix.
+// b - The coefficient "b" of the matrix.
+// c - The coefficient "c" of the matrix.
+// d - The coefficient "d" of the matrix.
+// e - The coefficient "e" of the matrix.
+// f - The coefficient "f" of the matrix.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
+ double a,
+ double b,
+ double c,
+ double d,
+ double e,
+ double f);
+
+// Experimental API.
+// Get the clip path of the page object.
+//
+// page object - Handle to a page object. Returned by e.g.
+// FPDFPage_GetObject().
+//
+// Returns the handle to the clip path, or NULL on failure. The caller does not
+// take ownership of the returned FPDF_CLIPPATH. Instead, it remains valid until
+// FPDF_ClosePage() is called for the page containing |page_object|.
+FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV
+FPDFPageObj_GetClipPath(FPDF_PAGEOBJECT page_object);
+
+// Experimental API.
+// Get number of paths inside |clip_path|.
+//
+// clip_path - handle to a clip_path.
+//
+// Returns the number of objects in |clip_path| or -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV FPDFClipPath_CountPaths(FPDF_CLIPPATH clip_path);
+
+// Experimental API.
+// Get number of segments inside one path of |clip_path|.
+//
+// clip_path - handle to a clip_path.
+// path_index - index into the array of paths of the clip path.
+//
+// Returns the number of segments or -1 on failure.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFClipPath_CountPathSegments(FPDF_CLIPPATH clip_path, int path_index);
+
+// Experimental API.
+// Get segment in one specific path of |clip_path| at index.
+//
+// clip_path - handle to a clip_path.
+// path_index - the index of a path.
+// segment_index - the index of a segment.
+//
+// Returns the handle to the segment, or NULL on failure. The caller does not
+// take ownership of the returned FPDF_PATHSEGMENT. Instead, it remains valid
+// until FPDF_ClosePage() is called for the page containing |clip_path|.
+FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
+FPDFClipPath_GetPathSegment(FPDF_CLIPPATH clip_path,
+ int path_index,
+ int segment_index);
+
+// Create a new clip path, with a rectangle inserted.
+//
+// Caller takes ownership of the returned FPDF_CLIPPATH. It should be freed with
+// FPDF_DestroyClipPath().
+//
+// left - The left of the clip box.
+// bottom - The bottom of the clip box.
+// right - The right of the clip box.
+// top - The top of the clip box.
+FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left,
+ float bottom,
+ float right,
+ float top);
+
+// Destroy the clip path.
+//
+// clipPath - A handle to the clip path. It will be invalid after this call.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
+
+// Clip the page content, the page content that outside the clipping region
+// become invisible.
+//
+// A clip path will be inserted before the page content stream or content array.
+// In this way, the page content will be clipped by this clip path.
+//
+// page - A page handle.
+// clipPath - A handle to the clip path. (Does not take ownership.)
+FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page,
+ FPDF_CLIPPATH clipPath);
+#ifdef __cplusplus
+}
#endif
+#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_
diff --git a/src/main/jni/include/fpdfdoc.h b/src/main/jni/include/fpdfdoc.h
deleted file mode 100644
index 54ede403..00000000
--- a/src/main/jni/include/fpdfdoc.h
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFDOC_H_
-#define _FPDFDOC_H_
-
-#include "fpdfview.h"
-
-// Exported Functions
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Function: FPDFBookmark_Find
-// Find a bookmark in the document, using the bookmark title.
-// Parameters:
-// document - Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
-// title - The UTF-16LE encoded Unicode string for the bookmark title to be searched. Can't be NULL.
-// Return value:
-// Handle to the found bookmark item. NULL if the title can't be found.
-// Comments:
-// It always returns the first found bookmark if more than one bookmarks have the same title.
-//
-DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
-
-// Function: FPDFBookmark_GetDest
-// Get the destination associated with a bookmark item.
-// Parameters:
-// document - Handle to the document.
-// bookmark - Handle to the bookmark.
-// Return value:
-// Handle to the destination data. NULL if no destination is associated with this bookmark.
-//
-DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
-
-// Function: FPDFBookmark_GetAction
-// Get the action associated with a bookmark item.
-// Parameters:
-// bookmark - Handle to the bookmark.
-// Return value:
-// Handle to the action data. NULL if no action is associated with this bookmark. In this case, the
-// application should try FPDFBookmark_GetDest.
-//
-DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
-
-#define PDFACTION_UNSUPPORTED 0 // Unsupported action type.
-#define PDFACTION_GOTO 1 // Go to a destination within current document.
-#define PDFACTION_REMOTEGOTO 2 // Go to a destination within another document.
-#define PDFACTION_URI 3 // Universal Resource Identifier, including web pages and
- // other Internet based resources.
-#define PDFACTION_LAUNCH 4 // Launch an application or open a file.
-
-// Function: FPDFAction_GetType
-// Get type of an action.
-// Parameters:
-// action - Handle to the action.
-// Return value:
-// A type number as defined above.
-//
-DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
-
-// Function: FPDFAction_GetDest
-// Get destination of an action.
-// Parameters:
-// document - Handle to the document.
-// action - Handle to the action. It must be a GOTO or REMOTEGOTO action.
-// Return value:
-// Handle to the destination data.
-// Comments:
-// In case of remote goto action, the application should first use FPDFAction_GetFilePath to
-// get file path, then load that particular document, and use its document handle to call this
-// function.
-//
-DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action);
-
-// Function: FPDFAction_GetURIPath
-// Get URI path of a URI action.
-// Parameters:
-// document - Handle to the document.
-// action - Handle to the action. Must be a URI action.
-// buffer - A buffer for output the path string. Can be NULL.
-// buflen - The length of the buffer, number of bytes. Can be 0.
-// Return value:
-// Number of bytes the URI path consumes, including trailing zeros.
-// Comments:
-// The URI path is always encoded in 7-bit ASCII.
-//
-// The return value always indicated number of bytes required for the buffer, even when there is
-// no buffer specified, or the buffer size is less then required. In this case, the buffer will not
-// be modified.
-//
-DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action,
- void* buffer, unsigned long buflen);
-
-// Function: FPDFDest_GetPageIndex
-// Get page index of a destination.
-// Parameters:
-// document - Handle to the document.
-// dest - Handle to the destination.
-// Return value:
-// The page index. Starting from 0 for the first page.
-//
-DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest);
-
-// Function: FPDFLink_GetLinkAtPoint
-// Find a link at specified point on a document page.
-// Parameters:
-// page - Handle to the document page.
-// x - The x coordinate of the point, specified in page coordinate system.
-// y - The y coordinate of the point, specified in page coordinate system.
-// Return value:
-// Handle to the link. NULL if no link found at that point.
-// Comments:
-// The point coordinates are specified in page coordinate system. You can convert coordinates
-// from screen system to page system using FPDF_DeviceToPage functions.
-//
-DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y);
-
-// Function: FPDFLink_GetDest
-// Get destination info of a link.
-// Parameters:
-// document - Handle to the document.
-// link - Handle to the link. Returned by FPDFLink_GetLinkAtPoint.
-// Return value:
-// Handle to the destination. NULL if there is no destination associated with the link, in this case
-// the application should try FPDFLink_GetAction.
-//
-DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link);
-
-// Function: FPDFLink_GetAction
-// Get action info of a link.
-// Parameters:
-// link - Handle to the link.
-// Return value:
-// Handle to the action. NULL if there is no action associated with the link.
-//
-DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);
-
-// Function: FPDFLink_Enumerate
-// This function would enumerate all the link annotations in a single PDF page.
-// Parameters:
-// page[in] - Handle to the page.
-// startPos[in,out] - The start position to enumerate the link annotations, which should be specified to start from
-// - 0 for the first call, and would receive the next position for enumerating to start from.
-// linkAnnot[out] - Receive the link handle.
-// Return value:
-// TRUE if succceed, else False;
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FPDF_LINK* linkAnnot);
-
-// Function: FPDFLink_GetAnnotRect
-// Get the annotation rectangle. (Specified by the ¡°Rect¡± entry of annotation dictionary).
-// Parameters:
-// linkAnnot[in] - Handle to the link annotation.
-// rect[out] - The annotation rect.
-// Return value:
-// TRUE if succceed, else False;
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect);
-
-// Function: FPDFLink_CountQuadPoints
-// Get the count of quadrilateral points to the link annotation.
-// Parameters:
-// linkAnnot[in] - Handle to the link annotation.
-// Return value:
-// The count of quadrilateral points.
-//
-DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);
-
-/* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
-#ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_
-#define _FS_DEF_STRUCTURE_QUADPOINTSF_
-typedef struct _FS_QUADPOINTSF
-{
- FS_FLOAT x1;
- FS_FLOAT y1;
- FS_FLOAT x2;
- FS_FLOAT y2;
- FS_FLOAT x3;
- FS_FLOAT y3;
- FS_FLOAT x4;
- FS_FLOAT y4;
-} FS_QUADPOINTSF;
-#endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
-
-// Function: FPDFLink_GetQuadPoints
-// Get the quadrilateral points for the specified index in the link annotation.
-// Parameters:
-// linkAnnot[in] - Handle to the link annotation.
-// quadIndex[in] - The specified quad points index.
-// quadPoints[out] - Receive the quadrilateral points.
-// Return value:
-// True if succeed, else False.
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints);
-
-// Function: FPDF_GetMetaText
-// Get a text from meta data of the document. Result is encoded in UTF-16LE.
-// Parameters:
-// doc - Handle to a document
-// tag - The tag for the meta data. Currently, It can be "Title", "Author",
-// "Subject", "Keywords", "Creator", "Producer", "CreationDate", or "ModDate".
-// For detailed explanation of these tags and their respective values,
-// please refer to PDF Reference 1.6, section 10.2.1, "Document Information Dictionary".
-// buffer - A buffer for output the title. Can be NULL.
-// buflen - The length of the buffer, number of bytes. Can be 0.
-// Return value:
-// Number of bytes the title consumes, including trailing zeros.
-// Comments:
-// No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer
-// can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of
-// a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero
-// indicating end of the string.
-//
-// The return value always indicated number of bytes required for the buffer, even when there is
-// no buffer specified, or the buffer size is less then required. In this case, the buffer will not
-// be modified.
-//
-DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTRING tag,
- void* buffer, unsigned long buflen);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // _FPDFDOC_H_
diff --git a/src/main/jni/include/fpdfedit.h b/src/main/jni/include/fpdfedit.h
deleted file mode 100644
index c7d8b01f..00000000
--- a/src/main/jni/include/fpdfedit.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFEDIT_H_
-#define _FPDFEDIT_H_
-
-#include "fpdfview.h"
-
-// Define all types used in the SDK. Note they can be simply regarded as opaque pointers
-// or long integer numbers.
-
-#define FPDF_ARGB(a,r,g,b) ((((FX_DWORD)(((FX_BYTE)(b)|((FX_WORD)((FX_BYTE)(g))<<8))|(((FX_DWORD)(FX_BYTE)(r))<<16)))) | (((FX_DWORD)(FX_BYTE)(a))<<24))
-#define FPDF_GetBValue(argb) ((FX_BYTE)(argb))
-#define FPDF_GetGValue(argb) ((FX_BYTE)(((FX_WORD)(argb)) >> 8))
-#define FPDF_GetRValue(argb) ((FX_BYTE)((argb)>>16))
-#define FPDF_GetAValue(argb) ((FX_BYTE)((argb)>>24))
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//////////////////////////////////////////////////////////////////////
-//
-// Document functions
-//
-//////////////////////////////////////////////////////////////////////
-
-// Function: FPDF_CreateNewDocument
-// Create a new PDF document.
-// Parameters:
-// None.
-// Return value:
-// A handle to a document. If failed, NULL is returned.
-DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument();
-
-//////////////////////////////////////////////////////////////////////
-//
-// Page functions
-//
-//////////////////////////////////////////////////////////////////////
-
-// Function: FPDFPage_New
-// Construct an empty page.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
-// page_index - The index of a page.
-// width - The page width.
-// height - The page height.
-// Return value:
-// The handle to the page.
-// Comments:
-// Loaded page can be deleted by FPDFPage_Delete.
-DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height);
-
-// Function: FPDFPage_Delete
-// Delete a PDF page.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
-// page_index - The index of a page.
-// Return value:
-// None.
-DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index);
-
-// Function: FPDFPage_GetRotation
-// Get the page rotation. One of following values will be returned: 0(0), 1(90), 2(180), 3(270).
-// Parameters:
-// page - Handle to a page. Returned by FPDFPage_New.
-// Return value:
-// The PDF page rotation.
-// Comment:
-// The PDF page rotation is rotated clockwise.
-DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page);
-
-// Function: FPDFPage_InsertObject
-// Insert an object to the page. The page object is automatically freed.
-// Parameters:
-// page - Handle to a page. Returned by FPDFPage_New.
-// page_obj - Handle to a page object. Returned by FPDFPageObj_NewTextObj,FPDFPageObj_NewTextObjEx and
-// FPDFPageObj_NewPathObj.
-// Return value:
-// None.
-DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj);
-
-// Function: FPDFPage_CountObject
-// Get number of page objects inside the page.
-// Parameters:
-// page - Handle to a page. Returned by FPDFPage_New.
-// Return value:
-// The number of the page object.
-DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page);
-
-// Function: FPDFPage_GetObject
-// Get page object by index.
-// Parameters:
-// page - Handle to a page. Returned by FPDFPage_New.
-// index - The index of a page object.
-// Return value:
-// The handle of the page object. Null for failed.
-DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index);
-
-// Function: FPDFPage_HasTransparency
-// Check that whether the content of specified PDF page contains transparency.
-// Parameters:
-// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
-// Return value:
-// TRUE means that the PDF page does contains transparency.
-// Otherwise, returns FALSE.
-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page);
-
-// Function: FPDFPage_GenerateContent
-// Generate PDF Page content.
-// Parameters:
-// page - Handle to a page. Returned by FPDFPage_New.
-// Return value:
-// True if successful, false otherwise.
-// Comment:
-// Before you save the page to a file, or reload the page, you must call the FPDFPage_GenerateContent function.
-// Or the changed information will be lost.
-DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);
-
-//////////////////////////////////////////////////////////////////////
-//
-// Page Object functions
-//
-//////////////////////////////////////////////////////////////////////
-
-// Function: FPDFPageObj_HasTransparency
-// Check that whether the specified PDF page object contains transparency.
-// Parameters:
-// pageObject - Handle to a page object.
-// Return value:
-// TRUE means that the PDF page object does contains transparency.
-// Otherwise, returns FALSE.
-DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);
-
-// Function: FPDFPageObj_Transform
-// Transform (scale, rotate, shear, move) page object.
-// Parameters:
-// page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
-// a - The coefficient "a" of the matrix.
-// b - The coefficient "b" of the matrix.
-// c - The coefficient "c" of the matrix.
-// d - The coefficient "d" of the matrix.
-// e - The coefficient "e" of the matrix.
-// f - The coefficient "f" of the matrix.
-// Return value:
-// None.
-DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
- double a, double b, double c, double d, double e, double f);
-
-// Function: FPDFPage_TransformAnnots
-// Transform (scale, rotate, shear, move) all annots in a page.
-// Parameters:
-// page - Handle to a page.
-// a - The coefficient "a" of the matrix.
-// b - The coefficient "b" of the matrix.
-// c - The coefficient "c" of the matrix.
-// d - The coefficient "d" of the matrix.
-// e - The coefficient "e" of the matrix.
-// f - The coefficient "f" of the matrix.
-// Return value:
-// None.
-DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
- double a, double b, double c, double d, double e, double f);
-
-// The page object constants.
-#define FPDF_PAGEOBJ_TEXT 1
-#define FPDF_PAGEOBJ_PATH 2
-#define FPDF_PAGEOBJ_IMAGE 3
-#define FPDF_PAGEOBJ_SHADING 4
-#define FPDF_PAGEOBJ_FORM 5
-
-//////////////////////////////////////////////////////////////////////
-//
-// Image functions
-//
-//////////////////////////////////////////////////////////////////////
-
-// Function: FPDFPageObj_NewImgeObj
-// Create a new Image Object.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument or FPDF_CreateNewDocument function.
-// Return Value:
-// Handle of image object.
-DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);
-
-
-// Function: FPDFImageObj_LoadJpegFile
-// Load Image from a JPEG image file and then set it to an image object.
-// Parameters:
-// pages - Pointers to the start of all loaded pages, could be NULL.
-// nCount - Number of pages, could be 0.
-// image_object - Handle of image object returned by FPDFPageObj_NewImgeObj.
-// fileAccess - The custom file access handler, which specifies the JPEG image file.
-// Return Value:
-// TRUE if successful, FALSE otherwise.
-// Note:
-// The image object might already has an associated image, which is shared and cached by the loaded pages, In this case, we need to clear the cache of image for all the loaded pages.
-// Pass pages and count to this API to clear the image cache.
-DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess);
-
-
-// Function: FPDFImageObj_SetMatrix
-// Set the matrix of an image object.
-// Parameters:
-// image_object - Handle of image object returned by FPDFPageObj_NewImgeObj.
-// a - The coefficient "a" of the matrix.
-// b - The coefficient "b" of the matrix.
-// c - The coefficient "c" of the matrix.
-// d - The coefficient "d" of the matrix.
-// e - The coefficient "e" of the matrix.
-// f - The coefficient "f" of the matrix.
-// Return value:
-// TRUE if successful, FALSE otherwise.
-DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
- double a, double b, double c, double d, double e, double f);
-
-// Function: FPDFImageObj_SetBitmap
-// Set the bitmap to an image object.
-// Parameters:
-// pages - Pointer's to the start of all loaded pages.
-// nCount - Number of pages.
-// image_object - Handle of image object returned by FPDFPageObj_NewImgeObj.
-// bitmap - The handle of the bitmap which you want to set it to the image object.
-// Return value:
-// TRUE if successful, FALSE otherwise.
-DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap);
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _FPDFEDIT_H_
diff --git a/src/main/jni/include/fpdfformfill.h b/src/main/jni/include/fpdfformfill.h
deleted file mode 100644
index 50a2dff6..00000000
--- a/src/main/jni/include/fpdfformfill.h
+++ /dev/null
@@ -1,841 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-
-#ifndef _FPDFORMFILL_H
-#define _FPDFORMFILL_H
-#include "fpdfview.h"
-
-typedef void* FPDF_FORMHANDLE;
-
-// Exported Functions
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _IPDF_JsPlatform
-{
-/**
-* Version number of the interface. Currently must be 1.
- **/
- int version;
-
- /**
- * Method: app_alert
- * pop up a dialog to show warning or hint.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * Msg - A string containing the message to be displayed.
- * Title - The title of the dialog.
- * Type - The stype of button group.
- * 0-OK(default);
- * 1-OK,Cancel;
- * 2-Yes,NO;
- * 3-Yes, NO, Cancel.
- * nIcon - The Icon type.
- * 0-Error(default);
- * 1-Warning;
- * 2-Question;
- * 3-Status.
- * Return Value:
- * The return value could be the folowing type:
- * 1-OK;
- * 2-Cancel;
- * 3-NO;
- * 4-Yes;
- */
- int (*app_alert)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon);
-
- /**
- * Method: app_beep
- * Causes the system to play a sound.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * nType - The sound type.
- * 0 - Error
- * 1 - Warning
- * 2 - Question
- * 3 - Status
- * 4 - Default (default value)
- * Return Value:
- * None
- */
- void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType);
-
-
- /**
- * Method: app_response
- * Displays a dialog box containing a question and an entry field for the user to reply to the question.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * Question - The question to be posed to the user.
- * Title - The title of the dialog box.
- * Default - A default value for the answer to the question. If not specified, no default value is presented.
- * cLabel - A short string to appear in front of and on the same line as the edit text field.
- * bPassword - If true, indicates that the user's response should show as asterisks (*) or bullets (?) to mask the response, which might be sensitive information. The default is false.
- * response - A string buffer allocated by SDK, to receive the user's response.
- * length - The length of the buffer, number of bytes. Currently, It's always be 2048.
- * Return Value:
- * Number of bytes the user input text consumes, not including trailing zeros. If the text exceed 2048 bytes,
- * the exceeded part will be ignored.
- * Comments:
- * No matter on what platform, the response should be always input in UTF-16LE encoding.
- * The return value always indicated number of bytes required for the buffer, even when there is
- * no buffer specified, or the buffer size is less then required. In this case, the buffer will not
- * be modified.
- */
- int (*app_response)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Question, FPDF_WIDESTRING Title, FPDF_WIDESTRING Default, FPDF_WIDESTRING cLabel, FPDF_BOOL bPassword, void* response, int length);
-
-
-
- /*
- * Method: Doc_getFilePath
- * Get the file path of the current document.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * filePath - The string buffer to receive the file path. Can be NULL.
- * length - The length of the buffer, number of bytes. Can be 0.
- * Return Value:
- * Number of bytes the filePath consumes, including trailing zeros.
- * Comments:
- * The filePath should be always input in local encoding.
- *
- * The return value always indicated number of bytes required for the buffer, even when there is
- * no buffer specified, or the buffer size is less then required. In this case, the buffer will not
- * be modified.
- */
- int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);
-
-
- /*
- * Method: Doc_mail
- * Mails the data buffer as an attachment to all recipients, with or without user interaction.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * mailData - Pointer to the data buffer to be sent.Can be NULL.
- * length - The size,in bytes, of the buffer pointed by mailData parameter.Can be 0.
- * bUI - If true, the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.
- * To - A semicolon-delimited list of recipients for the message.
- * Subject - The subject of the message. The length limit is 64 KB.
- * CC - A semicolon-delimited list of CC recipients for the message.
- * BCC - A semicolon-delimited list of BCC recipients for the message.
- * Msg - The content of the message. The length limit is 64 KB.
- * Return Value:
- * None.
- * Comments:
- * If the parameter mailData is NULL or length is 0, the current document will be mailed as an attachment to all recipients.
- */
- void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,void* mailData, int length,FPDF_BOOL bUI, FPDF_WIDESTRING To, FPDF_WIDESTRING Subject, FPDF_WIDESTRING CC, FPDF_WIDESTRING BCC, FPDF_WIDESTRING Msg);
-
-
- /*
- * Method: Doc_print
- * Prints all or a specific number of pages of the document.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * bUI - If true, will cause a UI to be presented to the user to obtain printing information and confirm the action.
- * nStart - A 0-based index that defines the start of an inclusive range of pages.
- * nEnd - A 0-based index that defines the end of an inclusive page range.
- * bSilent - If true, suppresses the cancel dialog box while the document is printing. The default is false.
- * bShrinkToFit - If true, the page is shrunk (if necessary) to fit within the imageable area of the printed page.
- * bPrintAsImage - If true, print pages as an image.
- * bReverse - If true, print from nEnd to nStart.
- * bAnnotations - If true (the default), annotations are printed.
- */
- void (*Doc_print)(struct _IPDF_JsPlatform* pThis, FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations);
-
- /*
- * Method: Doc_submitForm
- * Send the form data to a specified URL.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * formData - Pointer to the data buffer to be sent.
- * length - The size,in bytes, of the buffer pointed by formData parameter.
- * URL - The URL to send to.
- * Return Value:
- * None.
- *
- */
- void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,void* formData, int length, FPDF_WIDESTRING URL);
-
- /*
- * Method: Doc_gotoPage
- * Jump to a specified page.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * nPageNum - The specified page number, zero for the first page.
- * Return Value:
- * None.
- *
- */
- void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
- /*
- * Method: Field_browse
- * Show a file selection dialog, and return the selected file path.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * filePath - Pointer to the data buffer to receive the file path.Can be NULL.
- * length - The length of the buffer, number of bytes. Can be 0.
- * Return Value:
- * Number of bytes the filePath consumes, including trailing zeros.
- * Comments:
- * The filePath shoule be always input in local encoding.
- */
- int (*Field_browse)(struct _IPDF_JsPlatform* pThis,void* filePath, int length);
-
- /**
- * pointer to FPDF_FORMFILLINFO interface.
- **/
- void* m_pFormfillinfo;
-} IPDF_JSPLATFORM;
-
-// Flags for Cursor type
-#define FXCT_ARROW 0
-#define FXCT_NESW 1
-#define FXCT_NWSE 2
-#define FXCT_VBEAM 3
-#define FXCT_HBEAM 4
-#define FXCT_HAND 5
-
-/**
- * Declares of a pointer type to the callback function for the FFI_SetTimer method.
- * Parameters:
- * idEvent - Identifier of the timer.
- * Return value:
- * None.
- **/
-typedef void (*TimerCallback)(int idEvent);
-
-/**
- * Declares of a struct type to the local system time.
-**/
-typedef struct _FPDF_SYSTEMTIME
-{
- unsigned short wYear; /* years since 1900 */
- unsigned short wMonth; /* months since January - [0,11] */
- unsigned short wDayOfWeek; /* days since Sunday - [0,6] */
- unsigned short wDay; /* day of the month - [1,31] */
- unsigned short wHour; /* hours since midnight - [0,23] */
- unsigned short wMinute; /* minutes after the hour - [0,59] */
- unsigned short wSecond; /* seconds after the minute - [0,59] */
- unsigned short wMilliseconds; /* milliseconds after the second - [0,999] */
-}FPDF_SYSTEMTIME;
-
-
-typedef struct _FPDF_FORMFILLINFO
-{
- /**
- * Version number of the interface. Currently must be 1.
- **/
- int version;
-
- /**
- * Method: Release
- * Give implementation a chance to release any data after the interface is no longer used
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Comments:
- * Called by Foxit SDK during the final cleanup process.
- * Parameters:
- * pThis - Pointer to the interface structure itself
- * Return Value:
- * None
- */
-
- void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
-
- /**
- * Method: FFI_Invalidate
- * Invalidate the client area within the specified rectangle.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * left - Left position of the client area in PDF page coordinate.
- * top - Top position of the client area in PDF page coordinate.
- * right - Right position of the client area in PDF page coordinate.
- * bottom - Bottom position of the client area in PDF page coordinate.
- * Return Value:
- * None.
- *
- *comments:
- * All positions are measured in PDF "user space".
- * Implementation should call FPDF_RenderPageBitmap() function for repainting a specified page area.
- */
- void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
-
- /**
- * Method: FFI_OutputSelectedRect
- * When user is taking the mouse to select texts on a form field, this callback function will keep
- * returning the selected areas to the implementation.
- *
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * left - Left position of the client area in PDF page coordinate.
- * top - Top position of the client area in PDF page coordinate.
- * right - Right position of the client area in PDF page coordinate.
- * bottom - Bottom position of the client area in PDF page coordinate.
- * Return Value:
- * None.
- *
- * comments:
- * This CALLBACK function is useful for implementing special text selection effect. Implementation should
- * first records the returned rectangles, then draw them one by one at the painting period, last,remove all
- * the recorded rectangles when finish painting.
- */
- void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
-
- /**
- * Method: FFI_SetCursor
- * Set the Cursor shape.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * nCursorType - Cursor type. see Flags for Cursor type for the details.
- * Return value:
- * None.
- * */
- void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
-
- /**
- * Method: FFI_SetTimer
- * This method installs a system timer. A time-out value is specified,
- * and every time a time-out occurs, the system passes a message to
- * the TimerProc callback function.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * uElapse - Specifies the time-out value, in milliseconds.
- * lpTimerFunc - A pointer to the callback function-TimerCallback.
- * Return value:
- * The timer identifier of the new timer if the function is successful.
- * An application passes this value to the FFI_KillTimer method to kill
- * the timer. Nonzero if it is successful; otherwise, it is zero.
- * */
- int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc);
-
- /**
- * Method: FFI_KillTimer
- * This method kills the timer event identified by nIDEvent, set by an earlier call to FFI_SetTimer.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * nTimerID - The timer ID return by FFI_SetTimer function.
- * Return value:
- * None.
- * */
- void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
-
-
- /**
- * Method: FFI_GetLocalTime
- * This method receives the current local time on the system.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * Return value:
- * None.
- * */
- FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
-
- /**
- * Method: FFI_OnChange
- * This method will be invoked to notify implementation when the value of any FormField on the document had been changed.
- * Interface Version:
- * 1
- * Implementation Required:
- * no
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * Return value:
- * None.
- * */
- void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
-
- /**
- * Method: FFI_GetPage
- * This method receives the page pointer associated with a specified page index.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * document - Handle to document. Returned by FPDF_LoadDocument function.
- * nPageIndex - Index number of the page. 0 for the first page.
- * Return value:
- * Handle to the page. Returned by FPDF_LoadPage function.
- * Comments:
- * In some cases, the document-level JavaScript action may refer to a page which hadn't been loaded yet.
- * To successfully run the javascript action, implementation need to load the page for SDK.
- * */
- FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int nPageIndex);
-
- /**
- * Method: FFI_GetCurrentPage
- * This method receives the current page pointer.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * document - Handle to document. Returned by FPDF_LoadDocument function.
- * Return value:
- * Handle to the page. Returned by FPDF_LoadPage function.
- * */
- FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
-
- /**
- * Method: FFI_GetRotation
- * This method receives currently rotation of the page view.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * page - Handle to page. Returned by FPDF_LoadPage function.
- * Return value:
- * The page rotation. Should be 0(0 degree),1(90 degree),2(180 degree),3(270 degree), in a clockwise direction.
- * */
- int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
-
- /**
- * Method: FFI_ExecuteNamedAction
- * This method will execute an named action.
- * Interface Version:
- * 1
- * Implementation Required:
- * yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * namedAction - A byte string which indicates the named action, terminated by 0.
- * Return value:
- * None.
- * Comments:
- * See the named actions description of <> for more details.
- * */
- void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction);
- /**
- * @brief This method will be called when a text field is getting or losing a focus.
- *
- * @param[in] pThis Pointer to the interface structure itself.
- * @param[in] value The string value of the form field, in UTF-16LE format.
- * @param[in] valueLen The length of the string value, number of characters (not bytes).
- * @param[in] is_focus True if the form field is getting a focus, False for losing a focus.
- *
- * @return None.
- *
- * @note Currently,only support text field and combobox field.
- * */
- void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING value, FPDF_DWORD valueLen, FPDF_BOOL is_focus);
-
-
- /**
- * Method: FFI_DoURIAction
- * This action resolves to a uniform resource identifier.
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * bsURI - A byte string which indicates the uniform resource identifier, terminated by 0.
- * Return value:
- * None.
- * Comments:
- * See the URI actions description of <> for more details.
- * */
- void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING bsURI);
-
- /**
- * Method: FFI_DoGoToAction
- * This action changes the view to a specified destination.
- * Interface Version:
- * 1
- * Implementation Required:
- * No
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * nPageIndex - The index of the PDF page.
- * zoomMode - The zoom mode for viewing page.See Macros "PDFZOOM_XXX" defined in "fpdfdoc.h".
- * fPosArray - The float array which carries the position info.
- * sizeofArray - The size of float array.
- * Return value:
- * None.
- * Comments:
- * See the Destinations description of <> in 8.2.1 for more details.
- **/
- void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, int nPageIndex, int zoomMode, float* fPosArray, int sizeofArray);
- /**
- * pointer to IPDF_JSPLATFORM interface
- **/
- IPDF_JSPLATFORM* m_pJsPlatform;
-
-} FPDF_FORMFILLINFO;
-
-
-
-/**
- * Function: FPDFDOC_InitFormFillEnviroument
- * Init form fill environment.
- * Comments:
- * This function should be called before any form fill operation.
- * Parameters:
- * document - Handle to document. Returned by FPDF_LoadDocument function.
- * pFormFillInfo - Pointer to a FPDF_FORMFILLINFO structure.
- * Return Value:
- * Return handler to the form fill module. NULL means fails.
- **/
-DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnviroument(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo);
-
-/**
- * Function: FPDFDOC_ExitFormFillEnviroument
- * Exit form fill environment.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * Return Value:
- * NULL.
- **/
-DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnviroument(FPDF_FORMHANDLE hHandle);
-
-/**
- * Function: FORM_OnAfterLoadPage
- * This method is required for implementing all the form related functions. Should be invoked after user
- * successfully loaded a PDF page, and method FPDFDOC_InitFormFillEnviroument had been invoked.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * Return Value:
- * NONE.
- **/
-DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
-
-/**
- * Function: FORM_OnBeforeClosePage
- * This method is required for implementing all the form related functions. Should be invoked before user
- * close the PDF page.
- * Parameters:
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * Return Value:
- * NONE.
- **/
-DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
-
-/**
-* Function: FORM_DoDocumentJSAction
-* This method is required for performing Document-level JavaScript action. It should be invoked after the PDF document
-* had been loaded.
-* Parameters:
-* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
-* Return Value:
-* NONE
-* Comments:
-* If there is Document-level JavaScript action embedded in the document, this method will execute the javascript action;
-* otherwise, the method will do nothing.
-**/
-DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
-
-
-/**
-* Function: FORM_DoDocumentOpenAction
-* This method is required for performing open-action when the document is opened.
-* Parameters:
-* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
-* Return Value:
-* NONE
-* Comments:
-* This method will do nothing if there is no open-actions embedded in the document.
-**/
-DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
-
-
-// additional actions type of document.
-#define FPDFDOC_AACTION_WC 0x10 //WC, before closing document, JavaScript action.
-#define FPDFDOC_AACTION_WS 0x11 //WS, before saving document, JavaScript action.
-#define FPDFDOC_AACTION_DS 0x12 //DS, after saving document, JavaScript action.
-#define FPDFDOC_AACTION_WP 0x13 //WP, before printing document, JavaScript action.
-#define FPDFDOC_AACTION_DP 0x14 //DP, after printing document, JavaScript action.
-/**
-* Function: FORM_DoDocumentAAction
-* This method is required for performing the document's additional-action.
-* Parameters:
-* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
-* aaType - The type of the additional-actions which defined above.
-* Return Value:
-* NONE
-* Comments:
-* This method will do nothing if there is no document additional-action corresponding to the specified aaType.
-**/
-
-DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType);
-
-// Additional-action types of page object
-#define FPDFPAGE_AACTION_OPEN 0 // /O -- An action to be performed when the page is opened
-#define FPDFPAGE_AACTION_CLOSE 1 // /C -- An action to be performed when the page is closed
-
-/**
-* Function: FORM_DoPageAAction
-* This method is required for performing the page object's additional-action when opened or closed.
-* Parameters:
-* page - Handle to the page. Returned by FPDF_LoadPage function.
-* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
-* aaType - The type of the page object's additional-actions which defined above.
-* Return Value:
-* NONE
-* Comments:
-* This method will do nothing if no additional-action corresponding to the specified aaType exists.
-**/
-DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType);
-
-/**
- * Function: FORM_OnMouseMove
- * You can call this member function when the mouse cursor moves.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * modifier - Indicates whether various virtual keys are down.
- * page_x - Specifies the x-coordinate of the cursor in PDF user space.
- * page_y - Specifies the y-coordinate of the cursor in PDF user space.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
-
-/**
- * Function: FORM_OnLButtonDown
- * You can call this member function when the user presses the left mouse button.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * modifier - Indicates whether various virtual keys are down.
- * page_x - Specifies the x-coordinate of the cursor in PDF user space.
- * page_y - Specifies the y-coordinate of the cursor in PDF user space.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
-
-/**
- * Function: FORM_OnLButtonUp
- * You can call this member function when the user releases the left mouse button.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * modifier - Indicates whether various virtual keys are down.
- * page_x - Specifies the x-coordinate of the cursor in device.
- * page_y - Specifies the y-coordinate of the cursor in device.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
-
-/**
- * Function: FORM_OnKeyDown
- * You can call this member function when a nonsystem key is pressed.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * nKeyCode - Indicates whether various virtual keys are down.
- * modifier - Contains the scan code, key-transition code, previous key state, and context code.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
-
-/**
- * Function: FORM_OnKeyUp
- * You can call this member function when a nonsystem key is released.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * nKeyCode - The virtual-key code of the given key.
- * modifier - Contains the scan code, key-transition code, previous key state, and context code.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
-
-/**
- * Function: FORM_OnChar
- * You can call this member function when a keystroke translates to a nonsystem character.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * nChar - The character code value of the key.
- * modifier - Contains the scan code, key-transition code, previous key state, and context code.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nChar, int modifier);
-
-/**
- * Function: FORM_ForceToKillFocus.
- * You can call this member function to force to kill the focus of the form field which got focus.
- * It would kill the focus on the form field, save the value of form field if it's changed by user.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * Return Value:
- * TRUE indicates success; otherwise false.
- **/
-DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
-
-// Field Types
-#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown.
-#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type.
-#define FPDF_FORMFIELD_CHECKBOX 2 // check box type.
-#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type.
-#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type.
-#define FPDF_FORMFIELD_LISTBOX 5 // list box type.
-#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type.
-
-/**
- * Function: FPDPage_HasFormFieldAtPoint
- * Check the form filed position by point.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * page - Handle to the page. Returned by FPDF_LoadPage function.
- * page_x - X position in PDF "user space".
- * page_y - Y position in PDF "user space".
- * Return Value:
- * Return the type of the formfiled; -1 indicates no fields.
- **/
-DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,FPDF_PAGE page,double page_x, double page_y);
-
-/**
- * Function: FPDF_SetFormFieldHighlightColor
- * Set the highlight color of specified or all the form fields in the document.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * doc - Handle to the document. Returned by FPDF_LoadDocument function.
- * fieldType - A 32-bit integer indicating the type of a form field(defined above).
- * color - The highlight color of the form field.Constructed by 0xxxrrggbb.
- * Return Value:
- * NONE.
- * Comments:
- * When the parameter fieldType is set to zero, the highlight color will be applied to all the form fields in the
- * document.
- * Please refresh the client window to show the highlight immediately if necessary.
- **/
-DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color);
-
-/**
- * Function: FPDF_SetFormFieldHighlightAlpha
- * Set the transparency of the form field highlight color in the document.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * doc - Handle to the document. Returned by FPDF_LoadDocument function.
- * alpha - The transparency of the form field highlight color. between 0-255.
- * Return Value:
- * NONE.
- **/
-DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
-
-
-/**
- * Function: FPDF_RemoveFormFieldHighlight
- * Remove the form field highlight color in the document.
- * Parameters:
- * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
- * Return Value:
- * NONE.
- * Comments:
- * Please refresh the client window to remove the highlight immediately if necessary.
- **/
-DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
-
-/**
-* Function: FPDF_FFLDraw
-* Render FormFeilds on a page to a device independent bitmap.
-* Parameters:
-* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
-* bitmap - Handle to the device independent bitmap (as the output buffer).
-* Bitmap handle can be created by FPDFBitmap_Create function.
-* page - Handle to the page. Returned by FPDF_LoadPage function.
-* start_x - Left pixel position of the display area in the device coordinate.
-* start_y - Top pixel position of the display area in the device coordinate.
-* size_x - Horizontal size (in pixels) for displaying the page.
-* size_y - Vertical size (in pixels) for displaying the page.
-* rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
-* 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
-* flags - 0 for normal display, or combination of flags defined above.
-* Return Value:
-* None.
-* Comments:
-* This method is designed to only render annotations and FormFields on the page.
-* Without FPDF_ANNOT specified for flags, Rendering functions such as FPDF_RenderPageBitmap or FPDF_RenderPageBitmap_Start will only render page contents(without annotations) to a bitmap.
-* In order to implement the FormFill functions,Implementation should call this method after rendering functions finish rendering the page contents.
-**/
-DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
- int size_x, int size_y, int rotate, int flags);
-
-
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif //_FPDFORMFILL_H
-
diff --git a/src/main/jni/include/fpdfoom.h b/src/main/jni/include/fpdfoom.h
deleted file mode 100644
index dd14b74b..00000000
--- a/src/main/jni/include/fpdfoom.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFOOM_H_
-#define _FPDFOOM_H_
-
-#ifndef _FPDFVIEW_H_
-#include "fpdfview.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _OOM_INFO
-{
- /**
- * Version number of the interface. Currently must be 1.
- **/
- int version;
-
- /**
- * Method: FSDK_OOM_Handler
- * Out-Of-Memory handling function.
- * Interface Version:
- * 1
- * Implementation Required:
- * Yes
- * Parameters:
- * pThis - Pointer to the interface structure itself.
- * Return value:
- * None.
- * */
-
- void(*FSDK_OOM_Handler)(_OOM_INFO* pThis);
-}OOM_INFO;
-
-
-/**
- * Function: FSDK_SetOOMHandler
- * Setup A Out-Of-Memory handler for foxit sdk.
- * Parameters:
- * oomInfo - Pointer to a OOM_INFO structure.
- * Return Value:
- * TRUE means successful. FALSE means fails.
- **/
-
-DLLEXPORT FPDF_BOOL STDCALL FSDK_SetOOMHandler(OOM_INFO* oomInfo);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-
-
-
-#endif
diff --git a/src/main/jni/include/fpdfppo.h b/src/main/jni/include/fpdfppo.h
deleted file mode 100644
index 57fd6383..00000000
--- a/src/main/jni/include/fpdfppo.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFPPO_H_
-#define _FPDFPPO_H_
-
-#include "fpdfview.h"
-
-// Function: FPDF_ImportPages
-// Import some pages to a PDF document.
-// Parameters:
-// dest_doc - The destination document which add the pages.
-// src_doc - A document to be imported.
-// pagerange - A page range string, Such as "1,3,5-7".
-// If this parameter is NULL, it would import all pages in src_doc.
-// index - The page index wanted to insert from.
-// Return value:
-// TRUE for succeed, FALSE for Failed.
-DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc, FPDF_BYTESTRING pagerange, int index);
-
-
-// Function: FPDF_CopyViewerPreferences
-// Copy the viewer preferences from one PDF document to another.#endif
-// Parameters:
-// dest_doc - Handle to document to write the viewer preferences to.
-// src_doc - Handle to document with the viewer preferences.
-// Return value:
-// TRUE for success, FALSE for failure.
-DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
-#endif
-
diff --git a/src/main/jni/include/fpdfsave.h b/src/main/jni/include/fpdfsave.h
deleted file mode 100644
index a6945608..00000000
--- a/src/main/jni/include/fpdfsave.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFSAVE_H_
-#define _FPDFSAVE_H_
-
-#include "fpdfview.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-// Structure for custom file write
-struct FPDF_FILEWRITE{
-
- //
- //Version number of the interface. Currently must be 1.
- //
- int version;
-
- //
- // Method: WriteBlock
- // Output a block of data in your custom way.
- // Interface Version:
- // 1
- // Implementation Required:
- // Yes
- // Comments:
- // Called by function FPDF_SaveDocument
- // Parameters:
- // pThis - Pointer to the structure itself
- // pData - Pointer to a buffer to output
- // size - The size of the buffer.
- // Return value:
- // Should be non-zero if successful, zero for error.
- //
- int (*WriteBlock)( FPDF_FILEWRITE* pThis, const void* pData, unsigned long size);
-
-};
-
-
-/** @brief Incremental. */
-#define FPDF_INCREMENTAL 1
-/** @brief No Incremental. */
-#define FPDF_NO_INCREMENTAL 2
-
-
-// Function: FPDF_SaveAsCopy
-// Saves the copy of specified document in custom way.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
-// pFileWrite - A pointer to a custom file write structure.
-// flags - The creating flags.
-// Return value:
-// TRUE for succeed, FALSE for failed.
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
- FPDF_DWORD flags );
-
-// Function: FPDF_SaveWithVersion
-// Same as function ::FPDF_SaveAsCopy, except the file version of the saved document could be specified by user.
-// Parameters:
-// document - Handle to document.
-// pFileWrite - A pointer to a custom file write structure.
-// flags - The creating flags.
-// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
-// Return value:
-// TRUE if succeed, FALSE if failed.
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
- FPDF_DWORD flags, int fileVersion);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif //_FPDFSAVE_H_
diff --git a/src/main/jni/include/fpdftext.h b/src/main/jni/include/fpdftext.h
deleted file mode 100644
index 8b897798..00000000
--- a/src/main/jni/include/fpdftext.h
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFTEXT_H_
-#define _FPDFTEXT_H_
-
-#include "fpdfview.h"
-
-// Exported Functions
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Function: FPDFText_LoadPage
-// Prepare information about all characters in a page.
-// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function (in FPDFVIEW module).
-// Return value:
-// A handle to the text page information structure.
-// NULL if something goes wrong.
-// Comments:
-// Application must call FPDFText_ClosePage to release the text page information.
-// If you don't purchase Text Module , this function will return NULL.
-//
-DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
-
-// Function: FPDFText_ClosePage
-// Release all resources allocated for a text page information structure.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// Return Value:
-// None.
-//
-DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
-
-// Function: FPDFText_CountChars
-// Get number of characters in a page.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// Return value:
-// Number of characters in the page. Return -1 for error.
-// Generated characters, like additional space characters, new line characters, are also counted.
-// Comments:
-// Characters in a page form a "stream", inside the stream, each character has an index.
-// We will use the index parameters in many of FPDFTEXT functions. The first character in the page
-// has an index value of zero.
-//
-DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
-
-// Function: FPDFText_GetUnicode
-// Get Unicode of a character in a page.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// index - Zero-based index of the character.
-// Return value:
-// The Unicode of the particular character.
-// If a character is not encoded in Unicode and Foxit engine can't convert to Unicode,
-// the return value will be zero.
-//
-DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
-
-// Function: FPDFText_GetFontSize
-// Get the font size of a particular character.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// index - Zero-based index of the character.
-// Return value:
-// The font size of the particular character, measured in points (about 1/72 inch).
-// This is the typographic size of the font (so called "em size").
-//
-DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index);
-
-// Function: FPDFText_GetCharBox
-// Get bounding box of a particular character.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// index - Zero-based index of the character.
-// left - Pointer to a double number receiving left position of the character box.
-// right - Pointer to a double number receiving right position of the character box.
-// bottom - Pointer to a double number receiving bottom position of the character box.
-// top - Pointer to a double number receiving top position of the character box.
-// Return Value:
-// None.
-// Comments:
-// All positions are measured in PDF "user space".
-//
-DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, double* left,
- double* right, double* bottom, double* top);
-
-// Function: FPDFText_GetCharIndexAtPos
-// Get the index of a character at or nearby a certain position on the page.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// x - X position in PDF "user space".
-// y - Y position in PDF "user space".
-// xTolerance - An x-axis tolerance value for character hit detection, in point unit.
-// yTolerance - A y-axis tolerance value for character hit detection, in point unit.
-// Return Value:
-// The zero-based index of the character at, or nearby the point (x,y).
-// If there is no character at or nearby the point, return value will be -1.
-// If an error occurs, -3 will be returned.
-//
-DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
- double x, double y, double xTorelance, double yTolerance);
-
-// Function: FPDFText_GetText
-// Extract unicode text string from the page.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// start_index - Index for the start characters.
-// count - Number of characters to be extracted.
-// result - A buffer (allocated by application) receiving the extracted unicodes.
-// The size of the buffer must be able to hold the number of characters plus a terminator.
-// Return Value:
-// Number of characters written into the result buffer, including the trailing terminator.
-// Comments:
-// This function ignores characters without unicode information.
-//
-DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index, int count, unsigned short* result);
-
-// Function: FPDFText_CountRects
-// Count number of rectangular areas occupied by a segment of texts.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// start_index - Index for the start characters.
-// count - Number of characters.
-// Return value:
-// Number of rectangles. Zero for error.
-// Comments:
-// This function, along with FPDFText_GetRect can be used by applications to detect the position
-// on the page for a text segment, so proper areas can be highlighted or something.
-// FPDFTEXT will automatically merge small character boxes into bigger one if those characters
-// are on the same line and use same font settings.
-//
-DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_index, int count);
-
-// Function: FPDFText_GetRect
-// Get a rectangular area from the result generated by FPDFText_CountRects.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// rect_index - Zero-based index for the rectangle.
-// left - Pointer to a double value receiving the rectangle left boundary.
-// top - Pointer to a double value receiving the rectangle top boundary.
-// right - Pointer to a double value receiving the rectangle right boundary.
-// bottom - Pointer to a double value receiving the rectangle bottom boundary.
-// Return Value:
-// None.
-//
-DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index, double* left, double* top,
- double* right, double* bottom);
-
-// Function: FPDFText_GetBoundedText
-// Extract unicode text within a rectangular boundary on the page.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// left - Left boundary.
-// top - Top boundary.
-// right - Right boundary.
-// bottom - Bottom boundary.
-// buffer - A unicode buffer.
-// buflen - Number of characters (not bytes) for the buffer, excluding an additional terminator.
-// Return Value:
-// If buffer is NULL or buflen is zero, return number of characters (not bytes) needed,
-// otherwise, return number of characters copied into the buffer.
-//
-DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double left, double top,
- double right, double bottom,unsigned short* buffer,int buflen);
-
-
-// Flags used by FPDFText_FindStart function.
-#define FPDF_MATCHCASE 0x00000001 //If not set, it will not match case by default.
-#define FPDF_MATCHWHOLEWORD 0x00000002 //If not set, it will not match the whole word by default.
-
-// Function: FPDFText_FindStart
-// Start a search.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// findwhat - A unicode match pattern.
-// flags - Option flags.
-// start_index - Start from this character. -1 for end of the page.
-// Return Value:
-// A handle for the search context. FPDFText_FindClose must be called to release this handle.
-//
-DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPDF_WIDESTRING findwhat,
- unsigned long flags, int start_index);
-
-// Function: FPDFText_FindNext
-// Search in the direction from page start to end.
-// Parameters:
-// handle - A search context handle returned by FPDFText_FindStart.
-// Return Value:
-// Whether a match is found.
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
-
-// Function: FPDFText_FindPrev
-// Search in the direction from page end to start.
-// Parameters:
-// handle - A search context handle returned by FPDFText_FindStart.
-// Return Value:
-// Whether a match is found.
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
-
-// Function: FPDFText_GetSchResultIndex
-// Get the starting character index of the search result.
-// Parameters:
-// handle - A search context handle returned by FPDFText_FindStart.
-// Return Value:
-// Index for the starting character.
-//
-DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
-
-// Function: FPDFText_GetSchCount
-// Get the number of matched characters in the search result.
-// Parameters:
-// handle - A search context handle returned by FPDFText_FindStart.
-// Return Value:
-// Number of matched characters.
-//
-DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
-
-// Function: FPDFText_FindClose
-// Release a search context.
-// Parameters:
-// handle - A search context handle returned by FPDFText_FindStart.
-// Return Value:
-// None.
-//
-DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
-
-// Function: FPDFLink_LoadWebLinks
-// Prepare information about weblinks in a page.
-// Parameters:
-// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
-// Return Value:
-// A handle to the page's links information structure.
-// NULL if something goes wrong.
-// Comments:
-// Weblinks are those links implicitly embedded in PDF pages. PDF also has a type of
-// annotation called "link", FPDFTEXT doesn't deal with that kind of link.
-// FPDFTEXT weblink feature is useful for automatically detecting links in the page
-// contents. For example, things like "http://www.foxitsoftware.com" will be detected,
-// so applications can allow user to click on those characters to activate the link,
-// even the PDF doesn't come with link annotations.
-//
-// FPDFLink_CloseWebLinks must be called to release resources.
-//
-DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
-
-// Function: FPDFLink_CountWebLinks
-// Count number of detected web links.
-// Parameters:
-// link_page - Handle returned by FPDFLink_LoadWebLinks.
-// Return Value:
-// Number of detected web links.
-//
-DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
-
-// Function: FPDFLink_GetURL
-// Fetch the URL information for a detected web link.
-// Parameters:
-// link_page - Handle returned by FPDFLink_LoadWebLinks.
-// link_index - Zero-based index for the link.
-// buffer - A unicode buffer.
-// buflen - Number of characters (not bytes) for the buffer, including an additional terminator.
-// Return Value:
-// If buffer is NULL or buflen is zero, return number of characters (not bytes and an additional terminator is also counted) needed,
-// otherwise, return number of characters copied into the buffer.
-//
-DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, unsigned short* buffer,int buflen);
-
-// Function: FPDFLink_CountRects
-// Count number of rectangular areas for the link.
-// Parameters:
-// link_page - Handle returned by FPDFLink_LoadWebLinks.
-// link_index - Zero-based index for the link.
-// Return Value:
-// Number of rectangular areas for the link.
-//
-DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_index);
-
-// Function: FPDFLink_GetRect
-// Fetch the boundaries of a rectangle for a link.
-// Parameters:
-// link_page - Handle returned by FPDFLink_LoadWebLinks.
-// link_index - Zero-based index for the link.
-// rect_index - Zero-based index for a rectangle.
-// left - Pointer to a double value receiving the rectangle left boundary.
-// top - Pointer to a double value receiving the rectangle top boundary.
-// right - Pointer to a double value receiving the rectangle right boundary.
-// bottom - Pointer to a double value receiving the rectangle bottom boundary.
-// Return Value:
-// None.
-//
-DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index, int rect_index,
- double* left, double* top,double* right, double* bottom);
-
-// Function: FPDFLink_CloseWebLinks
-// Release resources used by weblink feature.
-// Parameters:
-// link_page - Handle returned by FPDFLink_LoadWebLinks.
-// Return Value:
-// None.
-//
-DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif//_FPDFTEXT_H_
diff --git a/src/main/jni/include/fpdfview.h b/src/main/jni/include/fpdfview.h
index a5637626..97e055fa 100644
--- a/src/main/jni/include/fpdfview.h
+++ b/src/main/jni/include/fpdfview.h
@@ -1,578 +1,1462 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+// This is the main header file for embedders of PDFium. It provides APIs to
+// initialize the library, load documents, and render pages, amongst other
+// things.
+//
+// NOTE: None of the PDFium APIs are thread-safe. They expect to be called
+// from a single thread. Barring that, embedders are required to ensure (via
+// a mutex or similar) that only a single PDFium call can be made at a time.
+//
+// NOTE: External docs refer to this file as "fpdfview.h", so do not rename
+// despite lack of consistency with other public files.
+
+#ifndef PUBLIC_FPDFVIEW_H_
+#define PUBLIC_FPDFVIEW_H_
-#ifndef _FPDFVIEW_H_
-#define _FPDFVIEW_H_
+// clang-format off
+
+#include
#if defined(_WIN32) && !defined(__WINDOWS__)
#include
#endif
-// Data types
-typedef void* FPDF_MODULEMGR;
-
-// PDF types
-typedef void* FPDF_DOCUMENT;
-typedef void* FPDF_PAGE;
-typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc)
-typedef void* FPDF_PATH;
-typedef void* FPDF_CLIPPATH;
-typedef void* FPDF_BITMAP;
-typedef void* FPDF_FONT;
-
-typedef void* FPDF_TEXTPAGE;
-typedef void* FPDF_SCHHANDLE;
-typedef void* FPDF_PAGELINK;
-typedef void* FPDF_HMODULE;
-typedef void* FPDF_DOCSCHHANDLE;
-
-typedef void* FPDF_BOOKMARK;
-typedef void* FPDF_DEST;
-typedef void* FPDF_ACTION;
-typedef void* FPDF_LINK;
+#ifdef PDF_ENABLE_XFA
+// PDF_USE_XFA is set in confirmation that this version of PDFium can support
+// XFA forms as requested by the PDF_ENABLE_XFA setting.
+#define PDF_USE_XFA
+#endif // PDF_ENABLE_XFA
+
+// PDF object types
+#define FPDF_OBJECT_UNKNOWN 0
+#define FPDF_OBJECT_BOOLEAN 1
+#define FPDF_OBJECT_NUMBER 2
+#define FPDF_OBJECT_STRING 3
+#define FPDF_OBJECT_NAME 4
+#define FPDF_OBJECT_ARRAY 5
+#define FPDF_OBJECT_DICTIONARY 6
+#define FPDF_OBJECT_STREAM 7
+#define FPDF_OBJECT_NULLOBJ 8
+#define FPDF_OBJECT_REFERENCE 9
+
+// PDF text rendering modes
+typedef enum {
+ FPDF_TEXTRENDERMODE_UNKNOWN = -1,
+ FPDF_TEXTRENDERMODE_FILL = 0,
+ FPDF_TEXTRENDERMODE_STROKE = 1,
+ FPDF_TEXTRENDERMODE_FILL_STROKE = 2,
+ FPDF_TEXTRENDERMODE_INVISIBLE = 3,
+ FPDF_TEXTRENDERMODE_FILL_CLIP = 4,
+ FPDF_TEXTRENDERMODE_STROKE_CLIP = 5,
+ FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP = 6,
+ FPDF_TEXTRENDERMODE_CLIP = 7,
+ FPDF_TEXTRENDERMODE_LAST = FPDF_TEXTRENDERMODE_CLIP,
+} FPDF_TEXT_RENDERMODE;
+
+// PDF types - use incomplete types (never completed) to force API type safety.
+typedef struct fpdf_action_t__* FPDF_ACTION;
+typedef struct fpdf_annotation_t__* FPDF_ANNOTATION;
+typedef struct fpdf_attachment_t__* FPDF_ATTACHMENT;
+typedef struct fpdf_avail_t__* FPDF_AVAIL;
+typedef struct fpdf_bitmap_t__* FPDF_BITMAP;
+typedef struct fpdf_bookmark_t__* FPDF_BOOKMARK;
+typedef struct fpdf_clippath_t__* FPDF_CLIPPATH;
+typedef struct fpdf_dest_t__* FPDF_DEST;
+typedef struct fpdf_document_t__* FPDF_DOCUMENT;
+typedef struct fpdf_font_t__* FPDF_FONT;
+typedef struct fpdf_form_handle_t__* FPDF_FORMHANDLE;
+typedef const struct fpdf_glyphpath_t__* FPDF_GLYPHPATH;
+typedef struct fpdf_javascript_action_t* FPDF_JAVASCRIPT_ACTION;
+typedef struct fpdf_link_t__* FPDF_LINK;
+typedef struct fpdf_page_t__* FPDF_PAGE;
+typedef struct fpdf_pagelink_t__* FPDF_PAGELINK;
+typedef struct fpdf_pageobject_t__* FPDF_PAGEOBJECT; // (text, path, etc.)
+typedef struct fpdf_pageobjectmark_t__* FPDF_PAGEOBJECTMARK;
+typedef const struct fpdf_pagerange_t__* FPDF_PAGERANGE;
+typedef const struct fpdf_pathsegment_t* FPDF_PATHSEGMENT;
+typedef struct fpdf_schhandle_t__* FPDF_SCHHANDLE;
+typedef const struct fpdf_signature_t__* FPDF_SIGNATURE;
+typedef void* FPDF_SKIA_CANVAS; // Passed into Skia as an SkCanvas.
+typedef struct fpdf_structelement_t__* FPDF_STRUCTELEMENT;
+typedef const struct fpdf_structelement_attr_t__* FPDF_STRUCTELEMENT_ATTR;
+typedef const struct fpdf_structelement_attr_value_t__*
+FPDF_STRUCTELEMENT_ATTR_VALUE;
+typedef struct fpdf_structtree_t__* FPDF_STRUCTTREE;
+typedef struct fpdf_textpage_t__* FPDF_TEXTPAGE;
+typedef struct fpdf_widget_t__* FPDF_WIDGET;
+typedef struct fpdf_xobject_t__* FPDF_XOBJECT;
// Basic data types
-typedef int FPDF_BOOL;
-typedef int FPDF_ERROR;
-typedef unsigned long FPDF_DWORD;
+typedef int FPDF_BOOL;
+typedef int FPDF_RESULT;
+typedef unsigned long FPDF_DWORD;
+typedef float FS_FLOAT;
-typedef float FS_FLOAT;
+// Duplex types
+typedef enum _FPDF_DUPLEXTYPE_ {
+ DuplexUndefined = 0,
+ Simplex,
+ DuplexFlipShortEdge,
+ DuplexFlipLongEdge
+} FPDF_DUPLEXTYPE;
// String types
-typedef unsigned short FPDF_WCHAR;
-typedef unsigned char const* FPDF_LPCBYTE;
+typedef unsigned short FPDF_WCHAR;
-// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string
-typedef const char* FPDF_BYTESTRING;
+// The public PDFium API uses three types of strings: byte string, wide string
+// (UTF-16LE encoded), and platform dependent string.
-typedef const unsigned short* FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string,
- // each character use 2 bytes (except surrogation), with low byte first.
+// Public PDFium API type for byte strings.
+typedef const char* FPDF_BYTESTRING;
-// For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Windows unicode string,
-// however, special care needs to be taken if you expect to process Unicode larger than 0xffff.
-// For Linux/Unix programmers: most compiler/library environment uses 4 bytes for a Unicode character,
-// you have to convert between FPDF_WIDESTRING and system wide string by yourself.
+// The public PDFium API always uses UTF-16LE encoded wide strings, each
+// character uses 2 bytes (except surrogation), with the low byte first.
+typedef const FPDF_WCHAR* FPDF_WIDESTRING;
-#ifdef _WIN32_WCE
-typedef const unsigned short* FPDF_STRING;
-#else
+// Structure for persisting a string beyond the duration of a callback.
+// Note: although represented as a char*, string may be interpreted as
+// a UTF-16LE formated string. Used only by XFA callbacks.
+typedef struct FPDF_BSTR_ {
+ char* str; // String buffer, manipulate only with FPDF_BStr_* methods.
+ int len; // Length of the string, in bytes.
+} FPDF_BSTR;
+
+// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a
+// Windows unicode string, however, special care needs to be taken if you
+// expect to process Unicode larger than 0xffff.
+//
+// For Linux/Unix programmers: most compiler/library environments use 4 bytes
+// for a Unicode character, and you have to convert between FPDF_WIDESTRING and
+// system wide string by yourself.
typedef const char* FPDF_STRING;
-#endif
-#ifndef _FS_DEF_MATRIX_
-#define _FS_DEF_MATRIX_
-/** @brief Matrix for transformation. */
-typedef struct _FS_MATRIX_
-{
- float a; /**< @brief Coefficient a.*/
- float b; /**< @brief Coefficient b.*/
- float c; /**< @brief Coefficient c.*/
- float d; /**< @brief Coefficient d.*/
- float e; /**< @brief Coefficient e.*/
- float f; /**< @brief Coefficient f.*/
+// Matrix for transformation, in the form [a b c d e f], equivalent to:
+// | a b 0 |
+// | c d 0 |
+// | e f 1 |
+//
+// Translation is performed with [1 0 0 1 tx ty].
+// Scaling is performed with [sx 0 0 sy 0 0].
+// See PDF Reference 1.7, 4.2.2 Common Transformations for more.
+typedef struct _FS_MATRIX_ {
+ float a;
+ float b;
+ float c;
+ float d;
+ float e;
+ float f;
} FS_MATRIX;
-#endif
-#ifndef _FS_DEF_RECTF_
-#define _FS_DEF_RECTF_
-/** @brief Rectangle area(float) in device or page coordination system. */
-typedef struct _FS_RECTF_
-{
- /**@{*/
- /** @brief The x-coordinate of the left-top corner. */
- float left;
- /** @brief The y-coordinate of the left-top corner. */
- float top;
- /** @brief The x-coordinate of the right-bottom corner. */
- float right;
- /** @brief The y-coordinate of the right-bottom corner. */
- float bottom;
- /**@}*/
-}* FS_LPRECTF, FS_RECTF;
-/** @brief Const Pointer to ::FS_RECTF structure.*/
-typedef const FS_RECTF* FS_LPCRECTF;
-#endif
+// Rectangle area(float) in device or page coordinate system.
+typedef struct _FS_RECTF_ {
+ // The x-coordinate of the left-top corner.
+ float left;
+ // The y-coordinate of the left-top corner.
+ float top;
+ // The x-coordinate of the right-bottom corner.
+ float right;
+ // The y-coordinate of the right-bottom corner.
+ float bottom;
+} * FS_LPRECTF, FS_RECTF;
+
+// Const Pointer to FS_RECTF structure.
+typedef const FS_RECTF* FS_LPCRECTF;
+
+// Rectangle size. Coordinate system agnostic.
+typedef struct FS_SIZEF_ {
+ float width;
+ float height;
+} * FS_LPSIZEF, FS_SIZEF;
+
+// Const Pointer to FS_SIZEF structure.
+typedef const FS_SIZEF* FS_LPCSIZEF;
+
+// 2D Point. Coordinate system agnostic.
+typedef struct FS_POINTF_ {
+ float x;
+ float y;
+} * FS_LPPOINTF, FS_POINTF;
-#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
-// On Windows system, functions are exported in a DLL
-#define DLLEXPORT __declspec( dllexport )
-#define STDCALL __stdcall
+// Const Pointer to FS_POINTF structure.
+typedef const FS_POINTF* FS_LPCPOINTF;
+
+typedef struct _FS_QUADPOINTSF {
+ FS_FLOAT x1;
+ FS_FLOAT y1;
+ FS_FLOAT x2;
+ FS_FLOAT y2;
+ FS_FLOAT x3;
+ FS_FLOAT y3;
+ FS_FLOAT x4;
+ FS_FLOAT y4;
+} FS_QUADPOINTSF;
+
+// Annotation enums.
+typedef int FPDF_ANNOTATION_SUBTYPE;
+typedef int FPDF_ANNOT_APPEARANCEMODE;
+
+// Dictionary value types.
+typedef int FPDF_OBJECT_TYPE;
+
+#if defined(WIN32)
+#if defined(FPDF_IMPLEMENTATION)
+#define FPDF_EXPORT __declspec(dllexport)
#else
-#define DLLEXPORT
-#define STDCALL
-#endif
+#define FPDF_EXPORT __declspec(dllimport)
+#endif // defined(FPDF_IMPLEMENTATION)
+#else
+#if defined(FPDF_IMPLEMENTATION)
+#define FPDF_EXPORT __attribute__((visibility("default")))
+#else
+#define FPDF_EXPORT
+#endif // defined(FPDF_IMPLEMENTATION)
+#endif // defined(WIN32)
-extern const char g_ExpireDate[];
-extern const char g_ModuleCodes[];
+#if defined(WIN32) && defined(FPDFSDK_EXPORTS)
+#define FPDF_CALLCONV __stdcall
+#else
+#define FPDF_CALLCONV
+#endif
// Exported Functions
#ifdef __cplusplus
extern "C" {
#endif
-// Function: FPDF_InitLibrary
-// Initialize the FPDFSDK library
+// PDF renderer types - Experimental.
+// Selection of 2D graphics library to use for rendering to FPDF_BITMAPs.
+typedef enum {
+ // Anti-Grain Geometry - https://sourceforge.net/projects/agg/
+ FPDF_RENDERERTYPE_AGG = 0,
+ // Skia - https://skia.org/
+ FPDF_RENDERERTYPE_SKIA = 1,
+} FPDF_RENDERER_TYPE;
+
+// Process-wide options for initializing the library.
+typedef struct FPDF_LIBRARY_CONFIG_ {
+ // Version number of the interface. Currently must be 2.
+ // Support for version 1 will be deprecated in the future.
+ int version;
+
+ // Array of paths to scan in place of the defaults when using built-in
+ // FXGE font loading code. The array is terminated by a NULL pointer.
+ // The Array may be NULL itself to use the default paths. May be ignored
+ // entirely depending upon the platform.
+ const char** m_pUserFontPaths;
+
+ // Version 2.
+
+ // Pointer to the v8::Isolate to use, or NULL to force PDFium to create one.
+ void* m_pIsolate;
+
+ // The embedder data slot to use in the v8::Isolate to store PDFium's
+ // per-isolate data. The value needs to be in the range
+ // [0, |v8::Internals::kNumIsolateDataLots|). Note that 0 is fine for most
+ // embedders.
+ unsigned int m_v8EmbedderSlot;
+
+ // Version 3 - Experimental.
+
+ // Pointer to the V8::Platform to use.
+ void* m_pPlatform;
+
+ // Version 4 - Experimental.
+
+ // Explicit specification of core renderer to use. |m_RendererType| must be
+ // a valid value for |FPDF_LIBRARY_CONFIG| versions of this level or higher,
+ // or else the initialization will fail with an immediate crash.
+ // Note that use of a specified |FPDF_RENDERER_TYPE| value for which the
+ // corresponding render library is not included in the build will similarly
+ // fail with an immediate crash.
+ FPDF_RENDERER_TYPE m_RendererType;
+} FPDF_LIBRARY_CONFIG;
+
+// Function: FPDF_InitLibraryWithConfig
+// Initialize the PDFium library and allocate global resources for it.
// Parameters:
-// hInstance - For WIN32 system only: the instance of the executable or DLL module.
+// config - configuration information as above.
// Return value:
-// None.
+// None.
// Comments:
-// You have to call this function before you can call any PDF processing functions.
-
-DLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance);
+// You have to call this function before you can call any PDF
+// processing functions.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config);
+// Function: FPDF_InitLibrary
+// Initialize the PDFium library (alternative form).
+// Parameters:
+// None
+// Return value:
+// None.
+// Comments:
+// Convenience function to call FPDF_InitLibraryWithConfig() with a
+// default configuration for backwards compatibility purposes. New
+// code should call FPDF_InitLibraryWithConfig() instead. This will
+// be deprecated in the future.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibrary();
-// Function: FPDF_DestroyLibary
-// Release all resources allocated by the FPDFSDK library.
+// Function: FPDF_DestroyLibrary
+// Release global resources allocated to the PDFium library by
+// FPDF_InitLibrary() or FPDF_InitLibraryWithConfig().
// Parameters:
-// None.
+// None.
// Return value:
-// None.
+// None.
// Comments:
-// You can call this function to release all memory blocks allocated by the library.
-// After this function called, you should not call any PDF processing functions.
-DLLEXPORT void STDCALL FPDF_DestroyLibrary();
+// After this function is called, you must not call any PDF
+// processing functions.
+//
+// Calling this function does not automatically close other
+// objects. It is recommended to close other objects before
+// closing the library with this function.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary();
-//Policy for accessing the local machine time.
-#define FPDF_POLICY_MACHINETIME_ACCESS 0
+// Policy for accessing the local machine time.
+#define FPDF_POLICY_MACHINETIME_ACCESS 0
// Function: FPDF_SetSandBoxPolicy
-// Set the policy for the sandbox environment.
-// Parameters:
-// policy - The specified policy for setting, for example:FPDF_POLICY_MACHINETIME_ACCESS.
-// enable - True for enable, False for disable the policy.
-// Return value:
-// None.
-DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
-
-/**
-* Open and load a PDF document.
-* @param[in] file_path - Path to the PDF file (including extension).
-* @param[in] password - A string used as the password for PDF file.
-* If no password needed, empty or NULL can be used.
-* @note Loaded document can be closed by FPDF_CloseDocument.
-* If this function fails, you can use FPDF_GetLastError() to retrieve
-* the reason why it fails.
-* @retval A handle to the loaded document. If failed, NULL is returned.
-*/
-DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
- FPDF_BYTESTRING password);
+// Set the policy for the sandbox environment.
+// Parameters:
+// policy - The specified policy for setting, for example:
+// FPDF_POLICY_MACHINETIME_ACCESS.
+// enable - True to enable, false to disable the policy.
+// Return value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_SetSandBoxPolicy(FPDF_DWORD policy,
+ FPDF_BOOL enable);
+
+#if defined(_WIN32)
+// Experimental API.
+// Function: FPDF_SetPrintMode
+// Set printing mode when printing on Windows.
+// Parameters:
+// mode - FPDF_PRINTMODE_EMF to output EMF (default)
+// FPDF_PRINTMODE_TEXTONLY to output text only (for charstream
+// devices)
+// FPDF_PRINTMODE_POSTSCRIPT2 to output level 2 PostScript into
+// EMF as a series of GDI comments.
+// FPDF_PRINTMODE_POSTSCRIPT3 to output level 3 PostScript into
+// EMF as a series of GDI comments.
+// FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH to output level 2
+// PostScript via ExtEscape() in PASSTHROUGH mode.
+// FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH to output level 3
+// PostScript via ExtEscape() in PASSTHROUGH mode.
+// FPDF_PRINTMODE_EMF_IMAGE_MASKS to output EMF, with more
+// efficient processing of documents containing image masks.
+// FPDF_PRINTMODE_POSTSCRIPT3_TYPE42 to output level 3
+// PostScript with embedded Type 42 fonts, when applicable, into
+// EMF as a series of GDI comments.
+// FPDF_PRINTMODE_POSTSCRIPT3_TYPE42_PASSTHROUGH to output level
+// 3 PostScript with embedded Type 42 fonts, when applicable,
+// via ExtEscape() in PASSTHROUGH mode.
+// Return value:
+// True if successful, false if unsuccessful (typically invalid input).
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode);
+#endif // defined(_WIN32)
+
+// Function: FPDF_LoadDocument
+// Open and load a PDF document.
+// Parameters:
+// file_path - Path to the PDF file (including extension).
+// password - A string used as the password for the PDF file.
+// If no password is needed, empty or NULL can be used.
+// See comments below regarding the encoding.
+// Return value:
+// A handle to the loaded document, or NULL on failure.
+// Comments:
+// Loaded document can be closed by FPDF_CloseDocument().
+// If this function fails, you can use FPDF_GetLastError() to retrieve
+// the reason why it failed.
+//
+// The encoding for |file_path| is UTF-8.
+//
+// The encoding for |password| can be either UTF-8 or Latin-1. PDFs,
+// depending on the security handler revision, will only accept one or
+// the other encoding. If |password|'s encoding and the PDF's expected
+// encoding do not match, FPDF_LoadDocument() will automatically
+// convert |password| to the other encoding.
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
+FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password);
// Function: FPDF_LoadMemDocument
-// Open and load a PDF document from memory.
-// Parameters:
-// data_buf - Pointer to a buffer containing the PDF document.
-// size - Number of bytes in the PDF document.
-// password - A string used as the password for PDF file.
-// If no password needed, empty or NULL can be used.
-// Return value:
-// A handle to the loaded document. If failed, NULL is returned.
+// Open and load a PDF document from memory.
+// Parameters:
+// data_buf - Pointer to a buffer containing the PDF document.
+// size - Number of bytes in the PDF document.
+// password - A string used as the password for the PDF file.
+// If no password is needed, empty or NULL can be used.
+// Return value:
+// A handle to the loaded document, or NULL on failure.
// Comments:
-// The memory buffer must remain valid when the document is open.
-// Loaded document can be closed by FPDF_CloseDocument.
-// If this function fails, you can use FPDF_GetLastError() to retrieve
-// the reason why it fails.
+// The memory buffer must remain valid when the document is open.
+// The loaded document can be closed by FPDF_CloseDocument.
+// If this function fails, you can use FPDF_GetLastError() to retrieve
+// the reason why it failed.
//
-DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
- int size, FPDF_BYTESTRING password);
+// See the comments for FPDF_LoadDocument() regarding the encoding for
+// |password|.
+// Notes:
+// If PDFium is built with the XFA module, the application should call
+// FPDF_LoadXFA() function after the PDF document loaded to support XFA
+// fields defined in the fpdfformfill.h file.
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
+FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password);
+
+// Experimental API.
+// Function: FPDF_LoadMemDocument64
+// Open and load a PDF document from memory.
+// Parameters:
+// data_buf - Pointer to a buffer containing the PDF document.
+// size - Number of bytes in the PDF document.
+// password - A string used as the password for the PDF file.
+// If no password is needed, empty or NULL can be used.
+// Return value:
+// A handle to the loaded document, or NULL on failure.
+// Comments:
+// The memory buffer must remain valid when the document is open.
+// The loaded document can be closed by FPDF_CloseDocument.
+// If this function fails, you can use FPDF_GetLastError() to retrieve
+// the reason why it failed.
+//
+// See the comments for FPDF_LoadDocument() regarding the encoding for
+// |password|.
+// Notes:
+// If PDFium is built with the XFA module, the application should call
+// FPDF_LoadXFA() function after the PDF document loaded to support XFA
+// fields defined in the fpdfformfill.h file.
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
+FPDF_LoadMemDocument64(const void* data_buf,
+ size_t size,
+ FPDF_BYTESTRING password);
// Structure for custom file access.
typedef struct {
- // File length, in bytes.
- unsigned long m_FileLen;
-
- // A function pointer for getting a block of data from specific position.
- // Position is specified by byte offset from beginning of the file.
- // The position and size will never go out range of file length.
- // It may be possible for FPDFSDK to call this function multiple times for same position.
- // Return value: should be non-zero if successful, zero for error.
- int (*m_GetBlock)(void* param, unsigned long position, unsigned char* pBuf, unsigned long size);
-
- // A custom pointer for all implementation specific data.
- // This pointer will be used as the first parameter to m_GetBlock callback.
- void* m_Param;
+ // File length, in bytes.
+ unsigned long m_FileLen;
+
+ // A function pointer for getting a block of data from a specific position.
+ // Position is specified by byte offset from the beginning of the file.
+ // The pointer to the buffer is never NULL and the size is never 0.
+ // The position and size will never go out of range of the file length.
+ // It may be possible for PDFium to call this function multiple times for
+ // the same position.
+ // Return value: should be non-zero if successful, zero for error.
+ int (*m_GetBlock)(void* param,
+ unsigned long position,
+ unsigned char* pBuf,
+ unsigned long size);
+
+ // A custom pointer for all implementation specific data. This pointer will
+ // be used as the first parameter to the m_GetBlock callback.
+ void* m_Param;
} FPDF_FILEACCESS;
+// Structure for file reading or writing (I/O).
+//
+// Note: This is a handler and should be implemented by callers,
+// and is only used from XFA.
+typedef struct FPDF_FILEHANDLER_ {
+ // User-defined data.
+ // Note: Callers can use this field to track controls.
+ void* clientData;
+
+ // Callback function to release the current file stream object.
+ //
+ // Parameters:
+ // clientData - Pointer to user-defined data.
+ // Returns:
+ // None.
+ void (*Release)(void* clientData);
+
+ // Callback function to retrieve the current file stream size.
+ //
+ // Parameters:
+ // clientData - Pointer to user-defined data.
+ // Returns:
+ // Size of file stream.
+ FPDF_DWORD (*GetSize)(void* clientData);
+
+ // Callback function to read data from the current file stream.
+ //
+ // Parameters:
+ // clientData - Pointer to user-defined data.
+ // offset - Offset position starts from the beginning of file
+ // stream. This parameter indicates reading position.
+ // buffer - Memory buffer to store data which are read from
+ // file stream. This parameter should not be NULL.
+ // size - Size of data which should be read from file stream,
+ // in bytes. The buffer indicated by |buffer| must be
+ // large enough to store specified data.
+ // Returns:
+ // 0 for success, other value for failure.
+ FPDF_RESULT (*ReadBlock)(void* clientData,
+ FPDF_DWORD offset,
+ void* buffer,
+ FPDF_DWORD size);
+
+ // Callback function to write data into the current file stream.
+ //
+ // Parameters:
+ // clientData - Pointer to user-defined data.
+ // offset - Offset position starts from the beginning of file
+ // stream. This parameter indicates writing position.
+ // buffer - Memory buffer contains data which is written into
+ // file stream. This parameter should not be NULL.
+ // size - Size of data which should be written into file
+ // stream, in bytes.
+ // Returns:
+ // 0 for success, other value for failure.
+ FPDF_RESULT (*WriteBlock)(void* clientData,
+ FPDF_DWORD offset,
+ const void* buffer,
+ FPDF_DWORD size);
+ // Callback function to flush all internal accessing buffers.
+ //
+ // Parameters:
+ // clientData - Pointer to user-defined data.
+ // Returns:
+ // 0 for success, other value for failure.
+ FPDF_RESULT (*Flush)(void* clientData);
+
+ // Callback function to change file size.
+ //
+ // Description:
+ // This function is called under writing mode usually. Implementer
+ // can determine whether to realize it based on application requests.
+ // Parameters:
+ // clientData - Pointer to user-defined data.
+ // size - New size of file stream, in bytes.
+ // Returns:
+ // 0 for success, other value for failure.
+ FPDF_RESULT (*Truncate)(void* clientData, FPDF_DWORD size);
+} FPDF_FILEHANDLER;
+
// Function: FPDF_LoadCustomDocument
-// Load PDF document from a custom access descriptor.
+// Load PDF document from a custom access descriptor.
// Parameters:
-// pFileAccess - A structure for access the file.
-// password - Optional password for decrypting the PDF file.
+// pFileAccess - A structure for accessing the file.
+// password - Optional password for decrypting the PDF file.
// Return value:
-// A handle to the loaded document. If failed, NULL is returned.
+// A handle to the loaded document, or NULL on failure.
// Comments:
-// The application should maintain the file resources being valid until the PDF document close.
-// Loaded document can be closed by FPDF_CloseDocument.
-DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess,
- FPDF_BYTESTRING password);
+// The application must keep the file resources |pFileAccess| points to
+// valid until the returned FPDF_DOCUMENT is closed. |pFileAccess|
+// itself does not need to outlive the FPDF_DOCUMENT.
+//
+// The loaded document can be closed with FPDF_CloseDocument().
+//
+// See the comments for FPDF_LoadDocument() regarding the encoding for
+// |password|.
+// Notes:
+// If PDFium is built with the XFA module, the application should call
+// FPDF_LoadXFA() function after the PDF document loaded to support XFA
+// fields defined in the fpdfformfill.h file.
+FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
+FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password);
// Function: FPDF_GetFileVersion
-// Get the file version of the specific PDF document.
+// Get the file version of the given PDF document.
// Parameters:
-// doc - Handle to document.
-// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
+// doc - Handle to a document.
+// fileVersion - The PDF file version. File version: 14 for 1.4, 15
+// for 1.5, ...
// Return value:
-// TRUE if this call succeed, If failed, FALSE is returned.
+// True if succeeds, false otherwise.
// Comments:
-// If the document is created by function ::FPDF_CreateNewDocument, then this function would always fail.
-DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion);
+// If the document was created by FPDF_CreateNewDocument,
+// then this function will always fail.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetFileVersion(FPDF_DOCUMENT doc,
+ int* fileVersion);
-#define FPDF_ERR_SUCCESS 0 // No error.
-#define FPDF_ERR_UNKNOWN 1 // Unknown error.
-#define FPDF_ERR_FILE 2 // File not found or could not be opened.
-#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted.
-#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password.
-#define FPDF_ERR_SECURITY 5 // Unsupported security scheme.
-#define FPDF_ERR_PAGE 6 // Page not found or content error.
+#define FPDF_ERR_SUCCESS 0 // No error.
+#define FPDF_ERR_UNKNOWN 1 // Unknown error.
+#define FPDF_ERR_FILE 2 // File not found or could not be opened.
+#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted.
+#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password.
+#define FPDF_ERR_SECURITY 5 // Unsupported security scheme.
+#define FPDF_ERR_PAGE 6 // Page not found or content error.
+#ifdef PDF_ENABLE_XFA
+#define FPDF_ERR_XFALOAD 7 // Load XFA error.
+#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error.
+#endif // PDF_ENABLE_XFA
// Function: FPDF_GetLastError
-// Get last error code when an SDK function failed.
-// Parameters:
-// None.
+// Get last error code when a function fails.
+// Parameters:
+// None.
// Return value:
-// A 32-bit integer indicating error codes (defined above).
+// A 32-bit integer indicating error code as defined above.
// Comments:
-// If the previous SDK call succeeded, the return value of this function
-// is not defined.
-//
-DLLEXPORT unsigned long STDCALL FPDF_GetLastError();
+// If the previous SDK call succeeded, the return value of this
+// function is not defined. This function only works in conjunction
+// with APIs that mention FPDF_GetLastError() in their documentation.
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetLastError();
+
+// Experimental API.
+// Function: FPDF_DocumentHasValidCrossReferenceTable
+// Whether the document's cross reference table is valid or not.
+// Parameters:
+// document - Handle to a document. Returned by FPDF_LoadDocument.
+// Return value:
+// True if the PDF parser did not encounter problems parsing the cross
+// reference table. False if the parser could not parse the cross
+// reference table and the table had to be rebuild from other data
+// within the document.
+// Comments:
+// The return value can change over time as the PDF parser evolves.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_DocumentHasValidCrossReferenceTable(FPDF_DOCUMENT document);
-// Function: FPDF_GetDocPermission
-// Get file permission flags of the document.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument function.
+// Experimental API.
+// Function: FPDF_GetTrailerEnds
+// Get the byte offsets of trailer ends.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument().
+// buffer - The address of a buffer that receives the
+// byte offsets.
+// length - The size, in ints, of |buffer|.
// Return value:
-// A 32-bit integer indicating permission flags. Please refer to PDF Reference for
-// detailed description. If the document is not protected, 0xffffffff will be returned.
+// Returns the number of ints in the buffer on success, 0 on error.
//
-DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);
+// |buffer| is an array of integers that describes the exact byte offsets of the
+// trailer ends in the document. If |length| is less than the returned length,
+// or |document| or |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_GetTrailerEnds(FPDF_DOCUMENT document,
+ unsigned int* buffer,
+ unsigned long length);
+
+// Function: FPDF_GetDocPermissions
+// Get file permission flags of the document.
+// Parameters:
+// document - Handle to a document. Returned by FPDF_LoadDocument.
+// Return value:
+// A 32-bit integer indicating permission flags. Please refer to the
+// PDF Reference for detailed descriptions. If the document is not
+// protected or was unlocked by the owner, 0xffffffff will be returned.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_GetDocPermissions(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetDocUserPermissions
+// Get user file permission flags of the document.
+// Parameters:
+// document - Handle to a document. Returned by FPDF_LoadDocument.
+// Return value:
+// A 32-bit integer indicating permission flags. Please refer to the
+// PDF Reference for detailed descriptions. If the document is not
+// protected, 0xffffffff will be returned. Always returns user
+// permissions, even if the document was unlocked by the owner.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_GetDocUserPermissions(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetSecurityHandlerRevision
+// Get the revision for the security handler.
+// Parameters:
+// document - Handle to a document. Returned by FPDF_LoadDocument.
+// Return value:
+// The security handler revision number. Please refer to the PDF
+// Reference for a detailed description. If the document is not
+// protected, -1 will be returned.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
// Function: FPDF_GetPageCount
-// Get total number of pages in a document.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument function.
+// Get total number of pages in the document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument.
// Return value:
-// Total number of pages in the document.
-//
-DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
+// Total number of pages in the document.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document);
// Function: FPDF_LoadPage
-// Load a page inside a document.
-// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument function.
-// page_index - Index number of the page. 0 for the first page.
+// Load a page inside the document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument
+// page_index - Index number of the page. 0 for the first page.
// Return value:
-// A handle to the loaded page. If failed, NULL is returned.
+// A handle to the loaded page, or NULL if page load fails.
// Comments:
-// Loaded page can be rendered to devices using FPDF_RenderPage function.
-// Loaded page can be closed by FPDF_ClosePage.
-//
-DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index);
+// The loaded page can be rendered to devices using FPDF_RenderPage.
+// The loaded page can be closed using FPDF_ClosePage.
+FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
+ int page_index);
+
+// Experimental API
+// Function: FPDF_GetPageWidthF
+// Get page width.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage().
+// Return value:
+// Page width (excluding non-displayable area) measured in points.
+// One point is 1/72 inch (around 0.3528 mm).
+FPDF_EXPORT float FPDF_CALLCONV FPDF_GetPageWidthF(FPDF_PAGE page);
// Function: FPDF_GetPageWidth
-// Get page width.
+// Get page width.
// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function.
+// page - Handle to the page. Returned by FPDF_LoadPage.
// Return value:
-// Page width (excluding non-displayable area) measured in points.
-// One point is 1/72 inch (around 0.3528 mm).
-//
-DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
+// Page width (excluding non-displayable area) measured in points.
+// One point is 1/72 inch (around 0.3528 mm).
+// Note:
+// Prefer FPDF_GetPageWidthF() above. This will be deprecated in the
+// future.
+FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page);
+
+// Experimental API
+// Function: FPDF_GetPageHeightF
+// Get page height.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage().
+// Return value:
+// Page height (excluding non-displayable area) measured in points.
+// One point is 1/72 inch (around 0.3528 mm)
+FPDF_EXPORT float FPDF_CALLCONV FPDF_GetPageHeightF(FPDF_PAGE page);
// Function: FPDF_GetPageHeight
-// Get page height.
+// Get page height.
// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function.
+// page - Handle to the page. Returned by FPDF_LoadPage.
// Return value:
-// Page height (excluding non-displayable area) measured in points.
-// One point is 1/72 inch (around 0.3528 mm)
-//
-DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
+// Page height (excluding non-displayable area) measured in points.
+// One point is 1/72 inch (around 0.3528 mm)
+// Note:
+// Prefer FPDF_GetPageHeightF() above. This will be deprecated in the
+// future.
+FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page);
+
+// Experimental API.
+// Function: FPDF_GetPageBoundingBox
+// Get the bounding box of the page. This is the intersection between
+// its media box and its crop box.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage.
+// rect - Pointer to a rect to receive the page bounding box.
+// On an error, |rect| won't be filled.
+// Return value:
+// True for success.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetPageBoundingBox(FPDF_PAGE page,
+ FS_RECTF* rect);
+
+// Experimental API.
+// Function: FPDF_GetPageSizeByIndexF
+// Get the size of the page at the given index.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument().
+// page_index - Page index, zero for the first page.
+// size - Pointer to a FS_SIZEF to receive the page size.
+// (in points).
+// Return value:
+// Non-zero for success. 0 for error (document or page not found).
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_GetPageSizeByIndexF(FPDF_DOCUMENT document,
+ int page_index,
+ FS_SIZEF* size);
// Function: FPDF_GetPageSizeByIndex
-// Get the size of a page by index.
+// Get the size of the page at the given index.
// Parameters:
-// document - Handle to document. Returned by FPDF_LoadDocument function.
-// page_index - Page index, zero for the first page.
-// width - Pointer to a double value receiving the page width (in points).
-// height - Pointer to a double value receiving the page height (in points).
+// document - Handle to document. Returned by FPDF_LoadDocument.
+// page_index - Page index, zero for the first page.
+// width - Pointer to a double to receive the page width
+// (in points).
+// height - Pointer to a double to receive the page height
+// (in points).
// Return value:
-// Non-zero for success. 0 for error (document or page not found).
+// Non-zero for success. 0 for error (document or page not found).
+// Note:
+// Prefer FPDF_GetPageSizeByIndexF() above. This will be deprecated in
+// the future.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
+ int page_index,
+ double* width,
+ double* height);
+
+// Page rendering flags. They can be combined with bit-wise OR.
//
-DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height);
-
-
-// Page rendering flags. They can be combined with bit OR.
-#define FPDF_ANNOT 0x01 // Set if annotations are to be rendered.
-#define FPDF_LCD_TEXT 0x02 // Set if using text rendering optimized for LCD display.
-#define FPDF_NO_NATIVETEXT 0x04 // Don't use the native text output available on some platforms
-#define FPDF_GRAYSCALE 0x08 // Grayscale output.
-#define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info.
- // Please discuss with Foxit first if you need to collect debug info.
-#define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception.
-#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size.
-#define FPDF_RENDER_FORCEHALFTONE 0x400 // Always use halftone for image stretching.
-#define FPDF_PRINTING 0x800 // Render for printing.
-#define FPDF_REVERSE_BYTE_ORDER 0x10 //set whether render in a reverse Byte order, this flag only
- //enable when render to a bitmap.
+// Set if annotations are to be rendered.
+#define FPDF_ANNOT 0x01
+// Set if using text rendering optimized for LCD display. This flag will only
+// take effect if anti-aliasing is enabled for text.
+#define FPDF_LCD_TEXT 0x02
+// Don't use the native text output available on some platforms
+#define FPDF_NO_NATIVETEXT 0x04
+// Grayscale output.
+#define FPDF_GRAYSCALE 0x08
+// Obsolete, has no effect, retained for compatibility.
+#define FPDF_DEBUG_INFO 0x80
+// Obsolete, has no effect, retained for compatibility.
+#define FPDF_NO_CATCH 0x100
+// Limit image cache size.
+#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200
+// Always use halftone for image stretching.
+#define FPDF_RENDER_FORCEHALFTONE 0x400
+// Render for printing.
+#define FPDF_PRINTING 0x800
+// Set to disable anti-aliasing on text. This flag will also disable LCD
+// optimization for text rendering.
+#define FPDF_RENDER_NO_SMOOTHTEXT 0x1000
+// Set to disable anti-aliasing on images.
+#define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000
+// Set to disable anti-aliasing on paths.
+#define FPDF_RENDER_NO_SMOOTHPATH 0x4000
+// Set whether to render in a reverse Byte order, this flag is only used when
+// rendering to a bitmap.
+#define FPDF_REVERSE_BYTE_ORDER 0x10
+// Set whether fill paths need to be stroked. This flag is only used when
+// FPDF_COLORSCHEME is passed in, since with a single fill color for paths the
+// boundaries of adjacent fill paths are less visible.
+#define FPDF_CONVERT_FILL_TO_STROKE 0x20
+
+// Struct for color scheme.
+// Each should be a 32-bit value specifying the color, in 8888 ARGB format.
+typedef struct FPDF_COLORSCHEME_ {
+ FPDF_DWORD path_fill_color;
+ FPDF_DWORD path_stroke_color;
+ FPDF_DWORD text_fill_color;
+ FPDF_DWORD text_stroke_color;
+} FPDF_COLORSCHEME;
+
#ifdef _WIN32
// Function: FPDF_RenderPage
-// Render contents in a page to a device (screen, bitmap, or printer).
-// This function is only supported on Windows system.
-// Parameters:
-// dc - Handle to device context.
-// page - Handle to the page. Returned by FPDF_LoadPage function.
-// start_x - Left pixel position of the display area in the device coordinate.
-// start_y - Top pixel position of the display area in the device coordinate.
-// size_x - Horizontal size (in pixels) for displaying the page.
-// size_y - Vertical size (in pixels) for displaying the page.
-// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
-// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
-// flags - 0 for normal display, or combination of flags defined above.
-// Return value:
-// None.
-//
-DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, int flags);
+// Render contents of a page to a device (screen, bitmap, or printer).
+// This function is only supported on Windows.
+// Parameters:
+// dc - Handle to the device context.
+// page - Handle to the page. Returned by FPDF_LoadPage.
+// start_x - Left pixel position of the display area in
+// device coordinates.
+// start_y - Top pixel position of the display area in device
+// coordinates.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation:
+// 0 (normal)
+// 1 (rotated 90 degrees clockwise)
+// 2 (rotated 180 degrees)
+// 3 (rotated 90 degrees counter-clockwise)
+// flags - 0 for normal display, or combination of flags
+// defined above.
+// Return value:
+// Returns true if the page is rendered successfully, false otherwise.
+
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_RenderPage(HDC dc,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags);
#endif
// Function: FPDF_RenderPageBitmap
-// Render contents in a page to a device independent bitmap
-// Parameters:
-// bitmap - Handle to the device independent bitmap (as the output buffer).
-// Bitmap handle can be created by FPDFBitmap_Create function.
-// page - Handle to the page. Returned by FPDF_LoadPage function.
-// start_x - Left pixel position of the display area in the bitmap coordinate.
-// start_y - Top pixel position of the display area in the bitmap coordinate.
-// size_x - Horizontal size (in pixels) for displaying the page.
-// size_y - Vertical size (in pixels) for displaying the page.
-// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
-// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
-// flags - 0 for normal display, or combination of flags defined above.
-// Return value:
-// None.
-//
-DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
- int size_x, int size_y, int rotate, int flags);
+// Render contents of a page to a device independent bitmap.
+// Parameters:
+// bitmap - Handle to the device independent bitmap (as the
+// output buffer). The bitmap handle can be created
+// by FPDFBitmap_Create or retrieved from an image
+// object by FPDFImageObj_GetBitmap.
+// page - Handle to the page. Returned by FPDF_LoadPage
+// start_x - Left pixel position of the display area in
+// bitmap coordinates.
+// start_y - Top pixel position of the display area in bitmap
+// coordinates.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation:
+// 0 (normal)
+// 1 (rotated 90 degrees clockwise)
+// 2 (rotated 180 degrees)
+// 3 (rotated 90 degrees counter-clockwise)
+// flags - 0 for normal display, or combination of the Page
+// Rendering flags defined above. With the FPDF_ANNOT
+// flag, it renders all annotations that do not require
+// user-interaction, which are all annotations except
+// widget and popup annotations.
+// Return value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags);
+
+// Function: FPDF_RenderPageBitmapWithMatrix
+// Render contents of a page to a device independent bitmap.
+// Parameters:
+// bitmap - Handle to the device independent bitmap (as the
+// output buffer). The bitmap handle can be created
+// by FPDFBitmap_Create or retrieved by
+// FPDFImageObj_GetBitmap.
+// page - Handle to the page. Returned by FPDF_LoadPage.
+// matrix - The transform matrix, which must be invertible.
+// See PDF Reference 1.7, 4.2.2 Common Transformations.
+// clipping - The rect to clip to in device coords.
+// flags - 0 for normal display, or combination of the Page
+// Rendering flags defined above. With the FPDF_ANNOT
+// flag, it renders all annotations that do not require
+// user-interaction, which are all annotations except
+// widget and popup annotations.
+// Return value:
+// None. Note that behavior is undefined if det of |matrix| is 0.
+FPDF_EXPORT void FPDF_CALLCONV
+FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap,
+ FPDF_PAGE page,
+ const FS_MATRIX* matrix,
+ const FS_RECTF* clipping,
+ int flags);
+
+#if defined(PDF_USE_SKIA)
+// Experimental API.
+// Function: FPDF_RenderPageSkia
+// Render contents of a page to a Skia SkCanvas.
+// Parameters:
+// canvas - SkCanvas to render to.
+// page - Handle to the page.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// Return value:
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPageSkia(FPDF_SKIA_CANVAS canvas,
+ FPDF_PAGE page,
+ int size_x,
+ int size_y);
+#endif
// Function: FPDF_ClosePage
-// Close a loaded PDF page.
-// Parameters:
-// page - Handle to the loaded page.
+// Close a loaded PDF page.
+// Parameters:
+// page - Handle to the loaded page.
// Return value:
-// None.
-//
-DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
// Function: FPDF_CloseDocument
-// Close a loaded PDF document.
-// Parameters:
-// document - Handle to the loaded document.
+// Close a loaded PDF document.
+// Parameters:
+// document - Handle to the loaded document.
// Return value:
-// None.
-//
-DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
+// None.
+FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document);
// Function: FPDF_DeviceToPage
-// Convert the screen coordinate of a point to page coordinate.
-// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function.
-// start_x - Left pixel position of the display area in the device coordinate.
-// start_y - Top pixel position of the display area in the device coordinate.
-// size_x - Horizontal size (in pixels) for displaying the page.
-// size_y - Vertical size (in pixels) for displaying the page.
-// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
-// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
-// device_x - X value in device coordinate, for the point to be converted.
-// device_y - Y value in device coordinate, for the point to be converted.
-// page_x - A Pointer to a double receiving the converted X value in page coordinate.
-// page_y - A Pointer to a double receiving the converted Y value in page coordinate.
-// Return value:
-// None.
+// Convert the screen coordinates of a point to page coordinates.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage.
+// start_x - Left pixel position of the display area in
+// device coordinates.
+// start_y - Top pixel position of the display area in device
+// coordinates.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation:
+// 0 (normal)
+// 1 (rotated 90 degrees clockwise)
+// 2 (rotated 180 degrees)
+// 3 (rotated 90 degrees counter-clockwise)
+// device_x - X value in device coordinates to be converted.
+// device_y - Y value in device coordinates to be converted.
+// page_x - A pointer to a double receiving the converted X
+// value in page coordinates.
+// page_y - A pointer to a double receiving the converted Y
+// value in page coordinates.
+// Return value:
+// Returns true if the conversion succeeds, and |page_x| and |page_y|
+// successfully receives the converted coordinates.
// Comments:
-// The page coordinate system has its origin at left-bottom corner of the page, with X axis goes along
-// the bottom side to the right, and Y axis goes along the left side upward. NOTE: this coordinate system
-// can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have
-// the same coordinate values in the page coordinate system.
+// The page coordinate system has its origin at the left-bottom corner
+// of the page, with the X-axis on the bottom going to the right, and
+// the Y-axis on the left side going up.
+//
+// NOTE: this coordinate system can be altered when you zoom, scroll,
+// or rotate a page, however, a point on the page should always have
+// the same coordinate values in the page coordinate system.
//
-// The device coordinate system is device dependent. For screen device, its origin is at left-top
-// corner of the window. However this origin can be altered by Windows coordinate transformation
-// utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly
-// same values as you used in FPDF_RenderPage() function call.
+// The device coordinate system is device dependent. For screen device,
+// its origin is at the left-top corner of the window. However this
+// origin can be altered by the Windows coordinate transformation
+// utilities.
//
-DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, int device_x, int device_y, double* page_x, double* page_y);
+// You must make sure the start_x, start_y, size_x, size_y
+// and rotate parameters have exactly same values as you used in
+// the FPDF_RenderPage() function call.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int device_x,
+ int device_y,
+ double* page_x,
+ double* page_y);
// Function: FPDF_PageToDevice
-// Convert the page coordinate of a point to screen coordinate.
-// Parameters:
-// page - Handle to the page. Returned by FPDF_LoadPage function.
-// start_x - Left pixel position of the display area in the device coordinate.
-// start_y - Top pixel position of the display area in the device coordinate.
-// size_x - Horizontal size (in pixels) for displaying the page.
-// size_y - Vertical size (in pixels) for displaying the page.
-// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
-// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
-// page_x - X value in page coordinate, for the point to be converted.
-// page_y - Y value in page coordinate, for the point to be converted.
-// device_x - A pointer to an integer receiving the result X value in device coordinate.
-// device_y - A pointer to an integer receiving the result Y value in device coordinate.
-// Return value:
-// None.
+// Convert the page coordinates of a point to screen coordinates.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage.
+// start_x - Left pixel position of the display area in
+// device coordinates.
+// start_y - Top pixel position of the display area in device
+// coordinates.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation:
+// 0 (normal)
+// 1 (rotated 90 degrees clockwise)
+// 2 (rotated 180 degrees)
+// 3 (rotated 90 degrees counter-clockwise)
+// page_x - X value in page coordinates.
+// page_y - Y value in page coordinate.
+// device_x - A pointer to an integer receiving the result X
+// value in device coordinates.
+// device_y - A pointer to an integer receiving the result Y
+// value in device coordinates.
+// Return value:
+// Returns true if the conversion succeeds, and |device_x| and
+// |device_y| successfully receives the converted coordinates.
// Comments:
-// See comments of FPDF_DeviceToPage() function.
-//
-DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
- int rotate, double page_x, double page_y, int* device_x, int* device_y);
+// See comments for FPDF_DeviceToPage().
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ double page_x,
+ double page_y,
+ int* device_x,
+ int* device_y);
// Function: FPDFBitmap_Create
-// Create a Foxit Device Independent Bitmap (FXDIB).
+// Create a device independent bitmap (FXDIB).
// Parameters:
-// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
-// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
-// alpha - A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.
+// width - The number of pixels in width for the bitmap.
+// Must be greater than 0.
+// height - The number of pixels in height for the bitmap.
+// Must be greater than 0.
+// alpha - A flag indicating whether the alpha channel is used.
+// Non-zero for using alpha, zero for not using.
// Return value:
-// The created bitmap handle, or NULL if parameter error or out of memory.
+// The created bitmap handle, or NULL if a parameter error or out of
+// memory.
// Comments:
-// An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned.
-// Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values.
-// The byte order is BGRx (the last byte unused if no alpha channel) or BGRA.
-//
-// The pixels in a horizontal line (also called scan line) are stored side by side, with left most
-// pixel stored first (with lower memory address). Each scan line uses width*4 bytes.
+// The bitmap always uses 4 bytes per pixel. The first byte is always
+// double word aligned.
//
-// Scan lines are stored one after another, with top most scan line stored first. There is no gap
-// between adjacent scan lines.
+// The byte order is BGRx (the last byte unused if no alpha channel) or
+// BGRA.
//
-// This function allocates enough memory for holding all pixels in the bitmap, but it doesn't
-// initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color.
-DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha);
+// The pixels in a horizontal line are stored side by side, with the
+// left most pixel stored first (with lower memory address).
+// Each line uses width * 4 bytes.
+//
+// Lines are stored one after another, with the top most line stored
+// first. There is no gap between adjacent lines.
+//
+// This function allocates enough memory for holding all pixels in the
+// bitmap, but it doesn't initialize the buffer. Applications can use
+// FPDFBitmap_FillRect() to fill the bitmap using any color. If the OS
+// allows it, this function can allocate up to 4 GB of memory.
+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_Create(int width,
+ int height,
+ int alpha);
// More DIB formats
-#define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel.
-#define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red.
-#define FPDFBitmap_BGRx 3 // 4 bytes per pixel, byte order: blue, green, red, unused.
-#define FPDFBitmap_BGRA 4 // 4 bytes per pixel, byte order: blue, green, red, alpha.
+// Unknown or unsupported format.
+#define FPDFBitmap_Unknown 0
+// Gray scale bitmap, one byte per pixel.
+#define FPDFBitmap_Gray 1
+// 3 bytes per pixel, byte order: blue, green, red.
+#define FPDFBitmap_BGR 2
+// 4 bytes per pixel, byte order: blue, green, red, unused.
+#define FPDFBitmap_BGRx 3
+// 4 bytes per pixel, byte order: blue, green, red, alpha.
+#define FPDFBitmap_BGRA 4
// Function: FPDFBitmap_CreateEx
-// Create a Foxit Device Independent Bitmap (FXDIB)
+// Create a device independent bitmap (FXDIB)
// Parameters:
-// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
-// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
-// format - A number indicating for bitmap format, as defined above.
-// first_scan - A pointer to the first byte of first scan line, for external buffer
-// only. If this parameter is NULL, then the SDK will create its own buffer.
-// stride - Number of bytes for each scan line, for external buffer only..
+// width - The number of pixels in width for the bitmap.
+// Must be greater than 0.
+// height - The number of pixels in height for the bitmap.
+// Must be greater than 0.
+// format - A number indicating for bitmap format, as defined
+// above.
+// first_scan - A pointer to the first byte of the first line if
+// using an external buffer. If this parameter is NULL,
+// then a new buffer will be created.
+// stride - Number of bytes for each scan line. The value must
+// be 0 or greater. When the value is 0,
+// FPDFBitmap_CreateEx() will automatically calculate
+// the appropriate value using |width| and |format|.
+// When using an external buffer, it is recommended for
+// the caller to pass in the value.
+// When not using an external buffer, it is recommended
+// for the caller to pass in 0.
// Return value:
-// The created bitmap handle, or NULL if parameter error or out of memory.
+// The bitmap handle, or NULL if parameter error or out of memory.
// Comments:
-// Similar to FPDFBitmap_Create function, with more formats and external buffer supported.
-// Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is
-// required.
+// Similar to FPDFBitmap_Create function, but allows for more formats
+// and an external buffer is supported. The bitmap created by this
+// function can be used in any place that a FPDF_BITMAP handle is
+// required.
//
-// If external scanline buffer is used, then the application should destroy the buffer
-// by itself. FPDFBitmap_Destroy function will not destroy the buffer.
+// If an external buffer is used, then the caller should destroy the
+// buffer. FPDFBitmap_Destroy() will not destroy the buffer.
//
-DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride);
+// It is recommended to use FPDFBitmap_GetStride() to get the stride
+// value.
+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width,
+ int height,
+ int format,
+ void* first_scan,
+ int stride);
+
+// Function: FPDFBitmap_GetFormat
+// Get the format of the bitmap.
+// Parameters:
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
+// or FPDFImageObj_GetBitmap.
+// Return value:
+// The format of the bitmap.
+// Comments:
+// Only formats supported by FPDFBitmap_CreateEx are supported by this
+// function; see the list of such formats above.
+FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_FillRect
-// Fill a rectangle area in an FXDIB.
-// Parameters:
-// bitmap - The handle to the bitmap. Returned by FPDFBitmap_Create function.
-// left - The left side position. Starting from 0 at the left-most pixel.
-// top - The top side position. Starting from 0 at the top-most scan line.
-// width - Number of pixels to be filled in each scan line.
-// height - Number of scan lines to be filled.
-// red - A number from 0 to 255, identifying the red intensity.
-// green - A number from 0 to 255, identifying the green intensity.
-// blue - A number from 0 to 255, identifying the blue intensity.
-// alpha - (Only if the alpha channeled is used when bitmap created) A number from 0 to 255,
-// identifying the alpha value.
-// Return value:
-// None.
+// Fill a rectangle in a bitmap.
+// Parameters:
+// bitmap - The handle to the bitmap. Returned by
+// FPDFBitmap_Create.
+// left - The left position. Starting from 0 at the
+// left-most pixel.
+// top - The top position. Starting from 0 at the
+// top-most line.
+// width - Width in pixels to be filled.
+// height - Height in pixels to be filled.
+// color - A 32-bit value specifing the color, in 8888 ARGB
+// format.
+// Return value:
+// Returns whether the operation succeeded or not.
// Comments:
-// This function set the color and (optionally) alpha value in specified region of the bitmap.
-// NOTE: If alpha channel is used, this function does NOT composite the background with the source color,
-// instead the background will be replaced by the source color and alpha.
-// If alpha channel is not used, the "alpha" parameter is ignored.
+// This function sets the color and (optionally) alpha value in the
+// specified region of the bitmap.
+//
+// NOTE: If the alpha channel is used, this function does NOT
+// composite the background with the source color, instead the
+// background will be replaced by the source color and the alpha.
//
-DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height,
- int red, int green, int blue, int alpha);
+// If the alpha channel is not used, the alpha parameter is ignored.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
+ int left,
+ int top,
+ int width,
+ int height,
+ FPDF_DWORD color);
// Function: FPDFBitmap_GetBuffer
-// Get data buffer of an FXDIB
+// Get data buffer of a bitmap.
// Parameters:
-// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
+// or FPDFImageObj_GetBitmap.
// Return value:
-// The pointer to the first byte of the bitmap buffer.
+// The pointer to the first byte of the bitmap buffer.
// Comments:
-// The stride may be more than width * number of bytes per pixel
-// Applications can use this function to get the bitmap buffer pointer, then manipulate any color
-// and/or alpha values for any pixels in the bitmap.
-DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
+// The stride may be more than width * number of bytes per pixel
+//
+// Applications can use this function to get the bitmap buffer pointer,
+// then manipulate any color and/or alpha values for any pixels in the
+// bitmap.
+//
+// Use FPDFBitmap_GetFormat() to find out the format of the data.
+FPDF_EXPORT void* FPDF_CALLCONV FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetWidth
-// Get width of an FXDIB.
+// Get width of a bitmap.
// Parameters:
-// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
+// or FPDFImageObj_GetBitmap.
// Return value:
-// The number of pixels in a horizontal line of the bitmap.
-DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
+// The width of the bitmap in pixels.
+FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetHeight
-// Get height of an FXDIB.
+// Get height of a bitmap.
// Parameters:
-// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
+// or FPDFImageObj_GetBitmap.
// Return value:
-// The number of pixels in a vertical line of the bitmap.
-DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
+// The height of the bitmap in pixels.
+FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetStride
-// Get number of bytes for each scan line in the bitmap buffer.
+// Get number of bytes for each line in the bitmap buffer.
// Parameters:
-// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
+// or FPDFImageObj_GetBitmap.
// Return value:
-// The number of bytes for each scan line in the bitmap buffer.
+// The number of bytes for each line in the bitmap buffer.
// Comments:
-// The stride may be more than width * number of bytes per pixel
-DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
+// The stride may be more than width * number of bytes per pixel.
+FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_Destroy
-// Destroy an FXDIB and release all related buffers.
+// Destroy a bitmap and release all related buffers.
// Parameters:
-// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
+// or FPDFImageObj_GetBitmap.
// Return value:
-// None.
+// None.
// Comments:
-// This function will not destroy any external buffer.
-//
-DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
+// This function will not destroy any external buffers provided when
+// the bitmap was created.
+FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
// Function: FPDF_VIEWERREF_GetPrintScaling
-// Whether the PDF document prefers to be scaled or not.
-// Parameters:
-// document - Handle to the loaded document.
+// Whether the PDF document prefers to be scaled or not.
+// Parameters:
+// document - Handle to the loaded document.
// Return value:
-// None.
-//
-DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
+// None.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
+
+// Function: FPDF_VIEWERREF_GetNumCopies
+// Returns the number of copies to be printed.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// The number of copies to be printed.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
+
+// Function: FPDF_VIEWERREF_GetPrintPageRange
+// Page numbers to initialize print dialog box when file is printed.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// The print page range to be used for printing.
+FPDF_EXPORT FPDF_PAGERANGE FPDF_CALLCONV
+FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Function: FPDF_VIEWERREF_GetPrintPageRangeCount
+// Returns the number of elements in a FPDF_PAGERANGE.
+// Parameters:
+// pagerange - Handle to the page range.
+// Return value:
+// The number of elements in the page range. Returns 0 on error.
+FPDF_EXPORT size_t FPDF_CALLCONV
+FPDF_VIEWERREF_GetPrintPageRangeCount(FPDF_PAGERANGE pagerange);
+
+// Experimental API.
+// Function: FPDF_VIEWERREF_GetPrintPageRangeElement
+// Returns an element from a FPDF_PAGERANGE.
+// Parameters:
+// pagerange - Handle to the page range.
+// index - Index of the element.
+// Return value:
+// The value of the element in the page range at a given index.
+// Returns -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV
+FPDF_VIEWERREF_GetPrintPageRangeElement(FPDF_PAGERANGE pagerange, size_t index);
+
+// Function: FPDF_VIEWERREF_GetDuplex
+// Returns the paper handling option to be used when printing from
+// the print dialog.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// The paper handling option to be used when printing.
+FPDF_EXPORT FPDF_DUPLEXTYPE FPDF_CALLCONV
+FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
+
+// Function: FPDF_VIEWERREF_GetName
+// Gets the contents for a viewer ref, with a given key. The value must
+// be of type "name".
+// Parameters:
+// document - Handle to the loaded document.
+// key - Name of the key in the viewer pref dictionary,
+// encoded in UTF-8.
+// buffer - Caller-allocate buffer to receive the key, or NULL
+// - to query the required length.
+// length - Length of the buffer.
+// Return value:
+// The number of bytes in the contents, including the NULL terminator.
+// Thus if the return value is 0, then that indicates an error, such
+// as when |document| is invalid. If |length| is less than the required
+// length, or |buffer| is NULL, |buffer| will not be modified.
+FPDF_EXPORT unsigned long FPDF_CALLCONV
+FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
+ FPDF_BYTESTRING key,
+ char* buffer,
+ unsigned long length);
+
+// Function: FPDF_CountNamedDests
+// Get the count of named destinations in the PDF document.
+// Parameters:
+// document - Handle to a document
+// Return value:
+// The count of named destinations.
+FPDF_EXPORT FPDF_DWORD FPDF_CALLCONV
+FPDF_CountNamedDests(FPDF_DOCUMENT document);
// Function: FPDF_GetNamedDestByName
-// get a special dest handle by the index.
-// Parameters:
-// document - Handle to the loaded document.
-// name - The name of a special named dest.
+// Get a the destination handle for the given name.
+// Parameters:
+// document - Handle to the loaded document.
+// name - The name of a destination.
// Return value:
-// The handle of the dest.
+// The handle to the destination.
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
+FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name);
+
+// Function: FPDF_GetNamedDest
+// Get the named destination by index.
+// Parameters:
+// document - Handle to a document
+// index - The index of a named destination.
+// buffer - The buffer to store the destination name,
+// used as wchar_t*.
+// buflen [in/out] - Size of the buffer in bytes on input,
+// length of the result in bytes on output
+// or -1 if the buffer is too small.
+// Return value:
+// The destination handle for a given index, or NULL if there is no
+// named destination corresponding to |index|.
+// Comments:
+// Call this function twice to get the name of the named destination:
+// 1) First time pass in |buffer| as NULL and get buflen.
+// 2) Second time pass in allocated |buffer| and buflen to retrieve
+// |buffer|, which should be used as wchar_t*.
+//
+// If buflen is not sufficiently large, it will be set to -1 upon
+// return.
+FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document,
+ int index,
+ void* buffer,
+ long* buflen);
+
+// Experimental API.
+// Function: FPDF_GetXFAPacketCount
+// Get the number of valid packets in the XFA entry.
+// Parameters:
+// document - Handle to the document.
+// Return value:
+// The number of valid packets, or -1 on error.
+FPDF_EXPORT int FPDF_CALLCONV FPDF_GetXFAPacketCount(FPDF_DOCUMENT document);
+
+// Experimental API.
+// Function: FPDF_GetXFAPacketName
+// Get the name of a packet in the XFA array.
+// Parameters:
+// document - Handle to the document.
+// index - Index number of the packet. 0 for the first packet.
+// buffer - Buffer for holding the name of the XFA packet.
+// buflen - Length of |buffer| in bytes.
+// Return value:
+// The length of the packet name in bytes, or 0 on error.
+//
+// |document| must be valid and |index| must be in the range [0, N), where N is
+// the value returned by FPDF_GetXFAPacketCount().
+// |buffer| is only modified if it is non-NULL and |buflen| is greater than or
+// equal to the length of the packet name. The packet name includes a
+// terminating NUL character. |buffer| is unmodified on error.
+FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetXFAPacketName(
+ FPDF_DOCUMENT document,
+ int index,
+ void* buffer,
+ unsigned long buflen);
+
+// Experimental API.
+// Function: FPDF_GetXFAPacketContent
+// Get the content of a packet in the XFA array.
+// Parameters:
+// document - Handle to the document.
+// index - Index number of the packet. 0 for the first packet.
+// buffer - Buffer for holding the content of the XFA packet.
+// buflen - Length of |buffer| in bytes.
+// out_buflen - Pointer to the variable that will receive the minimum
+// buffer size needed to contain the content of the XFA
+// packet.
+// Return value:
+// Whether the operation succeeded or not.
+//
+// |document| must be valid and |index| must be in the range [0, N), where N is
+// the value returned by FPDF_GetXFAPacketCount(). |out_buflen| must not be
+// NULL. When the aforementioned arguments are valid, the operation succeeds,
+// and |out_buflen| receives the content size. |buffer| is only modified if
+// |buffer| is non-null and long enough to contain the content. Callers must
+// check both the return value and the input |buflen| is no less than the
+// returned |out_buflen| before using the data in |buffer|.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetXFAPacketContent(
+ FPDF_DOCUMENT document,
+ int index,
+ void* buffer,
+ unsigned long buflen,
+ unsigned long* out_buflen);
+
+#ifdef PDF_ENABLE_V8
+// Function: FPDF_GetRecommendedV8Flags
+// Returns a space-separated string of command line flags that are
+// recommended to be passed into V8 via V8::SetFlagsFromString()
+// prior to initializing the PDFium library.
+// Parameters:
+// None.
+// Return value:
+// NUL-terminated string of the form "--flag1 --flag2".
+// The caller must not attempt to modify or free the result.
+FPDF_EXPORT const char* FPDF_CALLCONV FPDF_GetRecommendedV8Flags();
+
+// Experimental API.
+// Function: FPDF_GetArrayBufferAllocatorSharedInstance()
+// Helper function for initializing V8 isolates that will
+// use PDFium's internal memory management.
+// Parameters:
+// None.
+// Return Value:
+// Pointer to a suitable v8::ArrayBuffer::Allocator, returned
+// as void for C compatibility.
+// Notes:
+// Use is optional, but allows external creation of isolates
+// matching the ones PDFium will make when none is provided
+// via |FPDF_LIBRARY_CONFIG::m_pIsolate|.
//
-DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_BYTESTRING name);
+// Can only be called when the library is in an uninitialized or
+// destroyed state.
+FPDF_EXPORT void* FPDF_CALLCONV FPDF_GetArrayBufferAllocatorSharedInstance();
+#endif // PDF_ENABLE_V8
+
+#ifdef PDF_ENABLE_XFA
+// Function: FPDF_BStr_Init
+// Helper function to initialize a FPDF_BSTR.
+FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Init(FPDF_BSTR* bstr);
+
+// Function: FPDF_BStr_Set
+// Helper function to copy string data into the FPDF_BSTR.
+FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* bstr,
+ const char* cstr,
+ int length);
+
+// Function: FPDF_BStr_Clear
+// Helper function to clear a FPDF_BSTR.
+FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Clear(FPDF_BSTR* bstr);
+#endif // PDF_ENABLE_XFA
#ifdef __cplusplus
-};
+}
#endif
-#endif // _FPDFVIEW_H_
+#endif // PUBLIC_FPDFVIEW_H_
diff --git a/src/main/jni/include/fsdk_actionhandler.h b/src/main/jni/include/fsdk_actionhandler.h
deleted file mode 100644
index 0ffbddb4..00000000
--- a/src/main/jni/include/fsdk_actionhandler.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FSDK_ACTIONHANDLER_H_
-#define _FSDK_ACTIONHANDLER_H_
-
-
-class CPDFDoc_Environment;
-class IFXJS_Runtime;
-
-class CPDFSDK_FormActionHandler
-{
-public:
- FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);
-};
-
-class CPDFSDK_MediaActionHandler
-{
-public:
- FX_BOOL DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);
-};
-
-class CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/
-{
-public:
- CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);
- virtual ~CPDFSDK_ActionHandler();
-
- virtual void Destroy();
- virtual FX_BOOL DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CPDFSDK_DocView *pDocView*/);
- virtual FX_BOOL DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
- virtual FX_BOOL DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
- virtual FX_BOOL DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
- virtual FX_BOOL DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
- virtual FX_BOOL DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScreen);
- virtual FX_BOOL DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
- virtual FX_BOOL DoAction_Field(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
- virtual FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
-public:
- void SetFormActionHandler(CPDFSDK_FormActionHandler* pHandler);
- void SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);
-
-private:
- FX_BOOL ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);
- FX_BOOL ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);
- FX_BOOL ExecuteFieldAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list);
- FX_BOOL ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScreen, CFX_PtrList& list);
- FX_BOOL ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, CFX_PtrList& list);
- FX_BOOL ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CFX_PtrList& list);
-
- void DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);
- void RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);
- void RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);
- void RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, const CFX_WideString& script);
-
-private:
- FX_BOOL IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);
- FX_BOOL IsValidDocView(CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);
-
- void DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ const CPDF_Action& action);
- void DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_SetOCGState(CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ const CPDF_Action& action);
-
-private:
- CPDFDoc_Environment* m_pEvi;
- CPDFSDK_FormActionHandler* m_pFormActionHandler;
- CPDFSDK_MediaActionHandler* m_pMediaActionHandler;
-};
-
-#endif //_BA_ACTIONHANDLER_H_
-
diff --git a/src/main/jni/include/fsdk_annothandler.h b/src/main/jni/include/fsdk_annothandler.h
deleted file mode 100644
index fec3d927..00000000
--- a/src/main/jni/include/fsdk_annothandler.h
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FSDK_ANNOTHANDLER_H_
-#define _FSDK_ANNOTHANDLER_H_
-
-
-class CPDFDoc_Environment;
-class CFFL_IFormFiller;
-class CPDFSDK_PageView;
-class IPDFSDK_AnnotHandler
-{
-
-public:
- virtual ~IPDFSDK_AnnotHandler() {};
-
- virtual CFX_ByteString GetType() = 0;
-
- virtual CFX_ByteString GetName() = 0;
-
- virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
-
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) = 0;
-
- virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;
-
-
- virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) = 0;
-
- virtual FX_BOOL HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point) = 0;
-
-
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags) = 0;
-
- virtual void OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect& rcWindow, FX_DWORD dwFlags) = 0;
-
-
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0;
-
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
-
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
-//by wjm.
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags) = 0;
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
- virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) =0 ;
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
- virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
-
-};
-
-
-class CPDFSDK_BFAnnotHandler:public IPDFSDK_AnnotHandler
-{
-public:
- CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp):m_pFormFiller(NULL),m_pApp(pApp) {}
- virtual ~CPDFSDK_BFAnnotHandler() {}
-public:
-
- virtual CFX_ByteString GetType() {return CFX_ByteString("Widget");}
-
- virtual CFX_ByteString GetName() {return CFX_ByteString("WidgetHandler");}
-
- virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot);
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage);
-
- virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) ;
-
- virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
-
-
- virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) ;
-
- virtual FX_BOOL HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
-
-
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags) ;
-
- virtual void OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect& rcWindow, FX_DWORD dwFlags) {}
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot) ;
-
- virtual void OnLoad(CPDFSDK_Annot* pAnnot) ;
-
- virtual void OnDelete(CPDFSDK_Annot* pAnnot) {}
-
- virtual void OnRelease(CPDFSDK_Annot* pAnnot) {}
-
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
-
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) {return FALSE;}
-
-//by wjm.
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
- virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {}
- virtual void OnSelected(CPDFSDK_Annot* pAnnot) {}
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
-
- void SetFormFiller(CFFL_IFormFiller* pFiller){m_pFormFiller = pFiller;}
- CFFL_IFormFiller* GetFormFiller() {return m_pFormFiller;}
-private:
-
- CPDFDoc_Environment* m_pApp;
- CFFL_IFormFiller* m_pFormFiller;
-};
-
-#define CBA_AnnotHandlerArray CFX_ArrayTemplate
-class CPDFSDK_AnnotHandlerMgr
-{
-public:
- // Destroy the handler
- CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp);
- virtual ~CPDFSDK_AnnotHandlerMgr() ;
-
-public:
- void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
- void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_PageView *pPageView);
- virtual void ReleaseAnnot(CPDFSDK_Annot * pAnnot);
-
- virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot);
- virtual void Annot_OnLoad(CPDFSDK_Annot* pAnnot);
-public:
- IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;
- virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwFlags);
-
- virtual void Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);
- virtual void Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);
-
- virtual FX_BOOL Annot_OnLButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnRButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
-
-
- virtual FX_BOOL Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
- virtual FX_BOOL Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
- virtual FX_BOOL Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
-
- virtual FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
-
- virtual CPDF_Rect Annot_OnGetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual FX_BOOL Annot_OnHitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
-
-private:
- IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const;
- CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,FX_BOOL bNext);
-private:
- CBA_AnnotHandlerArray m_Handlers;
- CFX_MapByteStringToPtr m_mapType2Handler;
- CPDFDoc_Environment* m_pApp;
-};
-
-//#define CBF_Page2Accessible CFX_MapPtrTemplate
-
-typedef int (*AI_COMPARE) (CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
-
-class CPDFSDK_AnnotIterator
-{
-protected:
- CPDFSDK_Annot* NextAnnot (const CPDFSDK_Annot* pCurrent) ;
- CPDFSDK_Annot* PrevAnnot (const CPDFSDK_Annot* pCurrent) ;
- CPDFSDK_Annot* NextAnnot(int& index ) ;
- CPDFSDK_Annot* PrevAnnot(int& index ) ;
-public:
- CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView, FX_BOOL bReverse,
- FX_BOOL bIgnoreTopmost=FALSE,FX_BOOL bCircle=FALSE,CFX_PtrArray* pList=NULL);
- virtual CPDFSDK_Annot* Next (const CPDFSDK_Annot* pCurrent) ;
- virtual CPDFSDK_Annot* Prev (const CPDFSDK_Annot* pCurrent) ;
- virtual CPDFSDK_Annot* Next(int& index ) ;
- virtual CPDFSDK_Annot* Prev(int& index ) ;
- virtual int Count(){return m_pIteratorAnnotList.GetSize();}
-
- virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView * pPageView,CFX_PtrArray* pList=NULL);
-
- void InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pCompare);
-protected:
- // CFX_PtrList m_pIteratorAnnotList;
- CFX_PtrArray m_pIteratorAnnotList;
- FX_BOOL m_bReverse;
- FX_BOOL m_bIgnoreTopmost;
- FX_BOOL m_bCircle;
-};
-
-
-
-#endif
-
diff --git a/src/main/jni/include/fsdk_baseannot.h b/src/main/jni/include/fsdk_baseannot.h
deleted file mode 100644
index 46425089..00000000
--- a/src/main/jni/include/fsdk_baseannot.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FSDK_BASEANNOT_H_
-#define _FSDK_BASEANNOT_H_
-
-#if _FX_OS_ == _FX_ANDROID_
-#include "time.h"
-#else
-#include
-#endif
-
-class CPDFSDK_PageView;
-#define CFX_IntArray CFX_ArrayTemplate
-
-class CPDFSDK_DateTime : public CFX_Object
-{
-public:
- CPDFSDK_DateTime();
- CPDFSDK_DateTime(const CFX_ByteString& dtStr);
- CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
- CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
-
-
- CPDFSDK_DateTime& operator = (const CPDFSDK_DateTime& datetime);
- CPDFSDK_DateTime& operator = (const FX_SYSTEMTIME& st);
- FX_BOOL operator == (CPDFSDK_DateTime& datetime);
- FX_BOOL operator != (CPDFSDK_DateTime& datetime);
- FX_BOOL operator > (CPDFSDK_DateTime& datetime);
- FX_BOOL operator >= (CPDFSDK_DateTime& datetime);
- FX_BOOL operator < (CPDFSDK_DateTime& datetime);
- FX_BOOL operator <= (CPDFSDK_DateTime& datetime);
- operator time_t();
-
- CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr);
- CFX_ByteString ToCommonDateTimeString();
- CFX_ByteString ToPDFDateTimeString();
- void ToSystemTime(FX_SYSTEMTIME& st);
- CPDFSDK_DateTime ToGMT();
- CPDFSDK_DateTime& AddDays(short days);
- CPDFSDK_DateTime& AddSeconds(int seconds);
-
- void ResetDateTime();
-
- struct FX_DATETIME
- {
- FX_SHORT year;
- FX_BYTE month;
- FX_BYTE day;
- FX_BYTE hour;
- FX_BYTE minute;
- FX_BYTE second;
- FX_CHAR tzHour;
- FX_BYTE tzMinute;
- }dt;
-};
-
-class CPDFSDK_Annot
-{
-public:
- CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);
- virtual ~CPDFSDK_Annot();
-public:
- virtual FX_FLOAT GetMinWidth() const;
- virtual FX_FLOAT GetMinHeight() const;
- //define layout order to 5.
- virtual int GetLayoutOrder() const { return 5; }
-
-public:
- CPDF_Annot* GetPDFAnnot();
-
- void SetPage(CPDFSDK_PageView* pPageView);
- CPDFSDK_PageView* GetPageView();
- FX_DWORD GetFlags();
-
- // Tab Order
- int GetTabOrder();
- void SetTabOrder(int iTabOrder);
-
- // Selection
- FX_BOOL IsSelected();
- void SetSelected(FX_BOOL bSelected);
-
- CFX_ByteString GetType() const;
- virtual CFX_ByteString GetSubType() const;
-
- CPDF_Page* GetPDFPage();
-
-public:
- CPDF_Dictionary* GetAnnotDict() const;
-
- void SetRect(const CPDF_Rect& rect);
- CPDF_Rect GetRect() const;
-
- void SetContents(const CFX_WideString& sContents);
- CFX_WideString GetContents() const;
-
- void SetAnnotName(const CFX_WideString& sName);
- CFX_WideString GetAnnotName() const;
-
- void SetModifiedDate(const FX_SYSTEMTIME& st);
- FX_SYSTEMTIME GetModifiedDate() const;
-
- void SetFlags(int nFlags);
- int GetFlags() const;
-
- void SetAppState(const CFX_ByteString& str);
- CFX_ByteString GetAppState() const;
-
- void SetStructParent(int key);
- int GetStructParent() const;
-
- //border
- void SetBorderWidth(int nWidth);
- int GetBorderWidth() const;
-
- //BBS_SOLID
- //BBS_DASH
- //BBS_BEVELED
- //BBS_INSET
- //BBS_UNDERLINE
-
- void SetBorderStyle(int nStyle);
- int GetBorderStyle() const;
-
- void SetBorderDash(const CFX_IntArray& array);
- void GetBorderDash(CFX_IntArray& array) const;
-
- //The background of the annotation's icon when closed
- //The title bar of the annotation's pop-up window
- //The border of a link annotation
-
- void SetColor(FX_COLORREF color);
- void RemoveColor();
- FX_BOOL GetColor(FX_COLORREF& color) const;
-
- FX_BOOL IsVisible() const;
- //action
-
- CPDF_Action GetAction() const;
- void SetAction(const CPDF_Action& a);
- void RemoveAction();
-
- CPDF_AAction GetAAction() const;
- void SetAAction(const CPDF_AAction& aa);
- void RemoveAAction();
-
- virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
-
-public:
- FX_BOOL IsAppearanceValid();
- FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode);
- void DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
- CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
- void DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
- const CPDF_RenderOptions* pOptions);
-
- void ClearCachedAP();
-
- virtual void ResetAppearance();
- void WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox,
- const CPDF_Matrix& matrix, const CFX_ByteString& sContents,
- const CFX_ByteString& sAPState = "");
-
-public:
- virtual void Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions);
-public:
-
-
-private:
- FX_BOOL CreateFormFiller();
-protected:
- CPDF_Annot* m_pAnnot;
- CPDFSDK_PageView* m_pPageView;
- FX_BOOL m_bSelected;
- int m_nTabOrder;
-
-};
-
-
-
-#endif
-
diff --git a/src/main/jni/include/fsdk_baseform.h b/src/main/jni/include/fsdk_baseform.h
deleted file mode 100644
index b93cbbd8..00000000
--- a/src/main/jni/include/fsdk_baseform.h
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FSDK_BASEFORM_H_
-#define _FSDK_BASEFORM_H_
-
-#if _FX_OS_ == _FX_ANDROID_
-#include "time.h"
-#else
-#include
-#endif
-
-class CPDFSDK_Document;
-class CPDFSDK_DateTime;
-struct CPWL_Color;
-class CFFL_FormFiller;
-class CPDFSDK_PageView;
-class CPDFSDK_InterForm;
-
-
-typedef struct _PDFSDK_FieldAction
-{
- _PDFSDK_FieldAction()
- {
- bModifier = FALSE;
- bShift = FALSE;
- nCommitKey = 0;
- bKeyDown = FALSE;
- nSelEnd = nSelStart = 0;
- bWillCommit = FALSE;
- bFieldFull = FALSE;
- bRC = TRUE;
- }
-
- FX_BOOL bModifier; //in
- FX_BOOL bShift; //in
- int nCommitKey; //in
- CFX_WideString sChange; //in[out]
- CFX_WideString sChangeEx; //in
- FX_BOOL bKeyDown; //in
- int nSelEnd; //in[out]
- int nSelStart; //in[out]
- CFX_WideString sValue; //in[out]
- FX_BOOL bWillCommit; //in
- FX_BOOL bFieldFull; //in
- FX_BOOL bRC; //in[out]
-}PDFSDK_FieldAction;
-class CPDFSDK_Widget:public CPDFSDK_Annot
-{
-public:
- CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm);
- virtual ~CPDFSDK_Widget();
-
- virtual CFX_ByteString GetSubType() const;
-
- virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
-
- int GetFieldType() const;
- //define layout order to 2.
- virtual int GetLayoutOrder() {return 2;}
- /*
- FIELDFLAG_READONLY
- FIELDFLAG_REQUIRED
- FIELDFLAG_NOEXPORT
- */
-
- int GetFieldFlags() const;
- int GetRotate() const;
-
- FX_BOOL GetFillColor(FX_COLORREF& color) const;
- FX_BOOL GetBorderColor(FX_COLORREF& color) const;
- FX_BOOL GetTextColor(FX_COLORREF& color) const;
- FX_FLOAT GetFontSize() const;
-
- int GetSelectedIndex(int nIndex) const;
- CFX_WideString GetValue() const;
- CFX_WideString GetDefaultValue() const;
- CFX_WideString GetOptionLabel(int nIndex) const;
- int CountOptions() const;
- FX_BOOL IsOptionSelected(int nIndex) const;
- int GetTopVisibleIndex() const;
- FX_BOOL IsChecked() const;
- /*
- BF_ALIGN_LEFT
- BF_ALIGN_MIDDL
- BF_ALIGN_RIGHT
- */
- int GetAlignment() const;
- int GetMaxLen() const;
- CFX_WideString GetAlternateName() const;
-
-//Set Properties.
- void SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);
- void SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);
- void SetDefaultValue(const CFX_WideString& sValue);
- void SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);
- void ClearSelection(FX_BOOL bNotify);
- void SetTopVisibleIndex(int index);
-
- void ResetAppearance(FX_LPCWSTR sValue, FX_BOOL bValueChanged);
- void ResetFieldAppearance(FX_BOOL bValueChanged);
- void UpdateField();
- CFX_WideString OnFormat(int nCommitKey, FX_BOOL& bFormated);
-
-//Message.
- FX_BOOL OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data,
- CPDFSDK_PageView* pPageView);
-
- CPDFSDK_InterForm* GetInterForm() const {return m_pInterForm;}
- CPDF_FormField* GetFormField() const;
- CPDF_FormControl* GetFormControl() const;
- static CPDF_FormControl* GetFormControl(CPDF_InterForm* pInterForm, CPDF_Dictionary* pAnnotDict);
-
- void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView);
-
- void SetAppModified();
- void ClearAppModified();
- FX_BOOL IsAppModified() const;
-
- FX_INT32 GetAppearanceAge() const;
- FX_INT32 GetValueAge() const;
-
-private:
- void ResetAppearance_PushButton();
- void ResetAppearance_CheckBox();
- void ResetAppearance_RadioButton();
- void ResetAppearance_ComboBox(FX_LPCWSTR sValue);
- void ResetAppearance_ListBox();
- void ResetAppearance_TextField(FX_LPCWSTR sValue);
-
- CPDF_Rect GetClientRect() const;
- CPDF_Rect GetRotatedRect() const;
-
- CFX_ByteString GetBackgroundAppStream() const;
- CFX_ByteString GetBorderAppStream() const;
- CPDF_Matrix GetMatrix() const;
-
- CPWL_Color GetTextPWLColor() const;
- CPWL_Color GetBorderPWLColor() const;
- CPWL_Color GetFillPWLColor() const;
-
- void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
- void RemoveAppearance(const CFX_ByteString& sAPType);
-public:
- FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);
- void DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
- CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
-public:
- FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
-private:
- CPDFSDK_InterForm* m_pInterForm;
- FX_BOOL m_bAppModified;
- FX_INT32 m_nAppAge;
- FX_INT32 m_nValueAge;
-};
-
-#define CPDFSDK_WidgetMap CFX_MapPtrTemplate
-
-class CPDFSDK_InterForm : public CPDF_FormNotify
-{
-public:
- CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
- virtual ~CPDFSDK_InterForm();
-
-public:
- virtual void Destroy();
- virtual CPDF_InterForm* GetInterForm();
-
- CPDFSDK_Document* GetDocument();
- FX_BOOL HighlightWidgets();
-
- CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;
- CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
- void GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArray& widgets);
- void GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets);
-
- void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
- void RemoveMap(CPDF_FormControl* pControl);
-
- void EnableCalculate(FX_BOOL bEnabled);
- FX_BOOL IsCalculateEnabled() const;
-
-#ifdef _WIN32
- CPDF_Stream* LoadImageFromFile(const CFX_WideString& sFile);
-#endif
-
- void OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
- void OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
- void OnCalculate(CPDF_FormField* pFormField = NULL);
- CFX_WideString OnFormat(CPDF_FormField* pFormField, int nCommitKey, FX_BOOL& bFormated);
-
- void ResetFieldAppearance(CPDF_FormField* pFormField, FX_LPCWSTR sValue, FX_BOOL bValueChanged);
- void UpdateField(CPDF_FormField* pFormField);
-
-public:
- FX_BOOL DoAction_Hide(const CPDF_Action& action);
- FX_BOOL DoAction_SubmitForm(const CPDF_Action& action);
- FX_BOOL DoAction_ResetForm(const CPDF_Action& action);
- FX_BOOL DoAction_ImportData(const CPDF_Action& action);
-
- void GetFieldFromObjects(const CFX_PtrArray& objects, CFX_PtrArray& fields);
- FX_BOOL IsValidField(CPDF_Dictionary* pFieldDict);
- FX_BOOL SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields,
- FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded);
- FX_BOOL SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);
- FX_BOOL ImportFormFromFDFFile(const CFX_WideString& csFDFFileName, FX_BOOL bNotify);
- FX_BOOL ExportFormToFDFFile(const CFX_WideString& sFDFFileName);
- FX_BOOL ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
- FX_BOOL ExportFieldsToFDFFile(const CFX_WideString& sFDFFileName, const CFX_PtrArray& fields,
- FX_BOOL bIncludeOrExclude);
- FX_BOOL ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,FX_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf);
- FX_BOOL ExportFormToTxtFile(const CFX_WideString& sTxtFileName);
- FX_BOOL ImportFormFromTxtFile(const CFX_WideString& sTxtFileName);
- CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt);
-
-private:
- virtual int BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue);
- virtual int AfterValueChange(const CPDF_FormField* pField);
- virtual int BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue);
- virtual int AfterSelectionChange(const CPDF_FormField* pField);
- virtual int AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray);
- virtual int BeforeFormReset(const CPDF_InterForm* pForm);
- virtual int AfterFormReset(const CPDF_InterForm* pForm);
- virtual int BeforeFormImportData(const CPDF_InterForm* pForm);
- virtual int AfterFormImportData(const CPDF_InterForm* pForm);
-
-private:
- FX_BOOL FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile);
- FX_BOOL FDFToURLEncodedData(FX_LPBYTE& pBuf, FX_STRSIZE& nBufSize);
- int GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const;
- void DoFDFBuffer(CFX_ByteString sBuffer);
-
-private:
- CPDFSDK_Document* m_pDocument;
- CPDF_InterForm* m_pInterForm;
- CPDFSDK_WidgetMap m_Map;
- FX_BOOL m_bCalculate;
- FX_BOOL m_bBusy;
-
-public:
- FX_BOOL IsNeedHighLight(int nFieldType);
- void RemoveAllHighLight();
- void SetHighlightAlpha(FX_BYTE alpha) {m_iHighlightAlpha = alpha;}
- FX_BYTE GetHighlightAlpha() {return m_iHighlightAlpha;}
- void SetHighlightColor(FX_COLORREF clr, int nFieldType);
- FX_COLORREF GetHighlightColor(int nFieldType);
-private:
- FX_COLORREF m_aHighlightColor[6];
- FX_BYTE m_iHighlightAlpha;
- FX_BOOL m_bNeedHightlight[6];
-};
-
-#define BAI_STRUCTURE 0
-#define BAI_ROW 1
-#define BAI_COLUMN 2
-
-#define CPDFSDK_Annots CFX_ArrayTemplate
-#define CPDFSDK_SortAnnots CGW_ArrayTemplate
-class CBA_AnnotIterator
-{
-public:
- CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_ByteString& sType, const CFX_ByteString& sSubType);
- virtual ~CBA_AnnotIterator();
-
- virtual CPDFSDK_Annot* GetFirstAnnot();
- virtual CPDFSDK_Annot* GetLastAnnot();
- virtual CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot);
- virtual CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot);
-
- virtual void Release(){delete this;}
-
-private:
- void GenerateResults();
- static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
- static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
-
- static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot);
-
-private:
- CPDFSDK_PageView* m_pPageView;
- CFX_ByteString m_sType;
- CFX_ByteString m_sSubType;
- int m_nTabs;
-
- CPDFSDK_Annots m_Annots;
-};
-
-#endif //#define _FSDK_BASEFORM_H_
-
diff --git a/src/main/jni/include/fsdk_common.h b/src/main/jni/include/fsdk_common.h
deleted file mode 100644
index 197917c5..00000000
--- a/src/main/jni/include/fsdk_common.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FSDK_COMMON_H_
-#define _FSDK_COMMON_H_
-
-#define BFFT_SIGNATURE "Signature"
-
-//for all fields
-#define FIELDFLAG_READONLY 1
-#define FIELDFLAG_REQUIRED 2
-#define FIELDFLAG_NOEXPORT 4
-//for text fields
-#define FIELDFLAG_MULTILINE (1<<12)
-#define FIELDFLAG_PASSWORD (1<<13)
-#define FIELDFLAG_FILESELECT (1<<20)
-#define FIELDFLAG_DONOTSPELLCHECK (1<<22)
-#define FIELDFLAG_DONOTSCROLL (1<<23)
-#define FIELDFLAG_COMB (1<<24)
-#define FIELDFLAG_RICHTEXT (1<<25)
-//for button fileds
-#define FIELDFLAG_NOTOGGLETOOFF (1<<14)
-#define FIELDFLAG_RADIO (1<<15)
-#define FIELDFLAG_PUSHBUTTON (1<<16)
-#define FIELDFLAG_RADIOSINUNISON (1<<25)
-//for choice fields
-#define FIELDFLAG_COMBO (1<<17)
-#define FIELDFLAG_EDIT (1<<18)
-#define FIELDFLAG_SORT (1<<19)
-#define FIELDFLAG_MULTISELECT (1<<21)
-#ifndef FIELDFLAG_DONOTSPELLCHECK
-#define FIELDFLAG_DONOTSPELLCHECK (1<<22)
-#endif
-#define FIELDFLAG_COMMITONSELCHANGE (1<<26)
-
-#define BBS_SOLID 0
-#define BBS_DASH 1
-#define BBS_BEVELED 2
-#define BBS_INSET 3
-#define BBS_UNDERLINE 4
-
-
-#endif
diff --git a/src/main/jni/include/fsdk_define.h b/src/main/jni/include/fsdk_define.h
deleted file mode 100644
index 2bf4721c..00000000
--- a/src/main/jni/include/fsdk_define.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFSDK_DEFINE_H
-#define _FPDFSDK_DEFINE_H
-
-#ifdef _WIN32
-#include
-#include
-#endif
-
-//#define API5
-#define API6
-#define _FPDFAPI_ASYNC_PARSING_
-#define _FXSDK_OPENSOURCE_
-
-#ifdef _FPDFEMB_WCE_
- #include "../../core/include/fpdfapi/fpdfapi.h"
- #include "../../core/include/fpdfapi/fpdf_parser.h"
- #include "../../core/include/fpdfapi/fpdf_module.h"
- #include "../../core/include/fpdfapi/fpdf_render.h"
- #include "../../core/include/fpdfapi/fpdf_pageobj.h"
- #include "../../core/include/fpdfapi/fpdf_serial.h"
-
- #include "../../core/include/fpdftext/fpdf_text.h"
-
- #include "../../core/include/fxge/fx_ge_win32.h"
- #include "../../core/include/fxge/fx_ge.h"
-
- #include "../../core/include/fxcodec/fx_codec.h"
-
- #include "../../core/include/fpdfdoc/fpdf_doc.h"
- #include "../../core/include/fpdfdoc/fpdf_vt.h"
-
- #include "../../core/include/fxcrt/fx_xml.h"
- #include "../../core/include/fxcrt/fx_crypt.h"
-
-#else
- #ifdef API6
- #include "../../core/include/fpdfapi/fpdf_parser.h"
- #include "../../core/include/fpdfapi/fpdfapi.h"
- #include "../../core/include/fpdfapi/fpdf_parser.h"
- #include "../../core/include/fpdfapi/fpdf_module.h"
- #include "../../core/include/fpdfapi/fpdf_render.h"
- #include "../../core/include/fpdfapi/fpdf_pageobj.h"
- #include "../../core/include/fpdfapi/fpdf_serial.h"
-
- #include "../../core/include/fpdftext/fpdf_text.h"
-
- #include "../../core/include/fxge/fx_ge_win32.h"
- #include "../../core/include/fxge/fx_ge.h"
-
- #include "../../core/include/fxcodec/fx_codec.h"
-
- #include "../../core/include/fpdfdoc/fpdf_doc.h"
- #include "../../core/include/fpdfdoc/fpdf_vt.h"
-
- #include "../../core/include/fxcrt/fx_xml.h"
- // #include "../../core/include/fdrm/fx_crypt.h"
- #ifdef _LICENSED_BUILD_
- #include "../../cryptopp/Cryptlib.h"
- #endif
- #endif
-#endif
-
-
-#ifndef FX_GetAValue
-/** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */
-#define FX_GetAValue(argb) ((argb & 0xFF000000) >> 24)
-#endif
-
-#ifndef FX_GetRValue
-/** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */
-#define FX_GetRValue(argb) ((argb & 0x00FF0000) >> 16)
-#endif
-
-#ifndef FX_GetGValue
-/** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */
-#define FX_GetGValue(argb) ((argb & 0x0000FF00) >> 8)
-#endif
-
-#ifndef FX_GetBValue
-/** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */
-#define FX_GetBValue(argb) (argb & 0x000000FF)
-#endif
-
-#ifndef FX_ARGBTOCOLORREF
-/** @brief Convert a #FX_ARGB to a #FX_COLORREF. */
-#define FX_ARGBTOCOLORREF(argb) ((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))
-#endif
-
-#ifndef FX_COLORREFTOARGB
-/** @brief Convert a #FX_COLORREF to a #FX_ARGB. */
-#define FX_COLORREFTOARGB(rgb) ((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))
-#endif
-
-typedef unsigned int FX_UINT;
-
-#include "fpdfview.h"
-
-class CPDF_CustomAccess : public IFX_FileRead, public CFX_Object
-{
-public:
- CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
- ~CPDF_CustomAccess() {}
-
- virtual CFX_ByteString GetFullPath() { return ""; }
- virtual FX_FILESIZE GetSize() { return m_FileAccess.m_FileLen; }
-
- virtual FX_BOOL GetByte(FX_DWORD pos, FX_BYTE& ch);
- virtual FX_BOOL GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size);
- virtual void Release() { delete this; }
-
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
-
- FPDF_FILEACCESS m_FileAccess;
- FX_BYTE m_Buffer[512];
- FX_DWORD m_BufferOffset;
-};
-
-void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
-FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
-
-
-#endif//_FPDFSDK_DEFINE_H
diff --git a/src/main/jni/include/fsdk_mgr.h b/src/main/jni/include/fsdk_mgr.h
deleted file mode 100644
index bb25b35e..00000000
--- a/src/main/jni/include/fsdk_mgr.h
+++ /dev/null
@@ -1,615 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FPDFSDK_MGR_H
-#define _FPDFSDK_MGR_H
-
-#include "fsdk_common.h"
-#include "fsdk_define.h"
-#include "fx_systemhandler.h"
-#include "fsdk_baseannot.h"
-#include "fsdk_baseform.h"
-#include "fpdfformfill.h"
-#include "fsdk_annothandler.h"
-#include "fsdk_actionhandler.h"
-
-//cross platform keycode and events define.
-#include "fpdf_fwlevent.h"
-
-
-class CPDFSDK_Document;
-class CPDFSDK_PageView;
-class CPDFSDK_Annot;
-class CFFL_IFormFiller;
-class CPDFSDK_Widget;
-class IFX_SystemHandler;
-class CPDFSDK_ActionHandler;
-class CJS_RuntimeFactory;
-
-#include "javascript/IJavaScript.h"
-
-class CPDFDoc_Environment
-{
-public:
- CPDFDoc_Environment(CPDF_Document * pDoc);
- ~CPDFDoc_Environment();
-
- int RegAppHandle(FPDF_FORMFILLINFO* pFFinfo);//{ m_pInfo = pFFinfo; return TRUE;}
-
- virtual void Release()
- {
- if (m_pInfo && m_pInfo->Release)
- m_pInfo->Release(m_pInfo);
- delete this;
- }
-
- virtual void FFI_Invalidate(FPDF_PAGE page, double left, double top, double right, double bottom)
- {
- if (m_pInfo && m_pInfo->FFI_Invalidate)
- {
- m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);
- }
- }
- virtual void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, double right, double bottom)
- {
- if (m_pInfo && m_pInfo->FFI_OutputSelectedRect)
- {
- m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom);
- }
- }
-
- virtual void FFI_SetCursor(int nCursorType)
- {
- if (m_pInfo && m_pInfo->FFI_SetCursor)
- {
- m_pInfo->FFI_SetCursor(m_pInfo, nCursorType);
- }
- }
-
- virtual int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc)
- {
- if (m_pInfo && m_pInfo->FFI_SetTimer)
- {
- return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc);
- }
- return -1;
- }
-
- virtual void FFI_KillTimer(int nTimerID)
- {
- if (m_pInfo && m_pInfo->FFI_KillTimer)
- {
- m_pInfo->FFI_KillTimer(m_pInfo, nTimerID);
- }
- }
- FX_SYSTEMTIME FFI_GetLocalTime()
- {
- FX_SYSTEMTIME fxtime;
- if(m_pInfo && m_pInfo->FFI_GetLocalTime)
- {
- FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo);
- fxtime.wDay = systime.wDay;
- fxtime.wDayOfWeek = systime.wDayOfWeek;
- fxtime.wHour = systime.wHour;
- fxtime.wMilliseconds = systime.wMilliseconds;
- fxtime.wMinute = systime.wMinute;
- fxtime.wMonth = systime.wMonth;
- fxtime.wSecond = systime.wSecond;
- fxtime.wYear = systime.wYear;
- }
- return fxtime;
- }
-
- virtual void FFI_OnChange()
- {
- if(m_pInfo && m_pInfo->FFI_OnChange)
- {
- m_pInfo->FFI_OnChange(m_pInfo);
- }
- }
-
- virtual FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag)
- {
-
- return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;
- }
- virtual FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag)
- {
-
- return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
- }
- virtual FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag)
- {
-
- return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
- }
- virtual FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag)
- {
- return FALSE;
- }
-
- virtual int JS_appAlert(FX_LPCWSTR Msg, FX_LPCWSTR Title, FX_UINT Type, FX_UINT Icon)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert)
- {
- CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
- CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
- FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
- FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
- int ret = m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, pMsg, pTitle, Type, Icon);
- bsMsg.ReleaseBuffer();
- bsTitle.ReleaseBuffer();
- return ret;
- }
- return -1;
- }
-
- virtual int JS_appResponse(FX_LPCWSTR Question, FX_LPCWSTR Title, FX_LPCWSTR Default, FX_LPCWSTR cLabel, FPDF_BOOL bPassword, void* response, int length)
- {
- if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_response)
- {
- CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode();
- CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
- CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode();
- CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode();
- FPDF_WIDESTRING pQuestion = (FPDF_WIDESTRING)bsQuestion.GetBuffer(bsQuestion.GetLength());
- FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
- FPDF_WIDESTRING pDefault = (FPDF_WIDESTRING)bsDefault.GetBuffer(bsDefault.GetLength());
- FPDF_WIDESTRING pLabel = (FPDF_WIDESTRING)bsLabel.GetBuffer(bsLabel.GetLength());
- int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo->m_pJsPlatform, pQuestion, pTitle,
- pDefault, pLabel, bPassword, response, length);
- bsQuestion.ReleaseBuffer();
- bsTitle.ReleaseBuffer();
- bsDefault.ReleaseBuffer();
- bsLabel.ReleaseBuffer();
- return ret;
- }
- return -1;
- }
-
- virtual void JS_appBeep(int nType)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep)
- {
- m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
- }
- }
-
- virtual CFX_WideString JS_fieldBrowse()
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Field_browse)
- {
- int nLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, NULL, 0);
- if(nLen <= 0)
- return L"";
- char* pbuff = new char[nLen];
- if(pbuff)
- memset(pbuff, 0, nLen);
- else
- return L"";
- nLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, pbuff, nLen);
- CFX_ByteString bsRet = CFX_ByteString(pbuff, nLen);
- CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
- delete[] pbuff;
- return wsRet;
- }
- return L"";
- }
-
- CFX_WideString JS_docGetFilePath()
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_getFilePath)
- {
- int nLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(m_pInfo->m_pJsPlatform, NULL, 0);
- if(nLen <= 0)
- return L"";
- char* pbuff = new char[nLen];
- if(pbuff)
- memset(pbuff, 0, nLen);
- else
- return L"";
- nLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(m_pInfo->m_pJsPlatform, pbuff, nLen);
- CFX_ByteString bsRet = CFX_ByteString(pbuff, nLen);
- CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
- delete[] pbuff;
- return wsRet;
- }
- return L"";
- }
-
- void JS_docSubmitForm(void* formData, int length, FX_LPCWSTR URL)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_submitForm)
- {
- CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
- FPDF_WIDESTRING pDestination = (FPDF_WIDESTRING)bsDestination.GetBuffer(bsDestination.GetLength());
- m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, length, pDestination);
- bsDestination.ReleaseBuffer();
- }
- }
-
- void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,FX_LPCWSTR To, FX_LPCWSTR Subject, FX_LPCWSTR CC, FX_LPCWSTR BCC, FX_LPCWSTR Msg)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_mail)
- {
- CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();
- CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_Encode();
- CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();
- CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();
- CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
- FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
- FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
- FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
- FPDF_WIDESTRING pSubject = (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
- FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
- m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform, mailData, length, bUI, pTo, pSubject,
- pCC, pBcc, pMsg);
- bsTo.ReleaseBuffer();
- bsCC.ReleaseBuffer();
- bsBcc.ReleaseBuffer();
- bsSubject.ReleaseBuffer();
- bsMsg.ReleaseBuffer();
- }
- }
- CFX_WideString JS_appbrowseForDoc(FPDF_BOOL bSave, FX_LPCWSTR cFilenameInit)
- {
- //to do....
- return L"";
-// if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_browseForDoc)
-// {
-// CFX_ByteString bsFilenameInit = CFX_WideString(cFilenameInit).UTF16LE_Encode();
-// FPDF_WIDESTRING pFileNameInit = (FPDF_WIDESTRING)bsFilenameInit.GetBuffer(bsFilenameInit.GetLength());
-//
-// m_pInfo->m_pJsPlatform->app_browseForDoc(m_pInfo->m_pJsPlatform, pFileNameInit);
-// bsFilenameInit.ReleaseBuffer();
-// }
- }
-
- void JS_docprint(FPDF_BOOL bUI , int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_print)
- {
- m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations);
- }
- }
- void JS_docgotoPage(int nPageNum)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_gotoPage)
- {
- m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);
- }
- }
-
- virtual FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document,int nPageIndex)
- {
- if(m_pInfo && m_pInfo->FFI_GetPage)
- {
- return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
- }
- return NULL;
- }
-
- virtual FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document)
- {
- if(m_pInfo && m_pInfo->FFI_GetCurrentPage)
- {
- return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
- }
- return NULL;
- }
-
- int FFI_GetRotation(FPDF_PAGE page)
- {
- if(m_pInfo && m_pInfo->FFI_GetRotation)
- {
- return m_pInfo->FFI_GetRotation(m_pInfo, page);
- }
- return 0;
- }
- void FFI_ExecuteNamedAction(FX_LPCSTR namedAction)
- {
- if(m_pInfo && m_pInfo->FFI_ExecuteNamedAction)
- {
- m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);
- }
- }
- void FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, FX_BOOL bFocus)
- {
- if(m_pInfo && m_pInfo->FFI_SetTextFieldFocus)
- {
- m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);
- }
- }
-
- void FFI_DoURIAction(FX_LPCSTR bsURI)
- {
- if(m_pInfo && m_pInfo->FFI_DoURIAction)
- {
- m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);
- }
- }
-
- void FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int sizeOfArray)
- {
- if(m_pInfo && m_pInfo->FFI_DoGoToAction)
- {
- m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray);
- }
- }
-
-public:
- FX_BOOL IsJSInitiated();
-
-public:
- void SetCurrentDoc(CPDFSDK_Document* pFXDoc) {m_pSDKDoc = pFXDoc;}
- CPDFSDK_Document* GetCurrentDoc();
- CPDF_Document* GetPDFDocument() {return m_pPDFDoc;}
-// CPDFSDK_Document* GetDocument(int nIndex);
-// int CountDocuments() {return m_docMap.GetCount();}
-
- CPDFSDK_Document* OpenDocument(CFX_WideString &fileName);
- CPDFSDK_Document* OpenMemPDFDoc(CPDF_Document* pNewDoc, CFX_WideString &fileName);
- FX_BOOL OpenURL(CFX_WideString &filePath);
-
-
- CFX_ByteString GetAppName() {return "";}
-
- CFFL_IFormFiller* GetIFormFiller();
- IFX_SystemHandler* GetSysHandler() {return m_pSysHandler;}
-
-public:
- CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr();
- IFXJS_Runtime* GetJSRuntime();
- CPDFSDK_ActionHandler* GetActionHander();
-private:
- CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr;
- CPDFSDK_ActionHandler* m_pActionHandler;
- IFXJS_Runtime* m_pJSRuntime;
-public:
- FPDF_FORMFILLINFO* GetFormFillInfo() {return m_pInfo;}
-private:
- FPDF_FORMFILLINFO* m_pInfo;
-// CFX_MapPtrTemplate m_docMap;
- CPDFSDK_Document* m_pSDKDoc;
- CPDF_Document* m_pPDFDoc;
-
- CFFL_IFormFiller* m_pIFormFiller;
- IFX_SystemHandler* m_pSysHandler;
-
-public:
- CJS_RuntimeFactory* m_pJSRuntimeFactory;
-};
-
-
-
-// class CFX_App
-// {
-// public:
-// CFX_App():m_pCurDoc(NULL) {}
-// void SetAt(CPDF_Document* pPDFDoc, CPDFSDK_Document* pFXDoc);
-// CPDFSDK_Document* GetAt(CPDF_Document* pPDFDoc);
-// public:
-// void SetCurrentDocument(CPDFSDK_Document* pFXDoc) {m_pCurDoc = pFXDoc;}
-// CPDFSDK_Document* GetCurrentDocument() {return m_pCurDoc;}
-// private:
-// CFX_MapPtrTemplate m_docArray;
-// CPDFSDK_Document* m_pCurDoc;
-// };
-class CPDFSDK_InterForm;
-class CPDFSDK_Document
-{
-public:
- CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv);
- ~CPDFSDK_Document();
-public:
- CPDFSDK_InterForm* GetInterForm() ;
- CPDF_Document* GetDocument() {return m_pDoc;}
-
-public:
- void InitPageView();
- void AddPageView(CPDF_Page* pPDFPage, CPDFSDK_PageView* pPageView);
- CPDFSDK_PageView* GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE);
- CPDFSDK_PageView* GetPageView(int nIndex);
- CPDFSDK_PageView* GetCurrentView();
- void ReMovePageView(CPDF_Page* pPDFPage);
- void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
-
- CPDFSDK_Annot* GetFocusAnnot();//{return NULL;}
-
- IFXJS_Runtime * GetJsRuntime();
-
- FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);//{return FALSE;}
- FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0);
-
- FX_BOOL ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_Document* pDstDoc);
- FX_BOOL InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages);
- FX_BOOL DeletePages(int nStart, int nCount);
- FX_BOOL ReplacePages(int nPage, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages);
-
- void OnCloseDocument();
-
- int GetPageCount() {return m_pDoc->GetPageCount();}
- FX_BOOL GetPermissions(int nFlag);
- FX_BOOL GetChangeMark() {return m_bChangeMask;}
- void SetChangeMark() {m_bChangeMask = TRUE;}
- void ClearChangeMark() {m_bChangeMask= FALSE;}
-// FX_BOOL GetChangeMark(){return FALSE;}//IsAnnotModified()||IsFormModified() || IsWidgetModified()|| m_nChangeMark>0 ;}
-// void ClearChangeMark(){}
- CFX_WideString GetPath() ;
- CPDF_Page* GetPage(int nIndex);
- CPDFDoc_Environment * GetEnv() {return m_pEnv; }
- void ProcJavascriptFun();
- FX_BOOL ProcOpenAction();
- CPDF_OCContext* GetOCContext();
-private:
- //CFX_ArrayTemplate m_pageArray;
- CFX_MapPtrTemplate m_pageMap;
- CPDF_Document* m_pDoc;
-
- CPDFSDK_InterForm* m_pInterForm;
- CPDFSDK_Annot* m_pFocusAnnot;
- CPDFDoc_Environment * m_pEnv;
- CPDF_OCContext * m_pOccontent;
- FX_BOOL m_bChangeMask;
-};
-
-class CPDFSDK_PageView
-{
-public:
- CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page);
- ~CPDFSDK_PageView();
-public:
- virtual void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions) ;
-public:
- CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDFSDK_Annot* GetFocusAnnot() ;
- void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UINT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);}
- FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {return m_pSDKDoc->KillFocusAnnot(nFlag);}
- FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot);
-
- CPDFSDK_Annot* AddAnnot(CPDF_Dictionary * pDict);
- CPDFSDK_Annot* AddAnnot(FX_LPCSTR lpSubType,CPDF_Dictionary * pDict);
- CPDFSDK_Annot* AddAnnot(CPDF_Annot * pPDFAnnot);
- FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
-
- int CountAnnots();
- CPDFSDK_Annot* GetAnnot(int nIndex);
- CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary * pDict);
- CPDF_Page* GetPDFPage(){return m_page;}
- CPDF_Document* GetPDFDocument();
- CPDFSDK_Document* GetSDKDocument() {return m_pSDKDoc;}
-public:
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag);
- virtual FX_BOOL OnChar(int nChar, FX_UINT nFlag);
- virtual FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
- virtual FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
-
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, int nFlag);
- virtual FX_BOOL OnMouseWheel(double deltaX, double deltaY,const CPDF_Point& point, int nFlag);
- virtual FX_BOOL IsValidAnnot(FX_LPVOID p);
-public:
- virtual void GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_curMatrix;}
- virtual void UpdateRects(CFX_RectArray& rects);
- void UpdateView(CPDFSDK_Annot* pAnnot);
- CFX_PtrArray* GetAnnotList(){ return &m_fxAnnotArray; }
-
-public:
- virtual int GetPageIndex();
- void LoadFXAnnots();
-private:
- CPDF_Matrix m_curMatrix;
-
-private:
- void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widget* pWidget);
-
-private:
- CPDF_Page* m_page;
- CPDF_AnnotList* m_pAnnotList;
-
- //CPDFSDK_Annot* m_pFocusAnnot;
- CFX_PtrArray m_fxAnnotArray;
-
- CPDFSDK_Document* m_pSDKDoc;
-private:
- CPDFSDK_Widget* m_CaptureWidget;
- FX_BOOL m_bEnterWidget;
- FX_BOOL m_bExitWidget;
- FX_BOOL m_bOnWidget;
-public:
- void SetValid(FX_BOOL bValid) {m_bValid = bValid;}
- FX_BOOL IsValid() {return m_bValid;}
-private:
- FX_BOOL m_bValid;
-};
-
-
-template
-class CGW_ArrayTemplate : public CFX_ArrayTemplate
-{
-public:
- CGW_ArrayTemplate(){}
- virtual ~CGW_ArrayTemplate(){}
-
- typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);
-
- void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE)
- {
- int nSize = this->GetSize();
- QuickSort(0, nSize -1, bAscent, pCompare);
- }
-
-private:
- void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMPARE pCompare)
- {
- if (nStartPos >= nStopPos) return;
-
- if ((nStopPos - nStartPos) == 1)
- {
- TYPE Value1 = this->GetAt(nStartPos);
- TYPE Value2 = this->GetAt(nStopPos);
-
- int iGreate = (*pCompare)(Value1, Value2);
- if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
- {
- this->SetAt(nStartPos, Value2);
- this->SetAt(nStopPos, Value1);
- }
- return;
- }
-
- FX_UINT m = (nStartPos + nStopPos) / 2;
- FX_UINT i = nStartPos;
-
- TYPE Value = this->GetAt(m);
-
- while (i < m)
- {
- TYPE temp = this->GetAt(i);
-
- int iGreate = (*pCompare)(temp, Value);
- if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
- {
- this->InsertAt(m+1, temp);
- this->RemoveAt(i);
- m--;
- }
- else
- {
- i++;
- }
- }
-
- FX_UINT j = nStopPos;
-
- while (j > m)
- {
- TYPE temp = this->GetAt(j);
-
- int iGreate = (*pCompare)(temp, Value);
- if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0))
- {
- this->RemoveAt(j);
- this->InsertAt(m, temp);
- m++;
- }
- else
- {
- j--;
- }
- }
-
- if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare);
- if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare);
- }
-};
-
-
-#endif //_FPDFSDK_MGR_H
-
diff --git a/src/main/jni/include/fsdk_rendercontext.h b/src/main/jni/include/fsdk_rendercontext.h
deleted file mode 100644
index 51c37b36..00000000
--- a/src/main/jni/include/fsdk_rendercontext.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _RENDERCONTENT_H_
-#define _RENDERCONTENT_H_
-#include "../include/fsdk_define.h"
-#include "../include/fpdf_progressive.h"
-
-// Everything about rendering is put here: for OOM recovery
-class CRenderContext : public CFX_Object
-{
-public:
- CRenderContext() { Clear(); }
- ~CRenderContext();
-
- void Clear();
-
- CFX_RenderDevice* m_pDevice;
- CPDF_RenderContext* m_pContext;
- CPDF_ProgressiveRenderer* m_pRenderer;
- CPDF_AnnotList* m_pAnnots;
- CPDF_RenderOptions* m_pOptions;
-#ifdef _WIN32_WCE
- CFX_DIBitmap* m_pBitmap;
- HBITMAP m_hBitmap;
-#endif
-};
-
-class IFSDK_PAUSE_Adapter : public IFX_Pause
-{
-public:
- IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause );
- FX_BOOL NeedToPauseNow();
-
-private:
- IFSDK_PAUSE* m_IPause;
-};
-#endif
diff --git a/src/main/jni/include/fx_systemhandler.h b/src/main/jni/include/fx_systemhandler.h
deleted file mode 100644
index b9ac4136..00000000
--- a/src/main/jni/include/fx_systemhandler.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FX_SYSTEMHANDLER_H_
-#define _FX_SYSTEMHANDLER_H_
-
-typedef FX_LPVOID FX_HWND;
-typedef FX_LPVOID FX_HMENU;
-typedef void (*TimerCallback)(FX_INT32 idEvent);
-
-typedef struct _FX_SYSTEMTIME
-{
- FX_WORD wYear;
- FX_WORD wMonth;
- FX_WORD wDayOfWeek;
- FX_WORD wDay;
- FX_WORD wHour;
- FX_WORD wMinute;
- FX_WORD wSecond;
- FX_WORD wMilliseconds;
-}FX_SYSTEMTIME;
-
-//cursor style
-#define FXCT_ARROW 0
-#define FXCT_NESW 1
-#define FXCT_NWSE 2
-#define FXCT_VBEAM 3
-#define FXCT_HBEAM 4
-#define FXCT_HAND 5
-
-class IFX_SystemHandler
-{
-public:
- virtual ~IFX_SystemHandler() {}
- virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;
- virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect&rect) = 0;
-
- virtual FX_BOOL IsSelectionImplemented() = 0;
-
- virtual CFX_WideString GetClipboardText(FX_HWND hWnd) = 0;
- virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0;
-
- virtual void ClientToScreen(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;
- virtual void ScreenToClient(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;
-
- /*cursor style
- FXCT_ARROW
- FXCT_NESW
- FXCT_NWSE
- FXCT_VBEAM
- FXCT_HBEAM
- FXCT_HAND
- */
- virtual void SetCursor(FX_INT32 nCursorType) = 0;
-
- virtual FX_HMENU CreatePopupMenu() = 0;
- virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, FX_INT32 nIDNewItem, CFX_WideString string) = 0;
- virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, FX_INT32 nIDItem, FX_BOOL bEnabled) = 0;
- virtual FX_INT32 TrackPopupMenu(FX_HMENU hMenu, FX_INT32 x, FX_INT32 y, FX_HWND hParent) = 0;
- virtual void DestroyMenu(FX_HMENU hMenu) = 0;
-
- virtual CFX_ByteString GetNativeTrueTypeFont(FX_INT32 nCharset) = 0;
- virtual FX_BOOL FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName) = 0;
- virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, FX_BYTE nCharset) = 0;
-
- virtual FX_INT32 SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) = 0;
- virtual void KillTimer(FX_INT32 nID) = 0;
-
-
- virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) = 0;
- virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) = 0;
- virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) = 0;
- virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) = 0;
-
- virtual FX_SYSTEMTIME GetLocalTime() = 0;
-
- virtual FX_INT32 GetCharSet() = 0;
- virtual void SetCharSet(FX_INT32 nCharSet) = 0;
-};
-
-#endif //_FX_SYSTEMHANDLER_H_
-
diff --git a/src/main/jni/include/fxedit/fx_edit.h b/src/main/jni/include/fxedit/fx_edit.h
deleted file mode 100644
index 95b90961..00000000
--- a/src/main/jni/include/fxedit/fx_edit.h
+++ /dev/null
@@ -1,471 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FX_EDIT_H_
-#define _FX_EDIT_H_
-
-#define PVTWORD_STYLE_NORMAL 0x0000L
-#define PVTWORD_STYLE_HIGHLIGHT 0x0001L
-#define PVTWORD_STYLE_UNDERLINE 0x0002L
-#define PVTWORD_STYLE_CROSSOUT 0x0004L
-#define PVTWORD_STYLE_SQUIGGLY 0x0008L
-#define PVTWORD_STYLE_DUALCROSSOUT 0x0010L
-#define PVTWORD_STYLE_BOLD 0x0020L
-#define PVTWORD_STYLE_ITALIC 0x0040L
-
-#define FX_EDIT_ISLATINWORD(u) (u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
-
-#ifdef FX_READER_DLL
- #ifdef FXET_EXPORT
- #define FXET_CLASS __declspec(dllexport)
- #else
- #define FXET_CLASS
- #endif
-#else
- #define FXET_CLASS
-#endif
-
-#ifndef DEFAULT_CHARSET
-#define DEFAULT_CHARSET 1
-#endif
-
-class IFX_Edit_FontMap;
-class IFX_Edit_Notify;
-class IFX_Edit_Iterator;
-class IFX_Edit_UndoItem;
-class IFX_Edit;
-class IFX_List_Notify;
-class IFX_List;
-class IFX_SystemHandler;
-
-class IFX_Edit_FontMap
-{
-public:
- //map a fontindex to pdf font.
- virtual CPDF_Font * GetPDFFont(FX_INT32 nFontIndex) = 0;
- //get the alias of a pdf font.
- virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0;
- //get the index of a font that can show a word.
- virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0;
- //get the charcode of word from unicode
- virtual FX_INT32 CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0;
- //get the charset of unicode
- virtual FX_INT32 CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0;
-};
-
-class IFX_Edit_Notify
-{
- //this class is implemented by user
-public:
- //set the horizontal scrollbar information.
- virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the vertical scrollbar information.
- virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the position of horizontal scrollbar.
- virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
- //set the position of vertical scrollbar.
- virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
- //set the caret information.
- virtual void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;
- //if the caret position is changed ,send the information of current postion to user.
- virtual void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;
- //if the text area is changed, send the information to user.
- virtual void IOnContentChange(const CPDF_Rect& rcContent) = 0;
- //Invalidate the rectangle relative to the bounding box of edit.
- virtual void IOnInvalidateRect(CPDF_Rect * pRect) = 0;
-};
-
-class IFX_Edit_OprNotify
-{
- //this class is implemented by user
-public:
- //OprType: 0
- virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 1
- virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 2
- virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 3
- virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 4
- virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 5
- virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 6
- virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //
- virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
-};
-
-class IFX_Edit_Iterator
-{
-public:
- virtual ~IFX_Edit_Iterator() {}
-public:
- //move the current position to the next word.
- virtual FX_BOOL NextWord() = 0;
- //move the current position to the next line.
- virtual FX_BOOL NextLine() = 0;
- //move the current position to the next section.
- virtual FX_BOOL NextSection() = 0;
-
- //move the current position to the previous word.
- virtual FX_BOOL PrevWord() = 0;
- //move the current position to the previous line.
- virtual FX_BOOL PrevLine() = 0;
- //move the current position to the previous section.
- virtual FX_BOOL PrevSection() = 0;
-
- //get the information of the current word.
- virtual FX_BOOL GetWord(CPVT_Word & word) const = 0;
- //get the information of the current line.
- virtual FX_BOOL GetLine(CPVT_Line & line) const = 0;
- //get the information of the current section.
- virtual FX_BOOL GetSection(CPVT_Section & section) const = 0;
- //set the current position.
- virtual void SetAt(FX_INT32 nWordIndex) = 0;
- //set the current position.
- virtual void SetAt(const CPVT_WordPlace & place) = 0;
- //get the current position.
- virtual const CPVT_WordPlace & GetAt() const = 0;
-
- //get the edit which this iterator belongs to
- virtual IFX_Edit* GetEdit() const = 0;
-};
-
-class IFX_Edit_UndoItem
-{
-public:
- virtual void Undo() = 0;
- virtual void Redo() = 0;
- virtual CFX_WideString GetUndoTitle() = 0;
- virtual void Release() = 0;
-};
-
-class FXET_CLASS IFX_Edit
-{
-public:
- static IFX_Edit* NewEdit();
- static void DelEdit(IFX_Edit* pEdit);
-
-public:
- //set a IFX_Edit_FontMap pointer implemented by user.
- virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
- //if user don't like to use FontMap, implement VTProvider and set it directly.
- virtual void SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
- //set a IFX_Edit_Notify pointer implemented by user.
- virtual void SetNotify(IFX_Edit_Notify * pNotify) = 0;
- virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
- //get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the contents of edit, but don't need to release.
- virtual IFX_Edit_Iterator* GetIterator() = 0;
- //get a VT pointer relative to this edit.
- virtual IPDF_VariableText* GetVariableText() = 0;
- //get the IFX_Edit_FontMap pointer set by user.
- virtual IFX_Edit_FontMap* GetFontMap() = 0;
-
- //initialize the edit.
- virtual void Initialize() = 0;
-
- //set the bounding box of the text area.
- virtual void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;
- //set the scroll origin
- virtual void SetScrollPos(const CPDF_Point & point) = 0;
-
- //set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).
- virtual void SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
- //set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom).
- virtual void SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
- //if the text is shown in secret , set a character for substitute.
- virtual void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;
- //set the maximal count of words of the text.
- virtual void SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
- //if set the count of charArray , then all words is shown in equal space.
- virtual void SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
- //set the space of two characters.
- virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0;
- //set the horizontal scale of all characters.
- virtual void SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0;
- //set the leading of all lines
- virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
- //if set, CRLF is allowed.
- virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //if set, all words auto fit the width of the bounding box.
- virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //if set, a font size is calculated to full fit the bounding box.
- virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //is set, the text is allowed to scroll.
- virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //set the font size of all words.
- virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
- //the text is allowed to auto-scroll, allow the text overflow?
- virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0;
-
- //query if the edit is richedit.
- virtual FX_BOOL IsRichText() const = 0;
- //set the edit is richedit.
- virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //set the fontsize of selected text.
- virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0;
- //set the fontindex of selected text, user can change the font of selected text.
- virtual FX_BOOL SetRichFontIndex(FX_INT32 nFontIndex) = 0;
- //set the textcolor of selected text.
- virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0;
- //set the text script type of selected text. (0:normal 1:superscript 2:subscript)
- virtual FX_BOOL SetRichTextScript(FX_INT32 nScriptType) = 0;
- //set the bold font style of selected text.
- virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
- //set the italic font style of selected text.
- virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
- //set the underline style of selected text.
- virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
- //set the crossout style of selected text.
- virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
- //set the charspace of selected text, in user coordinate.
- virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
- //set the horizontal scale of selected text, default value is 100.
- virtual FX_BOOL SetRichTextHorzScale(FX_INT32 nHorzScale = 100) = 0;
- //set the leading of selected section, in user coordinate.
- virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
- //set the indent of selected section, in user coordinate.
- virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
- //set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
- virtual FX_BOOL SetRichTextAlignment(FX_INT32 nAlignment) = 0;
-
- //set the selected range of text.
- //if nStartChar == 0 and nEndChar == -1, select all the text.
- virtual void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0;
- //get the selected range of text.
- virtual void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const = 0;
- //select all the text.
- virtual void SelectAll() = 0;
- //set text is not selected.
- virtual void SelectNone() = 0;
- //get the caret position.
- virtual FX_INT32 GetCaret() const = 0;
- virtual CPVT_WordPlace GetCaretWordPlace() const = 0;
- //get the string of selected text.
- virtual CFX_WideString GetSelText() const = 0;
- //get the text conent
- virtual CFX_WideString GetText() const = 0;
- //query if any text is selected.
- virtual FX_BOOL IsSelected() const = 0;
- //get the scroll origin
- virtual CPDF_Point GetScrollPos() const = 0;
- //get the bounding box of the text area.
- virtual CPDF_Rect GetPlateRect() const = 0;
- //get the fact area of the text.
- virtual CPDF_Rect GetContentRect() const = 0;
- //get the visible word range
- virtual CPVT_WordRange GetVisibleWordRange() const = 0;
- //get the whole word range
- virtual CPVT_WordRange GetWholeWordRange() const = 0;
- //get the word range of select text
- virtual CPVT_WordRange GetSelectWordRange() const = 0;
-
- //send the mousedown message to edit for response.
- //if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
- virtual void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the mousemove message to edit when mouse down is TRUE.
- virtual void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the UP key message to edit.
- virtual void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the DOWN key message to edit.
- virtual void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the LEFT key message to edit.
- virtual void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the RIGHT key message to edit.
- virtual void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the HOME key message to edit.
- virtual void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the END key message to edit.
- virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
-
- //put text into edit.
- virtual void SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
- //insert a word into the edit.
- virtual FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0;
- //insert a return into the edit.
- virtual FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
- //insert text into the edit.
- virtual FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
- //do backspace operation.
- virtual FX_BOOL Backspace() = 0;
- //do delete operation.
- virtual FX_BOOL Delete() = 0;
- //delete the selected text.
- virtual FX_BOOL Clear() = 0;
-
- //do Redo operation.
- virtual FX_BOOL Redo() = 0;
- //do Undo operation.
- virtual FX_BOOL Undo() = 0;
- //move caret
- virtual void SetCaret(FX_INT32 nPos) = 0;
-
- //arrange all words over again
- virtual void Paint() = 0;
-
- //allow to refresh screen?
- virtual void EnableRefresh(FX_BOOL bRefresh) = 0;
-
- virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0;
-
- //allow undo/redo?
- virtual void EnableUndo(FX_BOOL bUndo) = 0;
-
- //allow notify?
- virtual void EnableNotify(FX_BOOL bNotify) = 0;
-
- //allow opr notify?
- virtual void EnableOprNotify(FX_BOOL bNotify) = 0;
-
- //map word place to word index.
- virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;
- //map word index to word place.
- virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0;
-
- //get the beginning position of a line
- virtual CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;
-
- //get the ending position of a line
- virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const = 0;
-
- //get the beginning position of a section
- virtual CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;
-
- //get the ending position of a section
- virtual CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;
-
- //search a wordplace form point
- virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0;
-
- //get the font size of non_rich text or default font size of richtext.
- virtual FX_FLOAT GetFontSize() const = 0;
- //get the mask character.
- virtual FX_WORD GetPasswordChar() const = 0;
- //get the count of charArray
- virtual FX_INT32 GetCharArray() const = 0;
- //get the horizontal scale of all characters
- virtual FX_INT32 GetHorzScale() const = 0;
- //get the space of two characters
- virtual FX_FLOAT GetCharSpace() const = 0;
- //get the latin words of specified range
- virtual CFX_WideString GetRangeText(const CPVT_WordRange & range) const = 0;
- //is the text full in bounding box
- virtual FX_BOOL IsTextFull() const = 0;
- virtual FX_BOOL CanUndo() const = 0;
- virtual FX_BOOL CanRedo() const = 0;
- //if the content is changed after settext?
- virtual FX_BOOL IsModified() const = 0;
- //get the total words in edit
- virtual FX_INT32 GetTotalWords() const = 0;
-
- virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
-
-public:
- static CFX_ByteString GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
- const CPVT_WordRange* pRange = NULL,
- FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
- static CFX_ByteString GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);
- static void DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);
- static void DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
- static void DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
- static void GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
- const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate& ObjArray);
- static void GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
- const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate& ObjArray);
- static void GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
- const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);
-};
-
-class IFX_List_Notify
-{
- //this class is implemented by user
-public:
- //set the horizontal scrollbar information.
- virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the vertical scrollbar information.
- virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the position of horizontal scrollbar.
- virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
- //set the position of vertical scrollbar.
- virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
- //Invalidate the rectangle relative to the bounding box of edit.
- virtual void IOnInvalidateRect(CPDF_Rect * pRect) = 0;
-};
-
-class FXET_CLASS IFX_List
-{
-public:
- static IFX_List* NewList();
- static void DelList(IFX_List* pList);
-
-public:
- virtual void SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;
- virtual void SetNotify(IFX_List_Notify * pNotify) = 0;
-
- virtual void SetPlateRect(const CPDF_Rect & rect) = 0;
- virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
-
- virtual CPDF_Rect GetPlateRect() const = 0;
- virtual CPDF_Rect GetContentRect() const = 0;
-
- virtual FX_FLOAT GetFontSize() const = 0;
- virtual IFX_Edit* GetItemEdit(FX_INT32 nIndex) const = 0;
- virtual FX_INT32 GetCount() const = 0;
- virtual FX_BOOL IsItemSelected(FX_INT32 nIndex) const = 0;
- virtual FX_FLOAT GetFirstHeight() const = 0;
-
- virtual void SetMultipleSel(FX_BOOL bMultiple) = 0;
- virtual FX_BOOL IsMultipleSel() const = 0;
- virtual FX_BOOL IsValid(FX_INT32 nItemIndex) const = 0;
- virtual FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0;
-
- virtual void SetScrollPos(const CPDF_Point & point) = 0;
- virtual void ScrollToListItem(FX_INT32 nItemIndex) = 0;
- virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const = 0;
- virtual FX_INT32 GetCaret() const = 0;
- virtual FX_INT32 GetSelect() const = 0;
- virtual FX_INT32 GetTopItem() const = 0;
- virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const = 0;
- virtual FX_INT32 GetFirstSelected() const = 0;
-
- virtual void AddString(FX_LPCWSTR string) = 0;
- virtual void SetTopItem(FX_INT32 nIndex) = 0;
- virtual void Select(FX_INT32 nItemIndex) = 0;
- virtual void SetCaret(FX_INT32 nItemIndex) = 0;
- virtual void Empty() = 0;
- virtual void Cancel() = 0;
- virtual CFX_WideString GetText() const = 0;
-
-
- virtual void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
-};
-
-#endif
-
diff --git a/src/main/jni/include/fxedit/fxet_edit.h b/src/main/jni/include/fxedit/fxet_edit.h
deleted file mode 100644
index f65715b1..00000000
--- a/src/main/jni/include/fxedit/fxet_edit.h
+++ /dev/null
@@ -1,823 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FXET_EDIT_H_
-#define _FXET_EDIT_H_
-
-#include "fx_edit.h"
-
-class CFX_Edit_Page;
-struct CFX_Edit_LineRect;
-class CFX_Edit_LineRectArray;
-class CFX_Edit_RectArray;
-class CFX_Edit_Refresh;
-class CFX_Edit_Select;
-class CFX_Edit;
-class CFX_Edit_Iterator;
-class CFX_Edit_Refresh;
-class CFX_Edit_UndoItem;
-class CFX_Edit_Undo;
-class CFX_Edit_Provider;
-
-#define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001)
-#define FX_EDIT_IsFloatEqual(fa,fb) FX_EDIT_IsFloatZero(fa - fb)
-#define FX_EDIT_IsFloatBigger(fa,fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa,fb))
-#define FX_EDIT_IsFloatSmaller(fa,fb) (fa < fb && !FX_EDIT_IsFloatEqual(fa,fb))
-
-template T FX_EDIT_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
-template T FX_EDIT_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
-
-#define FX_EDIT_PI 3.14159265358979f
-#define FX_EDIT_ITALIC_ANGEL 10 * FX_EDIT_PI / 180.0f
-
-
-/* ------------------------- CFX_Edit_Refresh ---------------------------- */
-
-enum REFRESH_PLAN_E
-{
- RP_ANALYSE,
- RP_NOANALYSE,
- RP_OPTIONAL
-};
-
-enum EDIT_PROPS_E
-{
- EP_LINELEADING,
- EP_LINEINDENT,
- EP_ALIGNMENT,
- EP_FONTINDEX,
- EP_FONTSIZE,
- EP_WORDCOLOR,
- EP_SCRIPTTYPE,
- EP_UNDERLINE,
- EP_CROSSOUT,
- EP_CHARSPACE,
- EP_HORZSCALE,
- EP_BOLD,
- EP_ITALIC
-};
-
-struct CFX_Edit_LineRect
-{
- CFX_Edit_LineRect(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine) :
- m_wrLine(wrLine), m_rcLine(rcLine)
- {
- }
-
- FX_BOOL operator != (const CFX_Edit_LineRect & linerect) const
- {
- return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;
- }
-
- FX_BOOL IsSameHeight(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero((m_rcLine.top - m_rcLine.bottom) - (linerect.m_rcLine.top -linerect.m_rcLine.bottom));
- }
-
- FX_BOOL IsSameTop(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);
- }
-
- FX_BOOL IsSameLeft(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);
- }
-
- FX_BOOL IsSameRight(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);
- }
-
- CPVT_WordRange m_wrLine;
- CPDF_Rect m_rcLine;
-};
-
-class CFX_Edit_LineRectArray
-{
-public:
- CFX_Edit_LineRectArray()
- {
- }
-
- virtual ~CFX_Edit_LineRectArray()
- {
- Empty();
- }
-
- void Empty()
- {
- for (FX_INT32 i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
- delete m_LineRects.GetAt(i);
-
- m_LineRects.RemoveAll();
- }
-
- void RemoveAll()
- {
- m_LineRects.RemoveAll();
- }
-
- void operator = (CFX_Edit_LineRectArray & rects)
- {
- Empty();
- for (FX_INT32 i = 0, sz = rects.GetSize(); i < sz; i++)
- m_LineRects.Add(rects.GetAt(i));
-
- rects.RemoveAll();
- }
-
- void Add(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine)
- {
- if (CFX_Edit_LineRect * pRect = new CFX_Edit_LineRect(wrLine,rcLine))
- m_LineRects.Add(pRect);
- }
-
- FX_INT32 GetSize() const
- {
- return m_LineRects.GetSize();
- }
-
- CFX_Edit_LineRect * GetAt(FX_INT32 nIndex) const
- {
- if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
- return NULL;
-
- return m_LineRects.GetAt(nIndex);
- }
-
- CFX_ArrayTemplate m_LineRects;
-};
-
-class CFX_Edit_RectArray
-{
-public:
- CFX_Edit_RectArray()
- {
- }
-
- virtual ~CFX_Edit_RectArray()
- {
- this->Empty();
- }
-
- void Empty()
- {
- for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)
- delete m_Rects.GetAt(i);
-
- this->m_Rects.RemoveAll();
- }
-
- void Add(const CPDF_Rect & rect)
- {
- //check for overlaped area
- for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)
- if (CPDF_Rect * pRect = m_Rects.GetAt(i))
- if (pRect->Contains(rect))return;
-
- if (CPDF_Rect * pNewRect = new CPDF_Rect(rect))
- m_Rects.Add(pNewRect);
- }
-
- FX_INT32 GetSize() const
- {
- return m_Rects.GetSize();
- }
-
- CPDF_Rect * GetAt(FX_INT32 nIndex) const
- {
- if (nIndex < 0 || nIndex >= m_Rects.GetSize())
- return NULL;
-
- return m_Rects.GetAt(nIndex);
- }
-
- CFX_ArrayTemplate m_Rects;
-};
-
-class CFX_Edit_Refresh
-{
-public:
- CFX_Edit_Refresh();
- virtual ~CFX_Edit_Refresh();
-
- void BeginRefresh();
- void Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect);
- void NoAnalyse();
- void Analyse(FX_INT32 nAlignment);
- void AddRefresh(const CPDF_Rect & rect);
- const CFX_Edit_RectArray * GetRefreshRects() const;
- void EndRefresh();
-
-private:
- CFX_Edit_LineRectArray m_NewLineRects;
- CFX_Edit_LineRectArray m_OldLineRects;
- CFX_Edit_RectArray m_RefreshRects;
-};
-
-
-/* ------------------------- CFX_Edit_Select ---------------------------- */
-
-class CFX_Edit_Select
-{
-public:
- CFX_Edit_Select()
- {
- }
-
- CFX_Edit_Select(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
- {
- Set(begin,end);
- }
-
- CFX_Edit_Select(const CPVT_WordRange & range)
- {
- Set(range.BeginPos,range.EndPos);
- }
-
- CPVT_WordRange ConvertToWordRange() const
- {
- return CPVT_WordRange(this->BeginPos,this->EndPos);
- }
-
- void Default()
- {
- BeginPos.Default();
- EndPos.Default();
- }
-
- void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
- {
- this->BeginPos = begin;
- this->EndPos = end;
- }
-
- void SetBeginPos(const CPVT_WordPlace & begin)
- {
- this->BeginPos = begin;
- }
-
- void SetEndPos(const CPVT_WordPlace & end)
- {
- this->EndPos = end;
- }
-
- FX_BOOL IsExist() const
- {
- return this->BeginPos != this->EndPos;
- }
-
- FX_BOOL operator != (const CPVT_WordRange & wr) const
- {
- return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos;
- }
-
- CPVT_WordPlace BeginPos,EndPos;
-};
-
-/* ------------------------- CFX_Edit_Undo ---------------------------- */
-
-class CFX_Edit_Undo
-{
-public:
- CFX_Edit_Undo(FX_INT32 nBufsize = 10000);
- virtual ~CFX_Edit_Undo();
-
- void Undo();
- void Redo();
-
- void AddItem(IFX_Edit_UndoItem* pItem);
-
- FX_BOOL CanUndo() const;
- FX_BOOL CanRedo() const;
- FX_BOOL IsModified() const;
- FX_BOOL IsWorking() const;
-
- void Reset();
-
- IFX_Edit_UndoItem* GetItem(FX_INT32 nIndex);
- FX_INT32 GetItemCount(){return m_UndoItemStack.GetSize();}
- FX_INT32 GetCurUndoPos(){return m_nCurUndoPos;}
-
-private:
- void SetBufSize(FX_INT32 nSize){m_nBufSize = nSize;}
- FX_INT32 GetBufSize(){return m_nBufSize;}
-
- void RemoveHeads();
- void RemoveTails();
-
-private:
- CFX_ArrayTemplate m_UndoItemStack;
-
- FX_INT32 m_nCurUndoPos;
- FX_INT32 m_nBufSize;
- FX_BOOL m_bModified;
- FX_BOOL m_bVirgin;
- FX_BOOL m_bWorking;
-};
-
-class CFX_Edit_UndoItem : public IFX_Edit_UndoItem
-{
-public:
- CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
- virtual ~CFX_Edit_UndoItem(){}
-
- virtual CFX_WideString GetUndoTitle() {return L"";}
- virtual void Release(){delete this;}
-
-public:
- void SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;}
- FX_BOOL IsFirst(){return m_bFirst;}
- void SetLast(FX_BOOL bLast){m_bLast = bLast;}
- FX_BOOL IsLast(){return m_bLast;}
-
-private:
- FX_BOOL m_bFirst;
- FX_BOOL m_bLast;
-};
-
-class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem
-{
-public:
- CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
- virtual ~CFX_Edit_GroupUndoItem();
-
- void AddUndoItem(CFX_Edit_UndoItem* pUndoItem);
- void UpdateItems();
-
-public:
- virtual void Undo();
- virtual void Redo();
- virtual CFX_WideString GetUndoTitle();
- virtual void Release();
-
-private:
- CFX_WideString m_sTitle;
- CFX_ArrayTemplate m_Items;
-};
-
-/* ------------------------- CFX_Edit_UndoItem derived classes ---------------------------- */
-
-class CFXEU_InsertWord : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps);
- virtual ~CFXEU_InsertWord();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit* m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- FX_WORD m_Word;
- FX_INT32 m_nCharset;
- CPVT_WordProps m_WordProps;
-};
-
-class CFXEU_InsertReturn : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- virtual ~CFXEU_InsertReturn();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
-};
-
-class CFXEU_Backspace : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- FX_WORD word, FX_INT32 charset,
- const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
- virtual ~CFXEU_Backspace();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- FX_WORD m_Word;
- FX_INT32 m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
-};
-
-class CFXEU_Delete : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- FX_WORD word, FX_INT32 charset,
- const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd);
- virtual ~CFXEU_Delete();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- FX_WORD m_Word;
- FX_INT32 m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
- FX_BOOL m_bSecEnd;
-};
-
-class CFXEU_Clear : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText);
- virtual ~CFXEU_Clear();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit* m_pEdit;
-
- CPVT_WordRange m_wrSel;
- CFX_WideString m_swText;
-};
-
-class CFXEU_ClearRich : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- const CPVT_WordRange & wrSel,
- FX_WORD word, FX_INT32 charset,
- const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
- virtual ~CFXEU_ClearRich();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CPVT_WordRange m_wrSel;
- FX_WORD m_Word;
- FX_INT32 m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
-};
-
-class CFXEU_InsertText : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- const CFX_WideString & swText, FX_INT32 charset,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- virtual ~CFXEU_InsertText();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CFX_WideString m_swText;
- FX_INT32 m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
-};
-
-class CFXEU_SetSecProps : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep,
- const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops,
- const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range);
- virtual ~CFXEU_SetSecProps();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
- CPVT_WordPlace m_wpPlace;
- CPVT_WordRange m_wrPlace;
- EDIT_PROPS_E m_eProps;
-
- CPVT_SecProps m_OldSecProps;
- CPVT_SecProps m_NewSecProps;
- CPVT_WordProps m_OldWordProps;
- CPVT_WordProps m_NewWordProps;
-};
-
-class CFXEU_SetWordProps : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep,
- const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range);
- virtual ~CFXEU_SetWordProps();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
- CPVT_WordPlace m_wpPlace;
- CPVT_WordRange m_wrPlace;
- EDIT_PROPS_E m_eProps;
-
- CPVT_WordProps m_OldWordProps;
- CPVT_WordProps m_NewWordProps;
-};
-
-/* ------------------------- CFX_Edit ---------------------------- */
-
-class CFX_Edit : public IFX_Edit
-{
- friend class CFX_Edit_Iterator;
- friend class CFXEU_InsertWord;
- friend class CFXEU_InsertReturn;
- friend class CFXEU_Backspace;
- friend class CFXEU_Delete;
- friend class CFXEU_Clear;
- friend class CFXEU_ClearRich;
- friend class CFXEU_SetSecProps;
- friend class CFXEU_SetWordProps;
- friend class CFXEU_InsertText;
-
-public:
- CFX_Edit(IPDF_VariableText * pVT);
- virtual ~CFX_Edit();
-
- void SetFontMap(IFX_Edit_FontMap * pFontMap);
- void SetVTProvider(IPDF_VariableText_Provider* pProvider);
- void SetNotify(IFX_Edit_Notify * pNotify);
- void SetOprNotify(IFX_Edit_OprNotify* pOprNotify);
- IFX_Edit_Iterator* GetIterator();
- IPDF_VariableText * GetVariableText();
- IFX_Edit_FontMap* GetFontMap();
-
- void Initialize();
- void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE);
- void SetScrollPos(const CPDF_Point & point);
-
- void SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);
- void SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);
- void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);
- void SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE);
- void SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE);
- void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
- void SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE);
- void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
- void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
- void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
-
- FX_BOOL IsRichText() const;
- void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
- FX_BOOL SetRichFontSize(FX_FLOAT fFontSize);
- FX_BOOL SetRichFontIndex(FX_INT32 nFontIndex);
- FX_BOOL SetRichTextColor(FX_COLORREF dwColor);
- FX_BOOL SetRichTextScript(FX_INT32 nScriptType);
- FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE);
- FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE);
- FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE);
- FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE);
- FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace);
- FX_BOOL SetRichTextHorzScale(FX_INT32 nHorzScale = 100);
- FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading);
- FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent);
- FX_BOOL SetRichTextAlignment(FX_INT32 nAlignment);
-
- void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
-
- void SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL Backspace();
- FX_BOOL Delete();
- FX_BOOL Clear();
- FX_BOOL Empty();
- FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL Redo();
- FX_BOOL Undo();
- CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, FX_INT32 charset,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- FX_INT32 GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);
-
- FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const;
- CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const;
-
- CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
-
- FX_INT32 GetCaret() const;
- CPVT_WordPlace GetCaretWordPlace() const;
- CFX_WideString GetSelText() const;
- CFX_WideString GetText() const;
- FX_FLOAT GetFontSize() const;
- FX_WORD GetPasswordChar() const;
- CPDF_Point GetScrollPos() const;
- FX_INT32 GetCharArray() const;
- CPDF_Rect GetPlateRect() const;
- CPDF_Rect GetContentRect() const;
- CFX_WideString GetRangeText(const CPVT_WordRange & range) const;
- FX_INT32 GetHorzScale() const;
- FX_FLOAT GetCharSpace() const;
- FX_INT32 GetTotalWords() const;
- FX_INT32 GetTotalLines() const;
-
- void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
- void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
-
-private:
- void SelectAll();
- void SelectNone();
- void SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end);
- FX_BOOL IsSelected() const;
-
- void RearrangeAll();
- void RearrangePart(const CPVT_WordRange & range);
- void Paint();
- void ScrollToCaret();
- void SetScrollInfo();
- void SetScrollPosX(FX_FLOAT fx);
- void SetScrollPosY(FX_FLOAT fy);
- void SetScrollLimit();
- void SetContentChanged();
- void EnableNotify(FX_BOOL bNotify);
-
- void SetText(FX_LPCWSTR text,FX_INT32 charset,
- const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset,
- const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- FX_BOOL SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
- FX_BOOL SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
- const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
- void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr);
- void PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlace & wpNew);
-
- inline CPDF_Point VTToEdit(const CPDF_Point & point) const;
- inline CPDF_Point EditToVT(const CPDF_Point & point) const;
- inline CPDF_Rect VTToEdit(const CPDF_Rect & rect) const;
- inline CPDF_Rect EditToVT(const CPDF_Rect & rect) const;
-
- void EnableRefresh(FX_BOOL bRefresh);
- void Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1 = NULL,const CPVT_WordRange * pRange2 = NULL);
- void RefreshPushLineRects(const CPVT_WordRange & wr);
- void RefreshPushRandomRects(const CPVT_WordRange & wr);
- void RefreshWordRange(const CPVT_WordRange& wr);
-
- void SetCaret(FX_INT32 nPos);
- void SetCaret(const CPVT_WordPlace & place);
- void SetCaretInfo();
- void SetCaretOrigin();
- void SetCaretChange();
-
- CPVT_WordRange GetWholeWordRange() const;
- CPVT_WordRange GetVisibleWordRange() const;
- CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace & place) const;
- CPVT_WordRange CombineWordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2);
- CPVT_WordRange GetSelectWordRange() const;
-
- void EnableUndo(FX_BOOL bUndo);
- void EnableOprNotify(FX_BOOL bNotify);
-
- FX_BOOL IsTextFull() const;
- FX_BOOL IsTextOverflow() const;
- FX_BOOL CanUndo() const;
- FX_BOOL CanRedo() const;
- FX_BOOL IsModified() const;
-
- void BeginGroupUndo(const CFX_WideString& sTitle);
- void EndGroupUndo();
- void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
- void AddUndoItem(IFX_Edit_UndoItem* pUndoItem);
-
- void SetPageInfo(const CPVT_WordPlace& place);
- CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, const CPDF_Point& point) const;
- FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const;
- FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const;
-
-private:
- IPDF_VariableText* m_pVT;
- IFX_Edit_Notify* m_pNotify;
- IFX_Edit_OprNotify* m_pOprNotify;
- CFX_Edit_Provider* m_pVTProvide;
-
- CPVT_WordPlace m_wpCaret;
- CPVT_WordPlace m_wpOldCaret;
- CFX_Edit_Select m_SelState;
-
- CPDF_Point m_ptScrollPos;
- CPDF_Point m_ptRefreshScrollPos;
- FX_BOOL m_bEnableScroll;
- IFX_Edit_Iterator * m_pIterator;
- CFX_Edit_Refresh m_Refresh;
- CPDF_Point m_ptCaret;
- CFX_Edit_Undo m_Undo;
- FX_INT32 m_nAlignment;
- FX_BOOL m_bNotifyFlag;
- FX_BOOL m_bTextFullFlag;
- FX_BOOL m_bEnableOverflow;
- FX_BOOL m_bEnableRefresh;
- CPDF_Rect m_rcOldContent;
- FX_BOOL m_bEnableUndo;
- FX_BOOL m_bNotify;
- FX_BOOL m_bOprNotify;
- CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
-};
-
-/* ------------------------- CFX_Edit_Iterator ---------------------------- */
-
-class CFX_Edit_Iterator : public IFX_Edit_Iterator
-{
-public:
- CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator);
- virtual ~CFX_Edit_Iterator();
-
- FX_BOOL NextWord();
- FX_BOOL NextLine();
- FX_BOOL NextSection();
- FX_BOOL PrevWord();
- FX_BOOL PrevLine();
- FX_BOOL PrevSection();
-
- FX_BOOL GetWord(CPVT_Word & word) const;
- FX_BOOL GetLine(CPVT_Line & line) const;
- FX_BOOL GetSection(CPVT_Section & section) const;
- void SetAt(FX_INT32 nWordIndex);
- void SetAt(const CPVT_WordPlace & place);
- const CPVT_WordPlace & GetAt() const;
- IFX_Edit* GetEdit() const;
-
-private:
- CFX_Edit * m_pEdit;
- IPDF_VariableText_Iterator* m_pVTIterator;
-};
-
-class CFX_Edit_Provider : public IPDF_VariableText_Provider
-{
-public:
- CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
- virtual ~CFX_Edit_Provider();
-
- IFX_Edit_FontMap* GetFontMap();
-
- FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle);
- FX_INT32 GetTypeAscent(FX_INT32 nFontIndex);
- FX_INT32 GetTypeDescent(FX_INT32 nFontIndex);
- FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex);
- FX_INT32 GetDefaultFontIndex();
- FX_BOOL IsLatinWord(FX_WORD word);
-
-private:
- IFX_Edit_FontMap* m_pFontMap;
-};
-
-#endif //_FXET_EDIT_H_
-
diff --git a/src/main/jni/include/fxedit/fxet_list.h b/src/main/jni/include/fxedit/fxet_list.h
deleted file mode 100644
index 1157bbec..00000000
--- a/src/main/jni/include/fxedit/fxet_list.h
+++ /dev/null
@@ -1,363 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FXET_LIST_H_
-#define _FXET_LIST_H_
-
-#include "fx_edit.h"
-
-class IFX_Edit;
-
-class CLST_Size
-{
-public:
- CLST_Size() : x(0.0f), y(0.0f)
- {
- }
-
- CLST_Size(FX_FLOAT x,FX_FLOAT y)
- {
- this->x = x;
- this->y = y;
- }
-
- void Default()
- {
- x = 0.0f;
- y = 0.0f;
- }
-
- FX_BOOL operator != (const CLST_Size & size) const
- {
- return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;
- }
-
- FX_FLOAT x,y;
-};
-
-class CLST_Rect : public CPDF_Rect
-{
-public:
- CLST_Rect()
- {
- left = top = right = bottom = 0.0f;
- }
-
- CLST_Rect(FX_FLOAT left,FX_FLOAT top,
- FX_FLOAT right,FX_FLOAT bottom)
- {
- this->left = left;
- this->top = top;
- this->right = right;
- this->bottom = bottom;
- }
-
- CLST_Rect(const CPDF_Rect & rect)
- {
- this->left = rect.left;
- this->top = rect.top;
- this->right = rect.right;
- this->bottom = rect.bottom;
- }
-
- void Default()
- {
- left = top = right = bottom = 0.0f;
- }
-
- const CLST_Rect operator = (const CPDF_Rect & rect)
- {
- this->left = rect.left;
- this->top = rect.top;
- this->right = rect.right;
- this->bottom = rect.bottom;
-
- return *this;
- }
-
- FX_BOOL operator == (const CLST_Rect & rect) const
- {
- return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
- }
-
- FX_BOOL operator != (const CLST_Rect & rect) const
- {
- return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;
- }
-
- FX_FLOAT Width() const
- {
- return this->right - this->left;
- }
-
- FX_FLOAT Height() const
- {
- if (this->top > this->bottom)
- return this->top - this->bottom;
- else
- return this->bottom - this->top;
- }
-
- CPDF_Point LeftTop() const
- {
- return CPDF_Point(left,top);
- }
-
- CPDF_Point RightBottom() const
- {
- return CPDF_Point(right,bottom);
- }
-
- const CLST_Rect operator += (const CPDF_Point & point)
- {
- this->left += point.x;
- this->right += point.x;
- this->top += point.y;
- this->bottom += point.y;
-
- return *this;
- }
-
- const CLST_Rect operator -= (const CPDF_Point & point)
- {
- this->left -= point.x;
- this->right -= point.x;
- this->top -= point.y;
- this->bottom -= point.y;
-
- return *this;
- }
-
- CLST_Rect operator + (const CPDF_Point & point) const
- {
- return CLST_Rect(left + point.x,
- top + point.y,
- right + point.x,
- bottom + point.y);
- }
-
- CLST_Rect operator - (const CPDF_Point & point) const
- {
- return CLST_Rect(left - point.x,
- top - point.y,
- right - point.x,
- bottom - point.y);
- }
-};
-
-class CFX_ListItem
-{
-public:
- CFX_ListItem();
- virtual ~CFX_ListItem();
-
- void SetFontMap(IFX_Edit_FontMap * pFontMap);
- IFX_Edit_Iterator* GetIterator() const;
- IFX_Edit* GetEdit() const;
-
-public:
- void SetRect(const CLST_Rect & rect);
- void SetSelect(FX_BOOL bSelected);
- void SetCaret(FX_BOOL bCaret);
- void SetText(FX_LPCWSTR text);
- void SetFontSize(FX_FLOAT fFontSize);
- CFX_WideString GetText() const;
-
- CLST_Rect GetRect() const;
- FX_BOOL IsSelected() const;
- FX_BOOL IsCaret() const;
- FX_FLOAT GetItemHeight() const;
- FX_WORD GetFirstChar() const;
-
-private:
- IFX_Edit* m_pEdit;
- FX_BOOL m_bSelected; //ÊÇ·ñÑ¡ÖÐ
- FX_BOOL m_bCaret; //ÊÇ·ñΪ½¹µã£¬¶àѡʱÓÃ
- CLST_Rect m_rcListItem; //ÄÚ²¿×ø±ê
-};
-
-class CFX_ListContainer
-{
-public:
- CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0.0f,0.0f,0.0f){}
- virtual ~CFX_ListContainer(){}
- virtual void SetPlateRect(const CPDF_Rect & rect){m_rcPlate = rect;}
- CPDF_Rect GetPlateRect() const{return m_rcPlate;}
- void SetContentRect(const CLST_Rect & rect){m_rcContent = rect;}
- CLST_Rect GetContentRect() const{return m_rcContent;}
- CPDF_Point GetBTPoint() const{return CPDF_Point(m_rcPlate.left,m_rcPlate.top);}
- CPDF_Point GetETPoint() const{return CPDF_Point(m_rcPlate.right,m_rcPlate.bottom);}
-public:
- CPDF_Point InnerToOuter(const CPDF_Point & point) const{return CPDF_Point(point.x + GetBTPoint().x,GetBTPoint().y - point.y);}
- CPDF_Point OuterToInner(const CPDF_Point & point) const{return CPDF_Point(point.x - GetBTPoint().x,GetBTPoint().y - point.y);}
- CPDF_Rect InnerToOuter(const CLST_Rect & rect) const{CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left,rect.top));
- CPDF_Point ptRightBottom = InnerToOuter(CPDF_Point(rect.right,rect.bottom));
- return CPDF_Rect(ptLeftTop.x,ptRightBottom.y,ptRightBottom.x,ptLeftTop.y);}
- CLST_Rect OuterToInner(const CPDF_Rect & rect) const{CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left,rect.top));
- CPDF_Point ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom));
- return CLST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);}
-private:
- CPDF_Rect m_rcPlate;
- CLST_Rect m_rcContent; //positive forever!
-};
-
-template class CLST_ArrayTemplate : public CFX_ArrayTemplate
-{
-public:
- FX_BOOL IsEmpty() { return CFX_ArrayTemplate::GetSize() <= 0; }
- TYPE GetAt(FX_INT32 nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate::GetSize()) return CFX_ArrayTemplate::GetAt(nIndex); return NULL;}
- void RemoveAt(FX_INT32 nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate::GetSize()) CFX_ArrayTemplate::RemoveAt(nIndex);}
-};
-
-class CFX_List : protected CFX_ListContainer , public IFX_List
-{
-public:
- CFX_List();
- virtual ~CFX_List();
-
-public:
- virtual void SetFontMap(IFX_Edit_FontMap * pFontMap);
- virtual void SetFontSize(FX_FLOAT fFontSize);
-
- virtual CPDF_Rect GetPlateRect() const;
- virtual CPDF_Rect GetContentRect() const;
-
- virtual FX_FLOAT GetFontSize() const;
- virtual IFX_Edit* GetItemEdit(FX_INT32 nIndex) const;
- virtual FX_INT32 GetCount() const;
- virtual FX_BOOL IsItemSelected(FX_INT32 nIndex) const;
- virtual FX_FLOAT GetFirstHeight() const;
-
- virtual void SetMultipleSel(FX_BOOL bMultiple);
- virtual FX_BOOL IsMultipleSel() const;
- virtual FX_BOOL IsValid(FX_INT32 nItemIndex) const;
- virtual FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;
-
-protected:
- virtual void Empty();
-
- void AddItem(FX_LPCWSTR str);
- virtual void ReArrange(FX_INT32 nItemIndex);
-
- virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const;
- CFX_WideString GetItemText(FX_INT32 nIndex) const;
-
- void SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);
- void SetItemCaret(FX_INT32 nItemIndex, FX_BOOL bCaret);
-
- virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const;
- FX_INT32 GetFirstSelected() const;
- FX_INT32 GetLastSelected() const;
- FX_WCHAR Toupper(FX_WCHAR c) const;
-
-private:
- CLST_ArrayTemplate m_aListItems;
- FX_FLOAT m_fFontSize;
- IFX_Edit_FontMap* m_pFontMap;
- FX_BOOL m_bMultiple;
-};
-
-struct CPLST_Select_Item
-{
- CPLST_Select_Item(FX_INT32 nItemIndex,FX_INT32 nState)
- {
- this->nItemIndex = nItemIndex;
- this->nState = nState;
- }
-
- FX_INT32 nItemIndex;
- FX_INT32 nState; //0:normal select -1:to deselect 1: to select
-};
-
-class CPLST_Select
-{
-public:
- CPLST_Select();
- virtual ~CPLST_Select();
-
-public:
- void Add(FX_INT32 nItemIndex);
- void Add(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
- void Sub(FX_INT32 nItemIndex);
- void Sub(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
- FX_BOOL IsExist(FX_INT32 nItemIndex) const;
- FX_INT32 Find(FX_INT32 nItemIndex) const;
- FX_INT32 GetCount() const;
- FX_INT32 GetItemIndex(FX_INT32 nIndex) const;
- FX_INT32 GetState(FX_INT32 nIndex) const;
- void Done();
- void DeselectAll();
-
-private:
- CFX_ArrayTemplate m_aItems;
-};
-
-class CFX_ListCtrl : public CFX_List
-{
-public:
- CFX_ListCtrl();
- virtual ~CFX_ListCtrl();
-
-public:
- void SetNotify(IFX_List_Notify * pNotify);
-
- void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl);
- FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl);
-
- virtual CPDF_Point InToOut(const CPDF_Point & point) const;
- virtual CPDF_Point OutToIn(const CPDF_Point & point) const;
- virtual CPDF_Rect InToOut(const CPDF_Rect & rect) const;
- virtual CPDF_Rect OutToIn(const CPDF_Rect & rect) const;
-
- virtual void SetPlateRect(const CPDF_Rect & rect);
- void SetScrollPos(const CPDF_Point & point);
- void ScrollToListItem(FX_INT32 nItemIndex);
- virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const;
- FX_INT32 GetCaret() const {return m_nCaretIndex;}
- FX_INT32 GetSelect() const {return m_nSelItem;}
- FX_INT32 GetTopItem() const;
- virtual CPDF_Rect GetContentRect() const;
- virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const;
-
- void AddString(FX_LPCWSTR string);
- void SetTopItem(FX_INT32 nIndex);
- void Select(FX_INT32 nItemIndex);
- virtual void SetCaret(FX_INT32 nItemIndex);
- virtual void Empty();
- virtual void Cancel();
- CFX_WideString GetText() const;
-
-private:
- void SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);
- void SetSingleSelect(FX_INT32 nItemIndex);
- void InvalidateItem(FX_INT32 nItemIndex);
- void SelectItems();
- FX_BOOL IsItemVisible(FX_INT32 nItemIndex) const;
- void SetScrollInfo();
- void SetScrollPosY(FX_FLOAT fy);
- virtual void ReArrange(FX_INT32 nItemIndex);
-
-private:
- IFX_List_Notify* m_pNotify;
- FX_BOOL m_bNotifyFlag;
- CPDF_Point m_ptScrollPos;
- CPLST_Select m_aSelItems; //for multiple
- FX_INT32 m_nSelItem; //for single
- FX_INT32 m_nFootIndex; //for multiple
- FX_BOOL m_bCtrlSel; //for multiple
- FX_INT32 m_nCaretIndex; //for multiple
-};
-
-#endif
-
diff --git a/src/main/jni/include/fxedit/fxet_stub.h b/src/main/jni/include/fxedit/fxet_stub.h
deleted file mode 100644
index a1aa2e25..00000000
--- a/src/main/jni/include/fxedit/fxet_stub.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FXET_STUB_H_
-#define _FXET_STUB_H_
-
-#include "../../../core/include/fpdfapi/fpdf_module.h"
-#include "../../../core/include/fpdfapi/fpdf_render.h"
-#include "../../../core/include/fpdfapi/fpdf_pageobj.h"
-#include "../../../core/include/fpdfdoc/fpdf_vt.h"
-#include "../fx_systemhandler.h"
-#ifdef FX_READER_DLL
- #ifdef _DEBUG
- #pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fxcoredll[dbg,w32,vc6].lib")
- #pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fpdfdocdll[dbg,w32,vc6].lib")
- #else
- #pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fxcoredll[rel,w32,vc6].lib")
- #pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fpdfdocdll[rel,w32,vc6].lib")
- #endif
-#endif
-
-#endif
-
diff --git a/src/main/jni/include/javascript/Consts.h b/src/main/jni/include/javascript/Consts.h
deleted file mode 100644
index c3a954ef..00000000
--- a/src/main/jni/include/javascript/Consts.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _CONSTS_H_
-#define _CONSTS_H_
-
-/* ------------------------------ border ------------------------------ */
-
-class CJS_Border : public CJS_Object
-{
-public:
- CJS_Border(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Border(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ display ------------------------------ */
-
-class CJS_Display : public CJS_Object
-{
-public:
- CJS_Display(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Display(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ font ------------------------------ */
-
-class CJS_Font : public CJS_Object
-{
-public:
- CJS_Font(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Font(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ highlight ------------------------------ */
-
-class CJS_Highlight : public CJS_Object
-{
-public:
- CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Highlight(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ position ------------------------------ */
-
-class CJS_Position : public CJS_Object
-{
-public:
- CJS_Position(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Position(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ scaleHow ------------------------------ */
-
-class CJS_ScaleHow : public CJS_Object
-{
-public:
- CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_ScaleHow(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ scaleWhen ------------------------------ */
-
-class CJS_ScaleWhen : public CJS_Object
-{
-public:
- CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_ScaleWhen(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ style ------------------------------ */
-
-class CJS_Style : public CJS_Object
-{
-public:
- CJS_Style(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Style(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ zoomtype ------------------------------ */
-
-class CJS_Zoomtype : public CJS_Object
-{
-public:
- CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Zoomtype(void){};
-
- DECLARE_JS_CLASS_CONST();
-};
-
-/* ------------------------------ CJS_GlobalConsts ------------------------------ */
-
-class CJS_GlobalConsts : public CJS_Object
-{
-public:
- static int Init(IJS_Runtime* pRuntime);
-};
-
-/* ------------------------------ CJS_GlobalArrays ------------------------------ */
-
-class CJS_GlobalArrays : public CJS_Object
-{
-public:
- static int Init(IJS_Runtime* pRuntime);
-};
-
-#endif //_CONSTS_H_
-
diff --git a/src/main/jni/include/javascript/Document.h b/src/main/jni/include/javascript/Document.h
deleted file mode 100644
index ca8b51b8..00000000
--- a/src/main/jni/include/javascript/Document.h
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _DOCUMENT_H_
-#define _DOCUMENT_H_
-
-
-
-class PrintParamsObj : public CJS_EmbedObj
-{
-public:
- PrintParamsObj(CJS_Object* pJSObject);
- virtual ~PrintParamsObj(){}
-
-public:
- FX_BOOL bUI;
- int nStart;
- int nEnd;
- FX_BOOL bSilent;
- FX_BOOL bShrinkToFit;
- FX_BOOL bPrintAsImage;
- FX_BOOL bReverse;
- FX_BOOL bAnnotations;
-};
-
-class CJS_PrintParamsObj : public CJS_Object
-{
-public:
- CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}
- virtual ~CJS_PrintParamsObj(){}
-
- DECLARE_JS_CLASS(CJS_PrintParamsObj);
-};
-
-
-class Icon;
-class Field;
-
-struct IconElement
-{
- IconElement() : IconName(L""), IconStream(NULL), NextIcon(NULL){}
- virtual ~IconElement()
- {
- }
- CFX_WideString IconName;
- IconElement* NextIcon;
- Icon* IconStream;
-};
-
-class IconTree
-{
-public:
- IconTree():m_pHead(NULL), m_pEnd(NULL), m_iLength(0)
- {
-
- }
-
- virtual ~IconTree()
- {
- }
-
-public:
- void InsertIconElement(IconElement* pNewIcon);
- void DeleteIconElement(CFX_WideString swIconName);
- void DeleteIconTree();
- int GetLength();
- IconElement* operator[](int iIndex);
-
-private:
- IconElement* m_pHead;
- IconElement* m_pEnd;
- int m_iLength;
-};
-
-struct CJS_DelayData;
-struct CJS_DelayAnnot;
-struct CJS_AnnotObj;
-
-class Document : public CJS_EmbedObj
-{
-public:
- Document(CJS_Object* pJSObject);
- virtual ~Document();
-
-public:
- FX_BOOL ADBE(OBJ_PROP_PARAMS);
- FX_BOOL author(OBJ_PROP_PARAMS);
- FX_BOOL baseURL(OBJ_PROP_PARAMS);
- FX_BOOL bookmarkRoot(OBJ_PROP_PARAMS);
- FX_BOOL calculate(OBJ_PROP_PARAMS);
- FX_BOOL Collab(OBJ_PROP_PARAMS);
- FX_BOOL creationDate(OBJ_PROP_PARAMS);
- FX_BOOL creator(OBJ_PROP_PARAMS);
- FX_BOOL delay(OBJ_PROP_PARAMS);
- FX_BOOL dirty(OBJ_PROP_PARAMS);
- FX_BOOL documentFileName(OBJ_PROP_PARAMS);
- FX_BOOL external(OBJ_PROP_PARAMS);
- FX_BOOL filesize(OBJ_PROP_PARAMS);
- FX_BOOL icons(OBJ_PROP_PARAMS);
- FX_BOOL info(OBJ_PROP_PARAMS);
- FX_BOOL keywords(OBJ_PROP_PARAMS);
- FX_BOOL layout(OBJ_PROP_PARAMS);
- FX_BOOL media(OBJ_PROP_PARAMS);
- FX_BOOL modDate(OBJ_PROP_PARAMS);
- FX_BOOL mouseX(OBJ_PROP_PARAMS);
- FX_BOOL mouseY(OBJ_PROP_PARAMS);
- FX_BOOL numFields(OBJ_PROP_PARAMS);
- FX_BOOL numPages(OBJ_PROP_PARAMS);
- FX_BOOL pageNum(OBJ_PROP_PARAMS);
- FX_BOOL pageWindowRect(OBJ_PROP_PARAMS);
- FX_BOOL path(OBJ_PROP_PARAMS);
- FX_BOOL producer(OBJ_PROP_PARAMS);
- FX_BOOL subject(OBJ_PROP_PARAMS);
- FX_BOOL title(OBJ_PROP_PARAMS);
- FX_BOOL zoom(OBJ_PROP_PARAMS);
- FX_BOOL zoomType(OBJ_PROP_PARAMS);
-
- FX_BOOL addAnnot(OBJ_METHOD_PARAMS);
- FX_BOOL addField(OBJ_METHOD_PARAMS);
- FX_BOOL addLink(OBJ_METHOD_PARAMS);
- FX_BOOL addIcon(OBJ_METHOD_PARAMS);
- FX_BOOL calculateNow(OBJ_METHOD_PARAMS);
- FX_BOOL closeDoc(OBJ_METHOD_PARAMS);
- FX_BOOL createDataObject(OBJ_METHOD_PARAMS);
- FX_BOOL deletePages(OBJ_METHOD_PARAMS);
- FX_BOOL exportAsText(OBJ_METHOD_PARAMS);
- FX_BOOL exportAsFDF(OBJ_METHOD_PARAMS);
- FX_BOOL exportAsXFDF(OBJ_METHOD_PARAMS);
- FX_BOOL extractPages(OBJ_METHOD_PARAMS);
- FX_BOOL getAnnot(OBJ_METHOD_PARAMS);
- FX_BOOL getAnnots(OBJ_METHOD_PARAMS);
- FX_BOOL getAnnot3D(OBJ_METHOD_PARAMS);
- FX_BOOL getAnnots3D(OBJ_METHOD_PARAMS);
- FX_BOOL getField(OBJ_METHOD_PARAMS);
- FX_BOOL getIcon(OBJ_METHOD_PARAMS);
- FX_BOOL getLinks(OBJ_METHOD_PARAMS);
- FX_BOOL getNthFieldName(OBJ_METHOD_PARAMS);
- FX_BOOL getOCGs(OBJ_METHOD_PARAMS);
- FX_BOOL getPageBox(OBJ_METHOD_PARAMS);
- FX_BOOL getPageNthWord(OBJ_METHOD_PARAMS);
- FX_BOOL getPageNthWordQuads(OBJ_METHOD_PARAMS);
- FX_BOOL getPageNumWords(OBJ_METHOD_PARAMS);
- FX_BOOL getPrintParams(OBJ_METHOD_PARAMS);
- FX_BOOL getURL(OBJ_METHOD_PARAMS);
- FX_BOOL importAnFDF(OBJ_METHOD_PARAMS);
- FX_BOOL importAnXFDF(OBJ_METHOD_PARAMS);
- FX_BOOL importTextData(OBJ_METHOD_PARAMS);
- FX_BOOL insertPages(OBJ_METHOD_PARAMS);
- FX_BOOL mailForm(OBJ_METHOD_PARAMS);
- FX_BOOL print(OBJ_METHOD_PARAMS);
- FX_BOOL removeField(OBJ_METHOD_PARAMS);
- FX_BOOL replacePages(OBJ_METHOD_PARAMS);
- FX_BOOL resetForm(OBJ_METHOD_PARAMS);
- FX_BOOL saveAs(OBJ_METHOD_PARAMS);
- FX_BOOL submitForm(OBJ_METHOD_PARAMS);
- FX_BOOL mailDoc(OBJ_METHOD_PARAMS);
- FX_BOOL removeIcon(OBJ_METHOD_PARAMS);
-
-public:
- void AttachDoc(CPDFSDK_Document* pDoc);
- CPDFSDK_Document* GetReaderDoc();
-
- static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName);
- static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName);
-
-public:
- void AddDelayData(CJS_DelayData* pData);
- void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
-
- void AddDelayAnnotData(CJS_AnnotObj *pData);
- void DoAnnotDelay();
- void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
-
-private:
- CFX_WideString ReversalStr(CFX_WideString cbFrom);
- CFX_WideString CutString(CFX_WideString cbFrom);
- bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
- int CountWords(CPDF_TextObject* pTextObj);
- CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
-
- FX_BOOL ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj);
-
-private:
- v8::Isolate* m_isolate;
- IconTree* m_pIconTree;
- CPDFSDK_Document* m_pDocument;
- CFX_WideString m_cwBaseURL;
-
- FX_BOOL m_bDelay;
- CFX_ArrayTemplate m_DelayData;
- CFX_ArrayTemplate m_DelayAnnotData;
-};
-
-class CJS_Document : public CJS_Object
-{
-public:
- CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Document(){};
-
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_JS_CLASS(CJS_Document);
-
- JS_STATIC_PROP(ADBE, Document);
- JS_STATIC_PROP(author, Document);
- JS_STATIC_PROP(baseURL, Document);
- JS_STATIC_PROP(bookmarkRoot, Document);
- JS_STATIC_PROP(calculate, Document);
- JS_STATIC_PROP(Collab, Document);
- JS_STATIC_PROP(creationDate, Document);
- JS_STATIC_PROP(creator, Document);
- JS_STATIC_PROP(delay, Document);
- JS_STATIC_PROP(dirty, Document);
- JS_STATIC_PROP(documentFileName, Document);
- JS_STATIC_PROP(external, Document);
- JS_STATIC_PROP(filesize, Document);
- JS_STATIC_PROP(icons, Document);
- JS_STATIC_PROP(info, Document);
- JS_STATIC_PROP(keywords, Document);
- JS_STATIC_PROP(layout, Document);
- JS_STATIC_PROP(media, Document);
- JS_STATIC_PROP(modDate, Document);
- JS_STATIC_PROP(mouseX, Document);
- JS_STATIC_PROP(mouseY, Document);
- JS_STATIC_PROP(numFields, Document);
- JS_STATIC_PROP(numPages, Document);
- JS_STATIC_PROP(pageNum, Document);
- JS_STATIC_PROP(pageWindowRect, Document);
- JS_STATIC_PROP(path, Document);
- JS_STATIC_PROP(producer, Document);
- JS_STATIC_PROP(subject, Document);
- JS_STATIC_PROP(title, Document);
- JS_STATIC_PROP(zoom, Document);
- JS_STATIC_PROP(zoomType, Document);
-
- JS_STATIC_METHOD(addAnnot,Document);
- JS_STATIC_METHOD(addField, Document);
- JS_STATIC_METHOD(addLink, Document);
- JS_STATIC_METHOD(addIcon, Document);
- JS_STATIC_METHOD(calculateNow, Document);
- JS_STATIC_METHOD(closeDoc, Document);
- JS_STATIC_METHOD(createDataObject, Document);
- JS_STATIC_METHOD(deletePages, Document);
- JS_STATIC_METHOD(exportAsText, Document);
- JS_STATIC_METHOD(exportAsFDF, Document);
- JS_STATIC_METHOD(exportAsXFDF, Document);
- JS_STATIC_METHOD(extractPages, Document);
- JS_STATIC_METHOD(getAnnot, Document);
- JS_STATIC_METHOD(getAnnots, Document);
- JS_STATIC_METHOD(getAnnot3D, Document);
- JS_STATIC_METHOD(getAnnots3D, Document);
- JS_STATIC_METHOD(getField, Document);
- JS_STATIC_METHOD(getIcon, Document);
- JS_STATIC_METHOD(getLinks, Document);
- JS_STATIC_METHOD(getNthFieldName, Document);
- JS_STATIC_METHOD(getOCGs, Document);
- JS_STATIC_METHOD(getPageBox, Document);
- JS_STATIC_METHOD(getPageNthWord, Document);
- JS_STATIC_METHOD(getPageNthWordQuads, Document);
- JS_STATIC_METHOD(getPageNumWords, Document);
- JS_STATIC_METHOD(getPrintParams, Document);
- JS_STATIC_METHOD(getURL, Document);
- JS_STATIC_METHOD(importAnFDF, Document);
- JS_STATIC_METHOD(importAnXFDF, Document);
- JS_STATIC_METHOD(importTextData, Document);
- JS_STATIC_METHOD(insertPages, Document);
- JS_STATIC_METHOD(mailForm, Document);
- JS_STATIC_METHOD(print, Document);
- JS_STATIC_METHOD(removeField, Document);
- JS_STATIC_METHOD(replacePages, Document);
- JS_STATIC_METHOD(removeIcon, Document);
- JS_STATIC_METHOD(resetForm, Document);
- JS_STATIC_METHOD(saveAs, Document);
- JS_STATIC_METHOD(submitForm, Document);
- JS_STATIC_METHOD(mailDoc, Document);
-};
-
-#endif//_DOCUMENT_H_
-
diff --git a/src/main/jni/include/javascript/Field.h b/src/main/jni/include/javascript/Field.h
deleted file mode 100644
index 2aea85af..00000000
--- a/src/main/jni/include/javascript/Field.h
+++ /dev/null
@@ -1,355 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _FIELD_H_
-#define _FIELD_H_
-
-class Document;
-
-enum FIELD_PROP
-{
- FP_ALIGNMENT,
- FP_BORDERSTYLE,
- FP_BUTTONALIGNX,
- FP_BUTTONALIGNY,
- FP_BUTTONFITBOUNDS,
- FP_BUTTONPOSITION,
- FP_BUTTONSCALEHOW,
- FP_BUTTONSCALEWHEN,
- FP_CALCORDERINDEX,
- FP_CHARLIMIT,
- FP_COMB,
- FP_COMMITONSELCHANGE,
- FP_CURRENTVALUEINDICES,
- FP_DEFAULTVALUE,
- FP_DONOTSCROLL,
- FP_DISPLAY,
- FP_FILLCOLOR,
- FP_HIDDEN,
- FP_HIGHLIGHT,
- FP_LINEWIDTH,
- FP_MULTILINE,
- FP_MULTIPLESELECTION,
- FP_PASSWORD,
- FP_RECT,
- FP_RICHTEXT,
- FP_RICHVALUE,
- FP_ROTATION,
- FP_STROKECOLOR,
- FP_STYLE,
- FP_TEXTCOLOR,
- FP_TEXTFONT,
- FP_TEXTSIZE,
- FP_USERNAME,
- FP_VALUE
-};
-
-class CJS_WideStringArray
-{
-public:
- CJS_WideStringArray(){}
- virtual ~CJS_WideStringArray()
- {
- for (int i=0,sz=m_Data.GetSize(); i m_Data;
-};
-
-struct CJS_DelayData
-{
- CFX_WideString sFieldName;
- int nControlIndex;
- enum FIELD_PROP eProp;
- FX_INT32 num;
- bool b;
- CFX_ByteString string;
- CFX_WideString widestring;
- CPDF_Rect rect;
- CPWL_Color color;
- CFX_DWordArray wordarray;
- CJS_WideStringArray widestringarray;
-};
-
-class Field : public CJS_EmbedObj
-{
-public:
- Field(CJS_Object* pJSObject);
- virtual ~Field(void);
-
- FX_BOOL alignment(OBJ_PROP_PARAMS);
- FX_BOOL borderStyle(OBJ_PROP_PARAMS);
- FX_BOOL buttonAlignX(OBJ_PROP_PARAMS);
- FX_BOOL buttonAlignY(OBJ_PROP_PARAMS);
- FX_BOOL buttonFitBounds(OBJ_PROP_PARAMS);
- FX_BOOL buttonPosition(OBJ_PROP_PARAMS);
- FX_BOOL buttonScaleHow(OBJ_PROP_PARAMS);
- FX_BOOL buttonScaleWhen(OBJ_PROP_PARAMS);
- FX_BOOL calcOrderIndex(OBJ_PROP_PARAMS);
- FX_BOOL charLimit(OBJ_PROP_PARAMS);
- FX_BOOL comb(OBJ_PROP_PARAMS);
- FX_BOOL commitOnSelChange(OBJ_PROP_PARAMS);
- FX_BOOL currentValueIndices(OBJ_PROP_PARAMS);
- FX_BOOL defaultStyle(OBJ_PROP_PARAMS);
- FX_BOOL defaultValue(OBJ_PROP_PARAMS);
- FX_BOOL doNotScroll(OBJ_PROP_PARAMS);
- FX_BOOL doNotSpellCheck(OBJ_PROP_PARAMS);
- FX_BOOL delay(OBJ_PROP_PARAMS);
- FX_BOOL display(OBJ_PROP_PARAMS);
- FX_BOOL doc(OBJ_PROP_PARAMS);
- FX_BOOL editable(OBJ_PROP_PARAMS);
- FX_BOOL exportValues(OBJ_PROP_PARAMS);
- FX_BOOL fileSelect(OBJ_PROP_PARAMS);
- FX_BOOL fillColor(OBJ_PROP_PARAMS);
- FX_BOOL hidden(OBJ_PROP_PARAMS);
- FX_BOOL highlight(OBJ_PROP_PARAMS);
- FX_BOOL lineWidth(OBJ_PROP_PARAMS);
- FX_BOOL multiline(OBJ_PROP_PARAMS);
- FX_BOOL multipleSelection(OBJ_PROP_PARAMS);
- FX_BOOL name(OBJ_PROP_PARAMS);
- FX_BOOL numItems(OBJ_PROP_PARAMS);
- FX_BOOL page(OBJ_PROP_PARAMS);
- FX_BOOL password(OBJ_PROP_PARAMS);
- FX_BOOL print(OBJ_PROP_PARAMS);
- FX_BOOL radiosInUnison(OBJ_PROP_PARAMS);
- FX_BOOL readonly(OBJ_PROP_PARAMS);
- FX_BOOL rect(OBJ_PROP_PARAMS);
- FX_BOOL required(OBJ_PROP_PARAMS);
- FX_BOOL richText(OBJ_PROP_PARAMS);
- FX_BOOL richValue(OBJ_PROP_PARAMS);
- FX_BOOL rotation(OBJ_PROP_PARAMS);
- FX_BOOL strokeColor(OBJ_PROP_PARAMS);
- FX_BOOL style(OBJ_PROP_PARAMS);
- FX_BOOL submitName(OBJ_PROP_PARAMS);
- FX_BOOL textColor(OBJ_PROP_PARAMS);
- FX_BOOL textFont(OBJ_PROP_PARAMS);
- FX_BOOL textSize(OBJ_PROP_PARAMS);
- FX_BOOL type(OBJ_PROP_PARAMS);
- FX_BOOL userName(OBJ_PROP_PARAMS);
- FX_BOOL value(OBJ_PROP_PARAMS);
- FX_BOOL valueAsString(OBJ_PROP_PARAMS);
- FX_BOOL source(OBJ_PROP_PARAMS);
-
- FX_BOOL browseForFileToSubmit(OBJ_METHOD_PARAMS);
- FX_BOOL buttonGetCaption(OBJ_METHOD_PARAMS);
- FX_BOOL buttonGetIcon(OBJ_METHOD_PARAMS);
- FX_BOOL buttonImportIcon(OBJ_METHOD_PARAMS);
- FX_BOOL buttonSetCaption(OBJ_METHOD_PARAMS);
- FX_BOOL buttonSetIcon(OBJ_METHOD_PARAMS);
- FX_BOOL checkThisBox(OBJ_METHOD_PARAMS);
- FX_BOOL clearItems(OBJ_METHOD_PARAMS);
- FX_BOOL defaultIsChecked(OBJ_METHOD_PARAMS);
- FX_BOOL deleteItemAt(OBJ_METHOD_PARAMS);
- FX_BOOL getArray(OBJ_METHOD_PARAMS);
- FX_BOOL getItemAt(OBJ_METHOD_PARAMS);
- FX_BOOL getLock(OBJ_METHOD_PARAMS);
- FX_BOOL insertItemAt(OBJ_METHOD_PARAMS);
- FX_BOOL isBoxChecked(OBJ_METHOD_PARAMS);
- FX_BOOL isDefaultChecked(OBJ_METHOD_PARAMS);
- FX_BOOL setAction(OBJ_METHOD_PARAMS);
- FX_BOOL setFocus(OBJ_METHOD_PARAMS);
- FX_BOOL setItems(OBJ_METHOD_PARAMS);
- FX_BOOL setLock(OBJ_METHOD_PARAMS);
- FX_BOOL signatureGetModifications(OBJ_METHOD_PARAMS);
- FX_BOOL signatureGetSeedValue(OBJ_METHOD_PARAMS);
- FX_BOOL signatureInfo(OBJ_METHOD_PARAMS);
- FX_BOOL signatureSetSeedValue(OBJ_METHOD_PARAMS);
- FX_BOOL signatureSign(OBJ_METHOD_PARAMS);
- FX_BOOL signatureValidate(OBJ_METHOD_PARAMS);
-
-public:
- static void SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array);
- static void SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
- static void SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
- static void SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect);
- static void SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
- static void SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
- static void SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray);
-
-public:
- static void AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType,
- const CFX_WideString& sName, const CPDF_Rect& rcCoords);
-public:
- static void UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField,
- FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
- static void UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl,
- FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
-
- static CPDFSDK_Widget* GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl);
- static void GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
-
- static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);
-
-public:
- FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName);
- void SetDelay(FX_BOOL bDelay);
- void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
-protected:
- void ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &strFieldName,int & iControlNo);
- void GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
- CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
- FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
-
- void AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n);
- void AddDelay_Bool(enum FIELD_PROP prop,bool b);
- void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
- void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
- void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
- void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);
- void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
- void AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array);
-
- void DoDelay();
-public:
- Document* m_pJSDoc;
- CPDFSDK_Document* m_pDocument;
- CFX_WideString m_FieldName;
- int m_nFormControlIndex;
- FX_BOOL m_bCanSet;
-
- FX_BOOL m_bDelay;
- v8::Isolate* m_isolate;
-};
-
-class CJS_Field : public CJS_Object
-{
-public:
- CJS_Field(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Field(void){};
-
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_JS_CLASS(CJS_Field);
-
- JS_STATIC_PROP(alignment, Field);
- JS_STATIC_PROP(borderStyle, Field);
- JS_STATIC_PROP(buttonAlignX, Field);
- JS_STATIC_PROP(buttonAlignY, Field);
- JS_STATIC_PROP(buttonFitBounds, Field);
- JS_STATIC_PROP(buttonPosition, Field);
- JS_STATIC_PROP(buttonScaleHow, Field);
- JS_STATIC_PROP(buttonScaleWhen, Field);
- JS_STATIC_PROP(calcOrderIndex, Field);
- JS_STATIC_PROP(charLimit, Field);
- JS_STATIC_PROP(comb, Field);
- JS_STATIC_PROP(commitOnSelChange, Field);
- JS_STATIC_PROP(currentValueIndices, Field);
- JS_STATIC_PROP(defaultStyle, Field);
- JS_STATIC_PROP(defaultValue, Field);
- JS_STATIC_PROP(doNotScroll, Field);
- JS_STATIC_PROP(doNotSpellCheck, Field);
- JS_STATIC_PROP(delay, Field);
- JS_STATIC_PROP(display, Field);
- JS_STATIC_PROP(doc, Field);
- JS_STATIC_PROP(editable, Field);
- JS_STATIC_PROP(exportValues, Field);
- JS_STATIC_PROP(fileSelect, Field);
- JS_STATIC_PROP(fillColor, Field);
- JS_STATIC_PROP(hidden, Field);
- JS_STATIC_PROP(highlight, Field);
- JS_STATIC_PROP(lineWidth, Field);
- JS_STATIC_PROP(multiline, Field);
- JS_STATIC_PROP(multipleSelection, Field);
- JS_STATIC_PROP(name, Field);
- JS_STATIC_PROP(numItems, Field);
- JS_STATIC_PROP(page, Field);
- JS_STATIC_PROP(password, Field);
- JS_STATIC_PROP(print, Field);
- JS_STATIC_PROP(radiosInUnison, Field);
- JS_STATIC_PROP(readonly, Field);
- JS_STATIC_PROP(rect, Field);
- JS_STATIC_PROP(required, Field);
- JS_STATIC_PROP(richText, Field);
- JS_STATIC_PROP(richValue, Field);
- JS_STATIC_PROP(rotation, Field);
- JS_STATIC_PROP(strokeColor, Field);
- JS_STATIC_PROP(style, Field);
- JS_STATIC_PROP(submitName, Field);
- JS_STATIC_PROP(textColor, Field);
- JS_STATIC_PROP(textFont, Field);
- JS_STATIC_PROP(textSize, Field);
- JS_STATIC_PROP(type, Field);
- JS_STATIC_PROP(userName, Field);
- JS_STATIC_PROP(value, Field);
- JS_STATIC_PROP(valueAsString, Field);
- JS_STATIC_PROP(source, Field);
-
- JS_STATIC_METHOD(browseForFileToSubmit, Field);
- JS_STATIC_METHOD(buttonGetCaption, Field);
- JS_STATIC_METHOD(buttonGetIcon, Field);
- JS_STATIC_METHOD(buttonImportIcon, Field);
- JS_STATIC_METHOD(buttonSetCaption, Field);
- JS_STATIC_METHOD(buttonSetIcon, Field);
- JS_STATIC_METHOD(checkThisBox, Field);
- JS_STATIC_METHOD(clearItems, Field);
- JS_STATIC_METHOD(defaultIsChecked, Field);
- JS_STATIC_METHOD(deleteItemAt, Field);
- JS_STATIC_METHOD(getArray, Field);
- JS_STATIC_METHOD(getItemAt, Field);
- JS_STATIC_METHOD(getLock, Field);
- JS_STATIC_METHOD(insertItemAt, Field);
- JS_STATIC_METHOD(isBoxChecked, Field);
- JS_STATIC_METHOD(isDefaultChecked, Field);
- JS_STATIC_METHOD(setAction, Field);
- JS_STATIC_METHOD(setFocus, Field);
- JS_STATIC_METHOD(setItems, Field);
- JS_STATIC_METHOD(setLock, Field);
- JS_STATIC_METHOD(signatureGetModifications, Field);
- JS_STATIC_METHOD(signatureGetSeedValue, Field);
- JS_STATIC_METHOD(signatureInfo, Field);
- JS_STATIC_METHOD(signatureSetSeedValue, Field);
- JS_STATIC_METHOD(signatureSign, Field);
- JS_STATIC_METHOD(signatureValidate, Field);
-};
-
-#endif //_FIELD_H_
-
diff --git a/src/main/jni/include/javascript/IJavaScript.h b/src/main/jni/include/javascript/IJavaScript.h
deleted file mode 100644
index 3087b6a8..00000000
--- a/src/main/jni/include/javascript/IJavaScript.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _IJAVASCRIPT_H_
-#define _IJAVASCRIPT_H_
-
-class IFXJS_Context
-{
-public:
- virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info) = 0;
- virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info) = 0;
-
-public:
- virtual void OnApp_Init() = 0;
-
- virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) = 0;
- virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;
-
- virtual void OnPage_Open(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_Close(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_InView(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_OutView(CPDFSDK_Document* pTarget) = 0;
-
- virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
- virtual void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
-
- virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
- virtual void OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit) = 0;
- virtual void OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc) = 0;
- virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
-
- virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
-
- virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
- virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;
-
- virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString &) = 0;
- virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0;
- virtual void OnConsole_Exec() = 0;
- virtual void OnExternal_Exec() = 0;
-
- virtual void EnableMessageBox(FX_BOOL bEnable) = 0;
-};
-
-class IFXJS_Runtime
-{
-public:
- virtual IFXJS_Context* NewContext() = 0;
- virtual void ReleaseContext(IFXJS_Context * pContext) = 0;
- virtual IFXJS_Context* GetCurrentContext() = 0;
-
- virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
- virtual CPDFSDK_Document* GetReaderDocument() = 0;
-
- virtual void GetObjectNames(CFX_WideStringArray& array) = 0;
- virtual void GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
- virtual void GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
- virtual void GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
-
- virtual void Exit() = 0;
- virtual void Enter() = 0;
- virtual FX_BOOL IsEntered() = 0;
-};
-
-class CPDFDoc_Environment;
-class CJS_GlobalData;
-
-class CJS_RuntimeFactory
-{
-public:
- CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}
- ~CJS_RuntimeFactory();
- IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
- void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
- void AddRef();
- void Release();
-
- CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp);
- void ReleaseGlobalData();
-private:
- FX_BOOL m_bInit;
- int m_nRef;
- CJS_GlobalData* m_pGlobalData;
- FX_INT32 m_nGlobalDataCount;
-};
-
-#endif //_IJAVASCRIPT_H_
-
diff --git a/src/main/jni/include/javascript/Icon.h b/src/main/jni/include/javascript/Icon.h
deleted file mode 100644
index 9426d322..00000000
--- a/src/main/jni/include/javascript/Icon.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _ICON_H_
-#define _ICON_H_
-
-class Icon : public CJS_EmbedObj
-{
-public:
- Icon(CJS_Object* pJSObject);
- virtual ~Icon();
-
-public:
- FX_BOOL name(OBJ_PROP_PARAMS);
-
-public:
- void SetStream(CPDF_Stream* pIconStream);
- CPDF_Stream* GetStream();
- void SetIconName(CFX_WideString name);
- CFX_WideString GetIconName();
-private:
- CPDF_Stream* m_pIconStream;
- CFX_WideString m_swIconName;
-};
-
-class CJS_Icon : public CJS_Object
-{
-public:
- CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};
- virtual ~CJS_Icon(){};
-
-public:
- DECLARE_JS_CLASS(CJS_Icon);
-
- JS_STATIC_PROP(name, Icon);
-};
-
-#endif //_ICON_H_
-
diff --git a/src/main/jni/include/javascript/JS_Console.h b/src/main/jni/include/javascript/JS_Console.h
deleted file mode 100644
index f4351356..00000000
--- a/src/main/jni/include/javascript/JS_Console.h
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_CONSOLE_H_
-#define _JS_CONSOLE_H_
-
-#include "../res/resource.h"
-
-#define WST_NONE 0x00 // No size changed
-#define WST_LEFT 0x01 // size to left
-#define WST_TOP 0x02 // size to top
-#define WST_RIGHT 0x04 // size to right
-#define WST_BOTTOM 0x08 // size to bottom
-#define WST_TOPLEFT (WST_TOP|WST_LEFT) // size to top & left
-#define WST_TOPRIGHT (WST_TOP|WST_RIGHT) // size to top & right
-#define WST_BOTTOMRIGHT (WST_BOTTOM|WST_RIGHT) // size to bottom & right
-#define WST_BOTTOMLEFT (WST_BOTTOM|WST_LEFT) // size to bottom & right
-
-#ifndef IDC_DLGSIZEBOX
-#define IDC_DLGSIZEBOX 50
-#endif /* IDC_DLGSIZEBOX */
-
-enum { m_idSizeIcon = IDC_DLGSIZEBOX };
-enum { // possible Control reSize Type
- CST_NONE = 0,
- CST_RESIZE, // NOMOVE + SIZE, add all delta-size of dlg to control
- CST_REPOS, // MOVE(absolutely) + NOSIZE, move control's pos by delta-size
- CST_RELATIVE, // MOVE(proportional) + NOSIZE, keep control always at a relative pos
- CST_ZOOM, // MOVE + SIZE (both are automatically proportional)
- CST_DELTA_ZOOM // MOVE(proportional, set manually) + SIZE(proportional, set manuall)
-};
-
-// contained class to hold item state
-//
-class CJS_ItemCtrl
-{
-public:
- UINT m_nID;
- UINT m_stxLeft : 4; // when left resizing ...
- UINT m_stxRight : 4; // when right resizing ...
- UINT m_styTop : 4; // when top resizing ...
- UINT m_styBottom : 4; // when bottom resizing ...
- UINT m_bFlickerFree : 1;
- UINT m_bInvalidate : 1; // Invalidate ctrl's rect(eg. no-automatical update for static when resize+move)
- UINT m_r0 : 14;
- CRect m_wRect;
- double m_xRatio, m_cxRatio;
- double m_yRatio, m_cyRatio;
-
-protected:
- void Assign(const CJS_ItemCtrl& src);
-
-public:
- CJS_ItemCtrl();
- CJS_ItemCtrl(const CJS_ItemCtrl& src);
-
- HDWP OnSize(HDWP hdwp, int sizeType, CRect *pnCltRect, CRect *poCltRect, CRect *pR0, CWnd *pDlg);
-
- CJS_ItemCtrl& operator=(const CJS_ItemCtrl& src);
-};
-
-class CJS_ResizeDlg : public CDialog
-{
-// DECLARE_DYNAMIC(CJS_ResizeDlg)
-public:
- CJS_ResizeDlg(UINT nID,CWnd *pParentWnd = NULL);
- virtual ~CJS_ResizeDlg();
-
-
-public:
- std::vector m_Items; // array of controlled items
- CRect m_cltRect, m_cltR0;
- int m_xMin, m_yMin;
- int m_xSt, m_ySt; //step?
- UINT m_nDelaySide; //drag side of window
- CStatic m_wndSizeIcon; // size icon window
-
-protected:
- void AddControl( UINT nID, int xl, int xr, int yt, int yb, int bFlickerFree = 0,
- double xRatio = -1.0, double cxRatio = -1.0,
- double yRatio = -1.0, double cyRatio = -1.0 );
- void AllowSizing(int xst, int yst);
- void HideSizeIcon(void);
- virtual BOOL OnInitDialog();
-
- void OnSizing(UINT nSide, LPRECT lpRect);
- void OnSize(UINT nType, int cx, int cy);
- void OnGetMinMaxInfo(MINMAXINFO *pmmi);
- BOOL OnEraseBkgnd(CDC* pDC);
-
-public:
- int UpdateControlRect(UINT nID, CRect *pnr);
-};
-
-
-//------------------------CIconListBox for CWndElementList-------------------------------------
-
-class CIconListBox : public CListBox
-{
-public:
- CIconListBox();
- virtual ~CIconListBox();
-
-public:
- int InsertString(int nIndex, LPCWSTR lpszItem , int nImage);
- virtual void ResetContent();
- virtual void GetText(int nIndex, CString& rString);
-
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
- void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
- int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
-
-protected:
- // Generated message map functions
- //{{AFX_MSG(CIconListBox)
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-
-protected:
- struct ItemDatas
- {
- CString csText;
- int nImage;
- };
-};
-//----------------------------------CWndElementList--------------------------------------------
-#define IDC_LIST_JS_ELEMENT 10070
-
-#define ELEMENT_LIST_WIDTH 140
-#define ELEMENT_LIST_HEIGHT 180
-#define ELEMENT_LIST_TOP_OFFSET 13
-
-#define ELEMENT_TYPE_NAME 0
-#define ELEMENT_TYPE_CONST 1
-#define ELEMENT_TYPE_FUN 2
-#define ELEMENT_TYPE_PRO 3
-
-class CWndElementList : public CWnd
-{
-public:
- CWndElementList();
- virtual ~CWndElementList();
-
-public:
- virtual void OnSize(UINT nType, int cx, int cy);
- virtual BOOL Create(CWnd* pParentWnd);
- virtual BOOL ShowWindow(int nCmdShow);
- void RemoveAllElement();
- void SetElementList(LPCWSTR* pElement, int* pType , int iCount);
- void AddElement(CFX_WideString csValue , int nType);
- BOOL GetElementSel(CString &csElement);
- BOOL SelectNext();
- BOOL SelectPrevious();
- BOOL SelectFirst();
- BOOL SelectLast();
- BOOL SelectNextPage();
- BOOL SelectPreviousPage();
- int GetListHeight();
-
-protected:
- // Generated message map functions
- //{{AFX_MSG(CWndElementList)
- afx_msg void OnPaint();
- afx_msg BOOL OnNcActivate(BOOL bActive);
- afx_msg void OnSelJSElement();
- afx_msg void OnDblclkJSElement();
- afx_msg void OnDestroy();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-protected:
- CIconListBox m_ListBox;
- BOOL m_bBlock;
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// CJS_ConsoleDlg ¶Ô»°¿ò
-class CJS_ConsoleDlg : public CJS_ResizeDlg
-{
- DECLARE_DYNAMIC(CJS_ConsoleDlg)
-
-public:
- CJS_ConsoleDlg(CReader_App* pApp, CWnd* pParent);
- virtual ~CJS_ConsoleDlg();
-
- enum { IDD = IDD_JS_CONSOLE };
-
- void Create();
-
- void AppendConsoleText(const CFX_WideString& swText);
- void SetConsoleText(const CFX_WideString& swText);
- CFX_WideString GetConsoleText() const;
- CFX_WideString GetScriptText() const;
-
- BOOL ResetElementList(LPCWSTR lpstrRef);
- IFXJS_Runtime* GetJSRuntime();
-
-protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö
-
-protected:
- virtual BOOL OnInitDialog();
- virtual void OnCancel();
-
- virtual BOOL PreTranslateMessage(MSG* pMsg);
-
-protected:
- // Generated message map functions
- //{{AFX_MSG(CJS_ConsoleDlg)
- afx_msg void OnBnClickedClear();
- afx_msg void OnBnClickedOk();
- afx_msg void OnBnClickTips();
- afx_msg void OnSizing(UINT nSide, LPRECT lpRect);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnGetMinMaxInfo(MINMAXINFO *pmmi);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
-
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnChangeScriptEdit(WPARAM wParam , LPARAM lParam);
- afx_msg void OnMove(int x , int y);
- public:
- virtual int DoModal();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-
-public:
- CGW_LineNumberEdit m_edtSC;
- BOOL m_bTips;
- const UINT m_uTextlimited;
- FX_HGLOBAL m_hGlobal;
- CReader_App * m_pApp;
- CWndElementList m_WndElementList;
-};
-
-#endif //_JS_CONSOLE_H_
\ No newline at end of file
diff --git a/src/main/jni/include/javascript/JS_Context.h b/src/main/jni/include/javascript/JS_Context.h
deleted file mode 100644
index 80680865..00000000
--- a/src/main/jni/include/javascript/JS_Context.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_CONTEXT_H_
-#define _JS_CONTEXT_H_
-
-class CJS_EventHandler;
-class CJS_Runtime;
-
-class CJS_Context : public IFXJS_Context
-{
-public:
- CJS_Context(CJS_Runtime* pRuntime);
- virtual ~CJS_Context();
-
-public:
- virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info);
- virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info);
-
-public:
- virtual void OnApp_Init();
-
- virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
- virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
- virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
- virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc);
- virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc);
- virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc);
-
- virtual void OnPage_Open(CPDFSDK_Document* pTarget);
- virtual void OnPage_Close(CPDFSDK_Document* pTarget);
- virtual void OnPage_InView(CPDFSDK_Document* pTarget);
- virtual void OnPage_OutView(CPDFSDK_Document* pTarget);
-
- virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
- virtual void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
-
- virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
- virtual void OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
- virtual void OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc);
- virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
-
- virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
-
- virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
- virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget);
-
- virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
- virtual void OnBatchExec(CPDFSDK_Document* pTarget);
- virtual void OnConsole_Exec();
- virtual void OnExternal_Exec();
-
- virtual void EnableMessageBox(FX_BOOL bEnable) {m_bMsgBoxEnable = bEnable;}
- FX_BOOL IsMsgBoxEnabled() const {return m_bMsgBoxEnable;}
-
-public:
- CPDFDoc_Environment* GetReaderApp();
- CJS_Runtime* GetJSRuntime(){return m_pRuntime;}
-
- FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);
-
- CJS_EventHandler* GetEventHandler(){return m_pEventHandler;};
- CPDFSDK_Document* GetReaderDocument();
-
-private:
- CJS_Runtime* m_pRuntime;
- CJS_EventHandler* m_pEventHandler;
-
- FX_BOOL m_bBusy;
- FX_BOOL m_bMsgBoxEnable;
-};
-
-// static CFX_WideString JSGetStringFromID(CJS_Context* pContext, UINT ID)
-// {
-// ASSERT(pContext != NULL);
-//
-// return JS_LoadString(pContext->GetReaderApp(), ID);
-// }
-
-#endif //_JS_CONTEXT_H_
-
diff --git a/src/main/jni/include/javascript/JS_Define.h b/src/main/jni/include/javascript/JS_Define.h
deleted file mode 100644
index cc203337..00000000
--- a/src/main/jni/include/javascript/JS_Define.h
+++ /dev/null
@@ -1,785 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_DEFINE_H_
-#define _JS_DEFINE_H_
-
-typedef v8::Value JSValue;
-typedef v8::Handle JSObject;
-typedef v8::Handle JSFXObject;
-typedef unsigned JSBool;
-
-struct JSConstSpec
-{
- const wchar_t* pName;
- double number;
- const wchar_t* string;
- FX_BYTE t; //0:double 1:str
-};
-
-struct JSPropertySpec
-{
- const wchar_t* pName;
- v8::AccessorGetterCallback pPropGet;
- v8::AccessorSetterCallback pPropPut;
-};
-
-struct JSMethodSpec
-{
- const wchar_t* pName;
- v8::FunctionCallback pMethodCall;
- unsigned nParamNum;
-};
-
-typedef CFX_WideString JS_ErrorString;
-
-#define JS_TRUE (unsigned)1
-#define JS_FALSE (unsigned)0
-
-
-#define CJS_PointsArray CFX_ArrayTemplate
-#define CJS_IntArray CFX_ArrayTemplate
-
-/* ====================================== PUBLIC DEFINE SPEC ============================================== */
-#ifndef __GNUC__
-#define JS_WIDESTRING(widestring) L#widestring
-#else
-#define JS_WIDESTRING(widestring) L""#widestring
-#endif
-
-#define OBJ_PROP_PARAMS IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError
-#define OBJ_METHOD_PARAMS IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError
-#define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {
-#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {JS_WIDESTRING(const_name), pValue, L"", 0},
-#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1},
-#define END_JS_STATIC_CONST() {0, 0, 0, 0}};
-
-#define BEGIN_JS_STATIC_PROP(js_class_name) JSPropertySpec js_class_name::JS_Class_Properties[] = {
-#define JS_STATIC_PROP_ENTRY(prop_name) {JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static},
-#define END_JS_STATIC_PROP() {0, 0, 0}};
-
-#define BEGIN_JS_STATIC_METHOD(js_class_name) JSMethodSpec js_class_name::JS_Class_Methods[] = {
-#define JS_STATIC_METHOD_ENTRY(method_name, nargs) {JS_WIDESTRING(method_name), method_name##_static, nargs},
-#define END_JS_STATIC_METHOD() {0, 0, 0}};
-#define MEMLEAKCHECK_1() ((void)0)
-#define MEMLEAKCHECK_2(main_name, sub_name) ((void)0)
-
-
-/*
-#ifdef _DEBUG
-#define MEMLEAKCHECK_1() \
- _CrtMemState state1;\
- _CrtMemCheckpoint(&state1);
-
-#define MEMLEAKCHECK_2(main_name,sub_name) \
- _CrtMemState state2;\
- _CrtMemCheckpoint(&state2);\
- _CrtMemState diff;\
- _CrtMemDifference(&diff,&state1,&state2);\
- if (diff.lSizes[_NORMAL_BLOCK] > 0)\
- {\
- TRACE("Detected normal block memory leaks in JS Module! [%s.%s]\n",#main_name,#sub_name);\
- _CrtMemDumpStatistics(&diff);\
- }
-#else
- #define MEMLEAKCHECK_1() ((void)0)
- #define MEMLEAKCHECK_2(main_name,sub_name) ((void)0)
-#endif
-*/
-
-/* ======================================== PROP CALLBACK ============================================ */
-
-#define JS_STATIC_PROP_GET(prop_name, class_name)\
- static void get_##prop_name##_static(JS_PROPGET_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- CJS_PropValue value(isolate);\
- value.StartGetting();\
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
- ASSERT(pJSObj != NULL);\
- class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->prop_name(cc, value, sError);\
- MEMLEAKCHECK_2(class_name, prop_name);\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #prop_name);\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
- return ;\
- }\
- if (bRet)\
- {\
- info.GetReturnValue().Set((v8::Handle)value);\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #prop_name);\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
- return ;\
- }\
-}
-
-#define JS_STATIC_PROP_SET(prop_name, class_name)\
- static void set_##prop_name##_static(JS_PROPPUT_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- CJS_PropValue propValue(CJS_Value(isolate,value,VT_unknown));\
- propValue.StartSetting();\
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
- ASSERT(pJSObj != NULL);\
- class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->prop_name(cc, propValue, sError);\
- MEMLEAKCHECK_2(class_name, prop_name);\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #prop_name);\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
- return ;\
- }\
- if (bRet)\
- {\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #prop_name);\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
- return ;\
- }\
-}
-
-#define JS_STATIC_PROP(prop_name, class_name)\
-JS_STATIC_PROP_GET(prop_name, class_name);\
-JS_STATIC_PROP_SET(prop_name, class_name)
-
-/* ========================================= METHOD CALLBACK =========================================== */
-
-#define JS_STATIC_METHOD(method_name, class_name)\
- static void method_name##_static(JS_METHOD_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- CJS_Parameters parameters;\
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\
- {\
- parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\
- }\
- CJS_Value valueRes(isolate);\
- CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate,info.Holder());\
- ASSERT(pJSObj != NULL);\
- class_name* pObj = (class_name*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->method_name(cc, parameters, valueRes, sError);\
- MEMLEAKCHECK_2(class_name, method_name);\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #method_name);\
- JS_Error(NULL, CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
- return ;\
- }\
- if (bRet)\
- {\
- info.GetReturnValue().Set(valueRes.ToJSValue());\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #method_name);\
- JS_Error(NULL, CFX_WideString::FromLocal(cbName), sError);\
- return ;\
- }\
-}
-
-/* ===================================== JS CLASS =============================================== */
-
-#define DECLARE_JS_CLASS(js_class_name) \
- static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
- static JSBool JSDestructor(JSFXObject obj);\
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
- static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
- static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
- static JSConstSpec JS_Class_Consts[];\
- static JSPropertySpec JS_Class_Properties[];\
- static JSMethodSpec JS_Class_Methods[];\
- static const wchar_t* m_pClassName
-
-#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global)\
-{\
- CJS_Object* pObj = FX_NEW js_class_name(obj);\
- pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
- JS_SetPrivate(NULL,obj,(void*)pObj); \
- pObj->InitInstance(cc);\
- return JS_TRUE;\
-}\
-\
-JSBool js_class_name::JSDestructor(JSFXObject obj) \
-{\
- js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
- ASSERT(pObj != NULL);\
- pObj->ExitInstance();\
- delete pObj;\
- return JS_TRUE;\
-}\
-\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\
- if (nObjDefnID >= 0)\
- {\
- for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j=0)\
- {\
- for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; iGetEmbedObject();\
- ASSERT(pObj != NULL);\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->QueryProperty((FX_LPCWSTR)propname);\
- MEMLEAKCHECK_2(class_name, (FX_LPCWSTR)prop_name);\
- }\
- catch (...)\
- {\
- return ;\
- }\
- if (bRet)\
- {\
- info.GetReturnValue().Set(0x004);\
- return ;\
- }\
- else\
- {\
- info.GetReturnValue().Set(0);\
- return ;\
- }\
- return ;\
-}\
- void js_class_name::getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- v8::String::Utf8Value utf8_value(property);\
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
- CJS_PropValue value(isolate);\
- value.StartGetting();\
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
- ASSERT(pJSObj != NULL);\
- class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, value, sError);\
- MEMLEAKCHECK_2(class_name, L"GetProperty");\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, L"GetProperty");\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
- return ;\
- }\
- if (bRet)\
- {\
- info.GetReturnValue().Set((v8::Handle)value);\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, L"GetProperty");\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
- return ;\
- }\
- JS_Error(NULL,L"GetProperty", L"Embeded object not found!");\
- return ;\
-}\
- void js_class_name::putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- v8::String::Utf8Value utf8_value(property);\
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
- CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));\
- PropValue.StartSetting();\
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
- if(!pJSObj) return;\
- class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, PropValue, sError);\
- MEMLEAKCHECK_2(class_name,L"PutProperty");\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, "PutProperty");\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
- return ;\
- }\
- if (bRet)\
- {\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, "PutProperty");\
- JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\
- return ;\
- }\
- JS_Error(NULL,L"PutProperty", L"Embeded object not found!");\
- return ;\
-}\
- void js_class_name::delprop_##js_class_name##_static(JS_PROPDEL_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- v8::String::Utf8Value utf8_value(property);\
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\
- ASSERT(pJSObj != NULL);\
- class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->DelProperty(cc, (FX_LPCWSTR)propname, sError);\
- MEMLEAKCHECK_2(class_name,L"DelProperty");\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, "DelProperty");\
- return ;\
- }\
- if (bRet)\
- {\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, "DelProperty");\
- return ;\
- }\
- return ;\
-}\
-JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global)\
-{\
- CJS_Object* pObj = FX_NEW js_class_name(obj);\
- pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
- JS_SetPrivate(NULL,obj, (void*)pObj); \
- pObj->InitInstance(cc);\
- return JS_TRUE;\
-}\
-\
-JSBool js_class_name::JSDestructor(JSFXObject obj) \
-{\
- js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
- ASSERT(pObj != NULL);\
- pObj->ExitInstance();\
- delete pObj;\
- return JS_TRUE;\
-}\
-\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
-\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\
-\
- if (nObjDefnID >= 0)\
- {\
- for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- CJS_Parameters parameters;\
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\
- {\
- parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\
- }\
- CJS_Value valueRes(isolate);\
- CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate, info.Holder());\
- ASSERT(pJSObj != NULL);\
- class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\
- ASSERT(pObj != NULL);\
- JS_ErrorString sError;\
- FX_BOOL bRet = FALSE;\
- try\
- {\
- MEMLEAKCHECK_1();\
- bRet = pObj->method_name(cc, parameters, valueRes, sError);\
- MEMLEAKCHECK_2(class_name, method_name);\
- }\
- catch (...)\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #method_name);\
- JS_Error(NULL, CFX_WideString::FromLocal(cbName), L"Unknown error is catched!");\
- return ;\
- }\
- if (bRet)\
- {\
- info.GetReturnValue().Set(valueRes.ToJSValue());\
- return ;\
- }\
- else\
- {\
- CFX_ByteString cbName;\
- cbName.Format("%s.%s", #class_name, #method_name);\
- JS_Error(NULL, CFX_WideString::FromLocal(cbName), sError);\
- return ;\
- }\
- JS_Error(NULL, JS_WIDESTRING(method_name), L"Embeded object not found!");\
- return ;\
-}
-
-/* ======================================== GLOBAL METHODS ============================================ */
-#define JS_STATIC_GLOBAL_FUN(fun_name) \
-static void fun_name##_static(JS_METHOD_ARGS)\
-{\
- v8::Isolate* isolate = info.GetIsolate();\
- v8::Local context = isolate->GetCurrentContext();\
- v8::Local v = context->GetEmbedderData(1);\
- ASSERT(!v.IsEmpty());\
- if(v.IsEmpty()) return;\
- v8::Handle field = v8::Handle::Cast(v);\
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\
- IFXJS_Context* cc = pRuntime->GetCurrentContext();\
- CJS_Parameters parameters;\
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\
- {\
- parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));\
- }\
- CJS_Value valueRes(isolate);\
- JS_ErrorString sError;\
- if (!fun_name(cc, parameters, valueRes, sError))\
- {\
- JS_Error(NULL, JS_WIDESTRING(fun_name), sError);\
- return ;\
- }\
- info.GetReturnValue().Set(valueRes.ToJSValue());\
- return ;\
-}
-
-#define JS_STATIC_DECLARE_GLOBAL_FUN() \
-static JSMethodSpec global_methods[]; \
-static int Init(IJS_Runtime* pRuntime)
-
-#define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \
-JSMethodSpec js_class_name::global_methods[] = {
-
-#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name,nargs) JS_STATIC_METHOD_ENTRY(method_name,nargs)
-
-#define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD()
-
-#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
-int js_class_name::Init(IJS_Runtime* pRuntime)\
-{\
- for (int i=0, sz=sizeof(js_class_name::global_methods)/sizeof(JSMethodSpec)-1; i p)
-{
-
- const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p));
-
- if (nHash == JSCONST_nUndefHash)
- return VT_undefined;
- else if (nHash == JSCONST_nNullHash)
- return VT_null;
- else if (nHash == JSCONST_nStringHash)
- return VT_string;
- else if (nHash == JSCONST_nNumberHash)
- return VT_number;
- else if (nHash == JSCONST_nBoolHash)
- return VT_boolean;
- else if (nHash == JSCONST_nDateHash)
- return VT_date;
- else if (nHash == JSCONST_nObjectHash)
- return VT_object;
- else if (nHash == JSCONST_nFXobjHash)
- return VT_fxobject;
-
- /*
- const char * sType = p->getTypeof()->toDchars();
- if (strcmp(sType,VALUE_NAME_STRING) == 0)
- return VT_string;
- else if (strcmp(sType,VALUE_NAME_NUMBER) == 0)
- return VT_number;
- else if (strcmp(sType,VALUE_NAME_BOOLEAN) == 0)
- return VT_boolean;
- else if (strcmp(sType,VALUE_NAME_DATE) == 0)
- return VT_date;
- else if (strcmp(sType,VALUE_NAME_OBJECT) == 0)
- return VT_object;
- else if (strcmp(sType,VALUE_NAME_FXOBJ) == 0)
- return VT_object;
- else if (strcmp(sType,VALUE_NAME_NULL) == 0)
- return VT_null;
- else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0)
- return VT_undefined;
- */
-
- return VT_unknown;
-}
-
-#endif //_JS_DEFINE_H_
diff --git a/src/main/jni/include/javascript/JS_EventHandler.h b/src/main/jni/include/javascript/JS_EventHandler.h
deleted file mode 100644
index d16933ae..00000000
--- a/src/main/jni/include/javascript/JS_EventHandler.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_EVENTHANDLER_H_
-#define _JS_EVENTHANDLER_H_
-
-class CJS_Context;
-class Field;
-
-enum JS_EVENT_T
-{
- JET_UNKNOWN,
- JET_APP_INIT,
- JET_DOC_OPEN,
- JET_DOC_WILLPRINT,
- JET_DOC_DIDPRINT,
- JET_DOC_WILLSAVE,
- JET_DOC_DIDSAVE,
- JET_DOC_WILLCLOSE,
- JET_PAGE_OPEN,
- JET_PAGE_CLOSE,
- JET_PAGE_INVIEW,
- JET_PAGE_OUTVIEW,
- JET_FIELD_MOUSEDOWN,
- JET_FIELD_MOUSEUP,
- JET_FIELD_MOUSEENTER,
- JET_FIELD_MOUSEEXIT,
- JET_FIELD_FOCUS,
- JET_FIELD_BLUR,
- JET_FIELD_KEYSTROKE,
- JET_FIELD_VALIDATE,
- JET_FIELD_CALCULATE,
- JET_FIELD_FORMAT,
- JET_SCREEN_FOCUS,
- JET_SCREEN_BLUR,
- JET_SCREEN_OPEN,
- JET_SCREEN_CLOSE,
- JET_SCREEN_MOUSEDOWN,
- JET_SCREEN_MOUSEUP,
- JET_SCREEN_MOUSEENTER,
- JET_SCREEN_MOUSEEXIT,
- JET_SCREEN_INVIEW,
- JET_SCREEN_OUTVIEW,
- JET_BATCH_EXEC,
- JET_MENU_EXEC,
- JET_CONSOLE_EXEC,
- JET_EXTERNAL_EXEC,
- JET_BOOKMARK_MOUSEUP,
- JET_LINK_MOUSEUP
-};
-
-class CJS_EventHandler
-{
-public:
- CJS_EventHandler(CJS_Context * pContext);
- virtual ~CJS_EventHandler();
-
- void OnApp_Init();
-
- void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
- void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
- void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
- void OnDoc_WillSave(CPDFSDK_Document* pDoc);
- void OnDoc_DidSave(CPDFSDK_Document* pDoc);
- void OnDoc_WillClose(CPDFSDK_Document* pDoc);
-
- void OnPage_Open(CPDFSDK_Document* pDoc);
- void OnPage_Close(CPDFSDK_Document* pDoc);
- void OnPage_InView(CPDFSDK_Document* pTarget);
- void OnPage_OutView(CPDFSDK_Document* pTarget);
-
- void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
- void OnField_Format(int nCommitKey, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
- void OnField_Keystroke(int nCommitKey, CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc);
- void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
-
- void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
- void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
-
- void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
-
- void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
- void OnLink_MouseUp(CPDFSDK_Document* pTarget);
-
- void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
- void OnBatchExec(CPDFSDK_Document *pTarget);
- void OnConsole_Exec();
- void OnExternal_Exec();
-
-public:
- void Initial(JS_EVENT_T type);
- void Destroy();
- FX_BOOL IsValid();
-
-
- CFX_WideString& Change();
- CFX_WideString ChangeEx();
- int CommitKey();
- FX_BOOL FieldFull();
- FX_BOOL KeyDown();
- FX_BOOL Modifier();
- FX_LPCWSTR Name();
- FX_LPCWSTR Type();
- FX_BOOL& Rc();
- int& SelEnd();
- int& SelStart();
- FX_BOOL Shift();
- Field* Source();
- Field* Target_Field();
- CFX_WideString& Value();
- FX_BOOL WillCommit();
- CFX_WideString TargetName();
-
- JS_EVENT_T EventType() {return m_eEventType;};
-
-public:
- CJS_Context* m_pJSContext;
- JS_EVENT_T m_eEventType;
- FX_BOOL m_bValid;
-
- CFX_WideString m_strTargetName;
- CFX_WideString m_strSourceName;
- CFX_WideString* m_pWideStrChange;
- CFX_WideString m_WideStrChangeDu;
- CFX_WideString m_WideStrChangeEx;
- int m_nCommitKey;
- FX_BOOL m_bKeyDown;
- FX_BOOL m_bModifier;
- FX_BOOL m_bShift;
- int* m_pISelEnd;
- int m_nSelEndDu;
- int* m_pISelStart;
- int m_nSelStartDu;
- FX_BOOL m_bWillCommit;
- CFX_WideString* m_pValue;
- FX_BOOL m_bFieldFull;
- FX_BOOL* m_pbRc;
- FX_BOOL m_bRcDu;
-
- CPDFSDK_Document* m_pSourceDoc;
- CPDF_Bookmark* m_pTargetBookMark;
- CPDFSDK_Document* m_pTargetDoc;
- CPDFSDK_Annot* m_pTargetAnnot;
-};
-
-#endif //_JS_EVENTHANDLER_H_
-
diff --git a/src/main/jni/include/javascript/JS_GlobalData.h b/src/main/jni/include/javascript/JS_GlobalData.h
deleted file mode 100644
index 1001ff63..00000000
--- a/src/main/jni/include/javascript/JS_GlobalData.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_GLOBALDATA_H_
-#define _JS_GLOBALDATA_H_
-
-#define JS_GLOBALDATA_TYPE_NUMBER 0
-#define JS_GLOBALDATA_TYPE_BOOLEAN 1
-#define JS_GLOBALDATA_TYPE_STRING 2
-#define JS_GLOBALDATA_TYPE_OBJECT 3
-#define JS_GLOBALDATA_TYPE_NULL 4
-
-class CJS_KeyValue;
-class CJS_GlobalVariableArray;
-class CJS_GlobalData_Element;
-
-class CJS_GlobalVariableArray
-{
-public:
- CJS_GlobalVariableArray();
- virtual ~CJS_GlobalVariableArray();
-
- void Add(CJS_KeyValue* p);
- int Count() const;
- CJS_KeyValue* GetAt(int index) const;
- void Copy(const CJS_GlobalVariableArray& array);
-
- void Empty();
-
-private:
- CFX_ArrayTemplate array;
-};
-
-class CJS_KeyValue
-{
-public:
- CJS_KeyValue(){}
- virtual ~CJS_KeyValue(){}
-
- CFX_ByteString sKey;
- int nType; //0:int 1:bool 2:string 3:obj
- double dData;
- bool bData;
- CFX_ByteString sData;
- CJS_GlobalVariableArray objData;
-};
-
-class CJS_GlobalData_Element
-{
-public:
- CJS_GlobalData_Element(){}
- virtual ~CJS_GlobalData_Element(){}
-
- CJS_KeyValue data;
- FX_BOOL bPersistent;
-};
-
-class CJS_GlobalData
-{
-public:
- CJS_GlobalData(CPDFDoc_Environment* pApp);
- virtual ~CJS_GlobalData();
-
-public:
- void SetGlobalVariableNumber(FX_LPCSTR propname, double dData);
- void SetGlobalVariableBoolean(FX_LPCSTR propname, bool bData);
- void SetGlobalVariableString(FX_LPCSTR propname, const CFX_ByteString& sData);
- void SetGlobalVariableObject(FX_LPCSTR propname, const CJS_GlobalVariableArray& array);
- void SetGlobalVariableNull(FX_LPCSTR propname);
-
- FX_BOOL SetGlobalVariablePersistent(FX_LPCSTR propname, FX_BOOL bPersistent);
- FX_BOOL DeleteGlobalVariable(FX_LPCSTR propname);
-
- FX_INT32 GetSize() const;
- CJS_GlobalData_Element* GetAt(int index) const;
-
-private:
- void LoadGlobalPersistentVariables();
- void SaveGlobalPersisitentVariables();
-
- CJS_GlobalData_Element* GetGlobalVariable(FX_LPCSTR propname);
- int FindGlobalVariable(FX_LPCSTR propname);
-
- void LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength);
- void WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength);
- void MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData);
-
-private:
- CFX_ArrayTemplate m_arrayGlobalData;
- CFX_WideString m_sFilePath;
- CPDFDoc_Environment* m_pApp;
-};
-
-#endif //_JS_GLOBALDATA_H_
diff --git a/src/main/jni/include/javascript/JS_Module.h b/src/main/jni/include/javascript/JS_Module.h
deleted file mode 100644
index 1fcb583a..00000000
--- a/src/main/jni/include/javascript/JS_Module.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_MODULE_H_
-#define _JS_MODULE_H_
-
-class CJS_GlobalData;
-class CJS_ConsoleDlg;
-
-class CJS_Module : public IReader_Module
-{
-public:
- CJS_Module(HMODULE hModule, CReader_App* pApp);
- virtual ~CJS_Module();
-
- virtual void Destroy(){delete this;}
- virtual CFX_ByteString GetModuleName();
-
-public:
- static CJS_Module* GetModule(CReader_App* pApp);
-
- IFXJS_Runtime* NewJSRuntime();
- CJS_GlobalData* NewGlobalData();
- void ReleaseGlobalData();
-
-public:
- //console
- void ShowConsole();
- void HideConsole();
- void ClearConsole();
- void PrintLineConsole(FX_LPCWSTR string);
-
-private:
- HMODULE m_hModule;
- CReader_App* m_pApp;
-
- FX_BOOL m_bInitial;
- CJS_GlobalData* m_pGlobalData;
- FX_INT32 m_nGlobalDataCount;
-
- CJS_ConsoleDlg* m_pConsole;
-};
-
-#endif //_JS_MODULE_H_
\ No newline at end of file
diff --git a/src/main/jni/include/javascript/JS_Object.h b/src/main/jni/include/javascript/JS_Object.h
deleted file mode 100644
index f22da761..00000000
--- a/src/main/jni/include/javascript/JS_Object.h
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_OBJECT_H_
-#define _JS_OBJECT_H_
-
-class CJS_Object;
-class CJS_Timer;
-class CJS_Context;
-
-class CJS_EmbedObj : public CFX_Object
-{
-public:
- CJS_EmbedObj(CJS_Object* pJSObject);
- virtual ~CJS_EmbedObj();
-
- virtual void TimerProc(CJS_Timer* pTimer){};
-
- CJS_Timer* BeginTimer(CPDFDoc_Environment * pApp, FX_UINT nElapse);
- void EndTimer(CJS_Timer* pTimer);
-
- CJS_Object* GetJSObject(){return m_pJSObject;};
- operator CJS_Object* (){return m_pJSObject;};
-
- CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc);
- int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0);
- void Alert(CJS_Context* pContext, FX_LPCWSTR swMsg);
- FX_BOOL IsSafeMode(IFXJS_Context* cc);
-
-protected:
-
- CJS_Object* m_pJSObject;
-};
-
-class CJS_Object : public CFX_Object
-{
-public:
- CJS_Object(JSFXObject pObject);
- virtual ~CJS_Object(void);
-
- void MakeWeak();
-
- virtual FX_BOOL IsType(FX_LPCSTR sClassName){return TRUE;};
- virtual CFX_ByteString GetClassName(){return "";};
-
- virtual FX_BOOL InitInstance(IFXJS_Context* cc){return TRUE;};
- virtual FX_BOOL ExitInstance(){return TRUE;};
-
- operator JSFXObject () {return v8::Local::New(m_pIsolate, m_pObject);}
- operator CJS_EmbedObj* (){return m_pEmbedObj;};
-
- void SetEmbedObject(CJS_EmbedObj* pObj){m_pEmbedObj = pObj;};
- CJS_EmbedObj * GetEmbedObject(){return m_pEmbedObj;};
-
- static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc);
- static int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0,FX_UINT nIcon = 0);
- static void Alert(CJS_Context* pContext, FX_LPCWSTR swMsg);
-
- v8::Isolate* GetIsolate() {return m_pIsolate;}
-protected:
- CJS_EmbedObj * m_pEmbedObj;
- v8::Persistent m_pObject;
- v8::Isolate* m_pIsolate;
-};
-
-struct JS_TIMER_MAP
-{
- FX_UINT nID;
- CJS_Timer * pTimer;
-};
-
-typedef CFX_ArrayTemplate CTimerMapArray;
-
-struct JS_TIMER_MAPARRAY
-{
-public:
- JS_TIMER_MAPARRAY()
- {
- }
-
- ~JS_TIMER_MAPARRAY()
- {
- Reset();
- }
-
- void Reset()
- {
- for (int i=0,sz=m_Array.GetSize(); i=0)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- pMap->pTimer = pTimer;
- }
- else
- {
- if (JS_TIMER_MAP * pMap = new JS_TIMER_MAP)
- {
- pMap->nID = nIndex;
- pMap->pTimer = pTimer;
- m_Array.Add(pMap);
- }
- }
- }
-
- CJS_Timer * GetAt(FX_UINT nIndex)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- return pMap->pTimer;
- }
- return NULL;
- }
-
- void RemoveAt(FX_UINT nIndex)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- delete m_Array.GetAt(i);
- m_Array.RemoveAt(i);
- }
- //To prevent potential fake memory leak reported by vc6.
- if(m_Array.GetSize() == 0)
- m_Array.RemoveAll();
- }
-
- int Find(FX_UINT nIndex)
- {
- for (int i=0,sz=m_Array.GetSize(); inID == nIndex)
- return i;
- }
- }
-
- return -1;
- }
-
- CTimerMapArray m_Array;
-};
-
-static JS_TIMER_MAPARRAY m_sTimeMap;
-
-class CJS_Runtime;
-
-class CJS_Timer
-{
-public:
- CJS_Timer(CJS_EmbedObj * pObj,CPDFDoc_Environment* pApp): m_pEmbedObj(pObj),
- m_nTimerID(0),
- m_bProcessing(FALSE),
- m_dwStartTime(0),
- m_dwTimeOut(0),
- m_dwElapse(0),
- m_pRuntime(NULL),
- m_nType(0),
- m_pApp(pApp)
- {
- }
-
- virtual ~CJS_Timer()
- {
- KillJSTimer();
- }
-
-public:
- FX_UINT SetJSTimer(FX_UINT nElapse)
- {
- if (m_nTimerID)KillJSTimer();
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- m_nTimerID = pHandler->SetTimer(nElapse,TimerProc);
- m_sTimeMap.SetAt(m_nTimerID,this);
- m_dwElapse = nElapse;
- return m_nTimerID;
- };
-
- void KillJSTimer()
- {
- if (m_nTimerID)
- {
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- pHandler->KillTimer(m_nTimerID);
- m_sTimeMap.RemoveAt(m_nTimerID);
- m_nTimerID = 0;
- }
- };
-
- void SetType(int nType)
- {
- m_nType = nType;
- }
-
- int GetType() const
- {
- return m_nType;
- }
-
- void SetStartTime(FX_DWORD dwStartTime)
- {
- m_dwStartTime = dwStartTime;
- }
-
- FX_DWORD GetStartTime() const
- {
- return m_dwStartTime;
- }
-
- void SetTimeOut(FX_DWORD dwTimeOut)
- {
- m_dwTimeOut = dwTimeOut;
- }
-
- FX_DWORD GetTimeOut() const
- {
- return m_dwTimeOut;
- }
-
- void SetRuntime(CJS_Runtime* pRuntime)
- {
- m_pRuntime = pRuntime;
- }
-
- CJS_Runtime* GetRuntime() const
- {
- return m_pRuntime;
- }
-
- void SetJScript(const CFX_WideString& script)
- {
- m_swJScript = script;
- }
-
- CFX_WideString GetJScript() const
- {
- return m_swJScript;
- }
-
- static void TimerProc(int idEvent)
- {
- if (CJS_Timer * pTimer = m_sTimeMap.GetAt(idEvent))
- {
- if (!pTimer->m_bProcessing)
- {
- pTimer->m_bProcessing = TRUE;
- if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->TimerProc(pTimer);
- pTimer->m_bProcessing = FALSE;
- }
- else
- {
- // TRACE(L"BUSY!\n");
- }
- }
- };
-
-private:
- FX_UINT m_nTimerID;
- CJS_EmbedObj* m_pEmbedObj;
- FX_BOOL m_bProcessing;
-
- //data
- FX_DWORD m_dwStartTime;
- FX_DWORD m_dwTimeOut;
- FX_DWORD m_dwElapse;
- CJS_Runtime* m_pRuntime;
- CFX_WideString m_swJScript;
- int m_nType; //0:Interval; 1:TimeOut
-
- CPDFDoc_Environment* m_pApp;
-};
-#endif //_JS_OBJECT_H_
diff --git a/src/main/jni/include/javascript/JS_Runtime.h b/src/main/jni/include/javascript/JS_Runtime.h
deleted file mode 100644
index 0a195f13..00000000
--- a/src/main/jni/include/javascript/JS_Runtime.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_RUNTIME_H_
-#define _JS_RUNTIME_H_
-
-class CJS_FieldEvent
-{
-public:
- CFX_WideString sTargetName;
- JS_EVENT_T eEventType;
- CJS_FieldEvent* pNext;
-};
-
-class CJS_Runtime : public IFXJS_Runtime
-{
-public:
- CJS_Runtime(CPDFDoc_Environment * pApp);
- virtual ~CJS_Runtime();
-
- virtual IFXJS_Context * NewContext();
- virtual void ReleaseContext(IFXJS_Context * pContext);
- virtual IFXJS_Context* GetCurrentContext();
-
- virtual void SetReaderDocument(CPDFSDK_Document *pReaderDoc);
- virtual CPDFSDK_Document * GetReaderDocument(){return m_pDocument;}
-
- virtual void GetObjectNames(CFX_WideStringArray& array);
- virtual void GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array);
- virtual void GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array);
- virtual void GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array);
-
- virtual void Exit();
- virtual void Enter();
- virtual FX_BOOL IsEntered();
-
- CPDFDoc_Environment * GetReaderApp(){return m_pApp;}
-
- FX_BOOL InitJSObjects();
-
- FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
- void RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
- void RemoveEventsInLoop(CJS_FieldEvent* pStart);
-
- void BeginBlock(){m_bBlocking = TRUE;}
- void EndBlock(){m_bBlocking = FALSE;}
- FX_BOOL IsBlocking(){return m_bBlocking;}
-
- operator IJS_Runtime*() {return (IJS_Runtime*)m_isolate;}
- v8::Isolate* GetIsolate(){return m_isolate;};
- void SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}
-
- v8::Handle NewJSContext();
-protected:
- CFX_ArrayTemplate m_ContextArray;
- CPDFDoc_Environment * m_pApp;
- CPDFSDK_Document * m_pDocument;
- FX_BOOL m_bBlocking;
- CJS_FieldEvent* m_pFieldEventPath;
-
- v8::Isolate* m_isolate;
- v8::Persistent m_context;
- FX_BOOL m_bRegistered;
-};
-
-#endif //_JS_RUNTIME_H_
-
diff --git a/src/main/jni/include/javascript/JS_Value.h b/src/main/jni/include/javascript/JS_Value.h
deleted file mode 100644
index 030cdd5c..00000000
--- a/src/main/jni/include/javascript/JS_Value.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JS_VALUE_H_
-#define _JS_VALUE_H_
-
-class CJS_Array;
-class CJS_Date;
-
-class CJS_Value
-{
-public:
- CJS_Value(v8::Isolate* isolate);
- CJS_Value(v8::Isolate* isolate, v8::Handle pValue,FXJSVALUETYPE t);
- CJS_Value(v8::Isolate* isolate, const int &iValue);
- CJS_Value(v8::Isolate* isolate, const double &dValue);
- CJS_Value(v8::Isolate* isolate, const float &fValue);
- CJS_Value(v8::Isolate* isolate, const bool &bValue);
- CJS_Value(v8::Isolate* isolate, JSFXObject);
- CJS_Value(v8::Isolate* isolate, CJS_Object *);
- CJS_Value(v8::Isolate* isolate, FX_LPCSTR pStr);
- CJS_Value(v8::Isolate* isolate, FX_LPCWSTR pWstr);
- CJS_Value(v8::Isolate* isolate, CJS_Array& array);
-
- ~CJS_Value();
-
- void SetNull();
- void Attach(v8::Handle pValue,FXJSVALUETYPE t);
- void Attach(CJS_Value *pValue);
- void Detach();
-
-
- operator int() const;
- operator bool() const;
- operator double() const;
- operator float() const;
- operator CJS_Object *() const;
- //operator JSFXObject *() const;
- operator v8::Handle() const;
- operator v8::Handle() const;
- operator CFX_WideString() const;
- //operator FX_WCHAR *() const;
- operator CFX_ByteString() const;
- v8::Handle ToJSValue();
-
- void operator = (int iValue);
- void operator = (bool bValue);
- void operator = (double);
- void operator = (float);
- void operator = (CJS_Object *);
- void operator = (v8::Handle);
-// void operator = (JSObject *);
- void operator = (CJS_Array &);
- void operator = (CJS_Date &);
- void operator = (FX_LPCWSTR pWstr);
- void operator = (FX_LPCSTR pStr);
- void operator = (CJS_Value value);
-
- FX_BOOL IsArrayObject() const;
- FX_BOOL IsDateObject() const;
- FXJSVALUETYPE GetType() const;
-
- FX_BOOL ConvertToArray(CJS_Array &) const;
- FX_BOOL ConvertToDate(CJS_Date &) const;
-
- v8::Isolate* GetIsolate() {return m_isolate;}
-protected:
- v8::Handle m_pValue;
- FXJSVALUETYPE m_eType;
- v8::Isolate* m_isolate;
-};
-
-template class CJS_ParametersTmpl : public CFX_ArrayTemplate
-{
-public:
- void push_back(TYPE newElement){CFX_ArrayTemplate::Add(newElement);}
- int size() const{return CFX_ArrayTemplate::GetSize();}
-};
-typedef CJS_ParametersTmpl CJS_Parameters;
-
-class CJS_PropValue: public CJS_Value
-{
-public:
- CJS_PropValue(const CJS_Value &);
- CJS_PropValue(v8::Isolate* isolate);
- ~CJS_PropValue();
-public:
- FX_BOOL IsSetting();
- FX_BOOL IsGetting();
- void operator<<(int );
- void operator>>(int &) const;
- void operator<<(bool);
- void operator>>(bool &) const;
- void operator<<(double );
- void operator>>(double &) const;
- void operator<<(CJS_Object *pObj);
- void operator>>(CJS_Object *&ppObj) const;
- void operator<<(CFX_ByteString);
- void operator>>(CFX_ByteString &) const;
- void operator<<(CFX_WideString);
- void operator>>(CFX_WideString &) const;
- void operator<<(FX_LPCWSTR c_string);
-
- void operator<<(JSFXObject);
- void operator>>(JSFXObject &) const;
-
- void operator>>(CJS_Array &array) const;
- void operator<<(CJS_Array &array);
-
- void operator<<(CJS_Date &date);
- void operator>>(CJS_Date &date) const;
-
- operator v8::Handle() const;
-
- void StartSetting();
- void StartGetting();
-private:
- FX_BOOL m_bIsSetting;
-};
-
-class CJS_Array
-{
-public:
- CJS_Array(v8::Isolate* isolate);
- virtual ~CJS_Array();
-
- void Attach(v8::Handle pArray);
- void GetElement(unsigned index,CJS_Value &value);
- void SetElement(unsigned index,CJS_Value value);
- int GetLength();
- FX_BOOL IsAttached();
- operator v8::Handle();
-
- v8::Isolate* GetIsolate() {return m_isolate;}
-private:
- v8::Handle m_pArray;
- v8::Isolate* m_isolate;
-};
-
-class CJS_Date
-{
-friend class CJS_Value;
-public:
- CJS_Date(v8::Isolate* isolate);
- CJS_Date(v8::Isolate* isolate,double dMsec_time);
- CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec);
- virtual ~CJS_Date();
- void Attach(v8::Handle pDate);
-
- int GetYear();
- void SetYear(int iYear);
-
- int GetMonth();
- void SetMonth(int iMonth);
-
- int GetDay();
- void SetDay(int iDay);
-
- int GetHours();
- void SetHours(int iHours);
-
- int GetMinutes();
- void SetMinutes(int minutes);
-
- int GetSeconds();
- void SetSeconds(int seconds);
-
- operator v8::Handle();
- operator double() const;
-
- CFX_WideString ToString() const;
-
- static double MakeDate(int year, int mon, int mday,int hour, int min, int sec,int ms);
-
- FX_BOOL IsValidDate();
-
-protected:
- v8::Handle m_pDate;
- v8::Isolate* m_isolate;
-};
-
-#endif //_JS_VALUE_H_
-
diff --git a/src/main/jni/include/javascript/JavaScript.h b/src/main/jni/include/javascript/JavaScript.h
deleted file mode 100644
index 166472b6..00000000
--- a/src/main/jni/include/javascript/JavaScript.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _JAVASCRIPT_H_
-#define _JAVASCRIPT_H_
-
-
-#ifndef _INC_PDFAPI
- #define _INC_PDFAPI
-
- #include "../../../core/include/fpdfapi/fpdf_module.h"
- #include "../../../core/include/fpdfdoc/fpdf_doc.h"
- #include "../../../core/include/fpdfdoc/fpdf_vt.h"
- #include "../../../core/include/fxcrt/fx_xml.h"
- #include "../../../core/include/fdrm/fx_crypt.h"
- #include "../../../core/include/fpdfapi/fpdf_pageobj.h"
- #include "../../../core/include/fpdfapi/fpdf_serial.h"
-
-
- #include "../../include/fx_systemhandler.h"
-#endif
-
-
-#include "../jsapi/fxjs_v8.h"
-#include "../fxedit/fx_edit.h"
-#include "../pdfwindow/IPDFWindow.h"
-#include "../fsdk_mgr.h"
-
-
-#include
-//#pragma warning( disable : 4786)
-#include
-
-
-#endif //_JAVASCRIPT_H_
-
diff --git a/src/main/jni/include/javascript/PublicMethods.h b/src/main/jni/include/javascript/PublicMethods.h
deleted file mode 100644
index 8d4e6839..00000000
--- a/src/main/jni/include/javascript/PublicMethods.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PUBLICMETHODS_H_
-#define _PUBLICMETHODS_H_
-
-class CJS_PublicMethods : public CJS_Object
-{
-public:
- CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_PublicMethods(void){};
-
-public:
- static FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);
- static FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);
- static FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);
- static FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);
- static FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);
- static FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);
- static FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);
- static FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);
- static FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //
- static FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);
- static FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);
- static FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);
- static FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);
- static FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);
- static FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS);//
- static FX_BOOL AFSimple(OBJ_METHOD_PARAMS);
- static FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);
- static FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);
- static FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);
- static FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS);
- static FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);
- static FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);
-
-public:
- JS_STATIC_GLOBAL_FUN(AFNumber_Format);
- JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFPercent_Format);
- JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
- JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFDate_Format);
- JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
- JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFTime_Format);
- JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
- JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFSimple);
- JS_STATIC_GLOBAL_FUN(AFMakeNumber);
- JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
- JS_STATIC_GLOBAL_FUN(AFRange_Validate);
- JS_STATIC_GLOBAL_FUN(AFMergeChange);
- JS_STATIC_GLOBAL_FUN(AFParseDateEx);
- JS_STATIC_GLOBAL_FUN(AFExtractNums);
-
- JS_STATIC_DECLARE_GLOBAL_FUN();
-
-public:
- static int ParseStringInteger(const CFX_WideString & string,int nStart,int & nSkip, int nMaxStep);
- static CFX_WideString ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
- static double MakeRegularDate(const CFX_WideString & value,const CFX_WideString & format, FX_BOOL& bWrongFormat);
- static CFX_WideString MakeFormatDate(double dDate,const CFX_WideString & format);
- static FX_BOOL ConvertStringToNumber(FX_LPCWSTR swSource, double & dRet, FX_BOOL & bDot);
- static double ParseStringToNumber(FX_LPCWSTR swSource);
- static double ParseNormalDate(const CFX_WideString & value, FX_BOOL& bWrongFormat);
- static double MakeInterDate(CFX_WideString strValue);
- static double ParseNumber(FX_LPCWSTR swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);
-
-public:
- static CFX_WideString StrLTrim(FX_LPCWSTR pStr);
- static CFX_WideString StrRTrim(FX_LPCWSTR pStr);
- static CFX_WideString StrTrim(FX_LPCWSTR pStr);
-
- static CFX_ByteString StrLTrim(FX_LPCSTR pStr);
- static CFX_ByteString StrRTrim(FX_LPCSTR pStr);
- static CFX_ByteString StrTrim(FX_LPCSTR pStr);
-
- static FX_BOOL IsNumber(FX_LPCSTR string);
- static FX_BOOL IsNumber(FX_LPCWSTR string);
-
- static FX_BOOL IsDigit(char ch);
- static FX_BOOL IsDigit(wchar_t ch);
- static FX_BOOL IsAlphabetic(wchar_t ch);
- static FX_BOOL IsAlphaNumeric(wchar_t ch);
-
- static FX_BOOL maskSatisfied(wchar_t c_Change,wchar_t c_Mask);
- static FX_BOOL isReservedMaskChar(wchar_t ch);
-
- static double AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);
- static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
-};
-
-#endif //_PUBLICMETHODS_H_
diff --git a/src/main/jni/include/javascript/app.h b/src/main/jni/include/javascript/app.h
deleted file mode 100644
index 6273a7d4..00000000
--- a/src/main/jni/include/javascript/app.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _APP_H_
-#define _APP_H_
-
-class CJS_Runtime;
-
-/* ---------------------------- TimerObj ---------------------------- */
-
-class CJS_Timer;
-
-class TimerObj : public CJS_EmbedObj
-{
-public:
- TimerObj(CJS_Object* pJSObject);
- virtual ~TimerObj();
-
-public:
- void SetTimer(CJS_Timer* pTimer);
- CJS_Timer* GetTimer() const;
-
-private:
- CJS_Timer* m_pTimer;
-};
-
-class CJS_TimerObj : public CJS_Object
-{
-public:
- CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}
- virtual ~CJS_TimerObj(){}
-
- DECLARE_JS_CLASS(CJS_TimerObj);
-};
-
-
-// struct APP_MENUITEM_ARRAY;
-//
-// struct APP_MENUITEM
-// {
-// APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""), bMarked(false), bEnabled(true)
-// {
-// }
-// CFX_WideString cName;
-// CFX_WideString cReturn;
-// APP_MENUITEM_ARRAY* oSubMenu;
-// bool bMarked;
-// bool bEnabled;
-// };
-
-// struct APP_MENUITEM_ARRAY
-// {
-// APP_MENUITEM_ARRAY() : m_hMenu(NULL), pContents(NULL), nSize(0)
-// {
-//
-// }
-// APP_MENUITEM * pContents;
-// HMENU m_hMenu;
-// int nSize;
-// };
-
-// struct APP_MENU;
-// struct APP_MENU_ARRAY
-// {
-// APP_MENU_ARRAY():
-// pContent(NULL)
-// {
-// }
-//
-// APP_MENU* pContent;
-// };
-
-// struct APP_MENU
-// {
-// APP_MENU():bSubMenu(false),
-// SubMenuItems(NULL),
-// cwMenuItemName(L""),
-// hMenu(NULL),
-// iSize(0)
-// {
-//
-// }
-//
-// APP_MENU(CFX_WideString &cwName):
-// cwMenuItemName(cwName),
-// bSubMenu(false),
-// SubMenuItems(NULL),
-// hMenu(NULL),
-// iSize(0)
-// {
-//
-// }
-//
-// CFX_WideString cwMenuItemName;
-// bool bSubMenu;
-// APP_MENU_ARRAY* SubMenuItems;
-// int iSize;
-// HMENU hMenu;
-// };
-
-class app : public CJS_EmbedObj
-{
-public:
- app(CJS_Object * pJSObject);
- virtual ~app();
-
-public:
- FX_BOOL activeDocs(OBJ_PROP_PARAMS);
- FX_BOOL calculate(OBJ_PROP_PARAMS);
- FX_BOOL formsVersion(OBJ_PROP_PARAMS);
- FX_BOOL fs(OBJ_PROP_PARAMS);
- FX_BOOL fullscreen(OBJ_PROP_PARAMS);
- FX_BOOL language(OBJ_PROP_PARAMS);
- FX_BOOL media(OBJ_PROP_PARAMS);
- FX_BOOL platform(OBJ_PROP_PARAMS);
- FX_BOOL runtimeHighlight(OBJ_PROP_PARAMS);
- FX_BOOL viewerType(OBJ_PROP_PARAMS);
- FX_BOOL viewerVariation(OBJ_PROP_PARAMS);
- FX_BOOL viewerVersion(OBJ_PROP_PARAMS);
-
-
- FX_BOOL alert(OBJ_METHOD_PARAMS);
- FX_BOOL beep(OBJ_METHOD_PARAMS);
- FX_BOOL browseForDoc(OBJ_METHOD_PARAMS);
- FX_BOOL clearInterval(OBJ_METHOD_PARAMS);
- FX_BOOL clearTimeOut(OBJ_METHOD_PARAMS);
- FX_BOOL execDialog(OBJ_METHOD_PARAMS);
- FX_BOOL execMenuItem(OBJ_METHOD_PARAMS);
- FX_BOOL findComponent(OBJ_METHOD_PARAMS);
- FX_BOOL goBack(OBJ_METHOD_PARAMS);
- FX_BOOL goForward(OBJ_METHOD_PARAMS);
- FX_BOOL launchURL(OBJ_METHOD_PARAMS);
- FX_BOOL mailMsg(OBJ_METHOD_PARAMS);
- FX_BOOL newFDF(OBJ_METHOD_PARAMS);
- FX_BOOL newDoc(OBJ_METHOD_PARAMS);
- FX_BOOL openDoc(OBJ_METHOD_PARAMS);
- FX_BOOL openFDF(OBJ_METHOD_PARAMS);
- FX_BOOL popUpMenuEx(OBJ_METHOD_PARAMS);
- FX_BOOL popUpMenu(OBJ_METHOD_PARAMS);
- FX_BOOL response(OBJ_METHOD_PARAMS);
- FX_BOOL setInterval(OBJ_METHOD_PARAMS);
- FX_BOOL setTimeOut(OBJ_METHOD_PARAMS);
-
-private:
-// FX_DWORD AppGetTickCount();
- void TimerProc(CJS_Timer* pTimer);
- void RunJsScript(CJS_Runtime * pRuntime,const CFX_WideString & wsScript);
-// void ParsePopupMenuObj(APP_MENUITEM * ppMenuItem,JSObject * pObj);
-// void DeleteMenuItems(APP_MENUITEM_ARRAY * pMenuItems);
-// void AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU hMenu, MENUITEMINFO MenuItemInfo);
-// void InitMenuItemInfo(MENUITEMINFO& MenuItemInfo);
-// void DestroyPopUpMenu();
-
-// void ParserMenuItem(APP_MENU* pHead, const CJS_Parameters¶ms);
-// void AddItemToMenu(APP_MENU* pHead, HMENU hMenu, MENUITEMINFO MenuItemInfo);
-// void DestroyMenuItems(APP_MENU* pHead);
-
-public:
- static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
- static CFX_WideString PDFPathToSysPath(const CFX_WideString& sOldPath);
- static CFX_WideString RelativePathToSysPath(const CFX_WideString& sOldPath, const CFX_WideString& sFilePath);
-
-
-private:
-
- bool m_bCalculate;
- CJS_Runtime* m_pRuntime;
- bool m_bRuntimeHighLight;
-
- CFX_ArrayTemplate m_aTimer;
-// APP_MENU* m_pMenuHead;
-
-public:
-// static CReader_App* s_App;
-};
-
-class CJS_App : public CJS_Object
-{
-public:
- CJS_App(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_App(void){};
-
- DECLARE_JS_CLASS(CJS_App);
-
- JS_STATIC_PROP(activeDocs, app);
- JS_STATIC_PROP(calculate, app);
- JS_STATIC_PROP(formsVersion, app);
- JS_STATIC_PROP(fs, app);
- JS_STATIC_PROP(fullscreen, app);
- JS_STATIC_PROP(language, app);
- JS_STATIC_PROP(media, app);
- JS_STATIC_PROP(platform, app);
- JS_STATIC_PROP(runtimeHighlight, app);
- JS_STATIC_PROP(viewerType, app);
- JS_STATIC_PROP(viewerVariation, app);
- JS_STATIC_PROP(viewerVersion, app);
-
- JS_STATIC_METHOD(alert, app);
- JS_STATIC_METHOD(beep, app);
- JS_STATIC_METHOD(browseForDoc, app);
- JS_STATIC_METHOD(clearInterval, app);
- JS_STATIC_METHOD(clearTimeOut, app);
- JS_STATIC_METHOD(execDialog, app);
- JS_STATIC_METHOD(execMenuItem, app);
- JS_STATIC_METHOD(findComponent, app);
- JS_STATIC_METHOD(goBack, app);
- JS_STATIC_METHOD(goForward, app);
- JS_STATIC_METHOD(launchURL, app);
- JS_STATIC_METHOD(mailMsg, app);
- JS_STATIC_METHOD(newFDF, app);
- JS_STATIC_METHOD(newDoc, app);
- JS_STATIC_METHOD(openDoc, app);
- JS_STATIC_METHOD(openFDF, app);
- JS_STATIC_METHOD(popUpMenuEx, app);
- JS_STATIC_METHOD(popUpMenu, app);
- JS_STATIC_METHOD(response, app);
- JS_STATIC_METHOD(setInterval, app);
- JS_STATIC_METHOD(setTimeOut, app);
-
-};
-
-#endif //_APP_H_
diff --git a/src/main/jni/include/javascript/color.h b/src/main/jni/include/javascript/color.h
deleted file mode 100644
index d0aa72f8..00000000
--- a/src/main/jni/include/javascript/color.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _COLOR_H_
-#define _COLOR_H_
-
-class color : public CJS_EmbedObj
-{
-public:
- color(CJS_Object* pJSObject);
- virtual ~color(void);
-
- FX_BOOL black(OBJ_PROP_PARAMS);
- FX_BOOL blue(OBJ_PROP_PARAMS);
- FX_BOOL cyan(OBJ_PROP_PARAMS);
- FX_BOOL dkGray(OBJ_PROP_PARAMS);
- FX_BOOL gray(OBJ_PROP_PARAMS);
- FX_BOOL green(OBJ_PROP_PARAMS);
- FX_BOOL ltGray(OBJ_PROP_PARAMS);
- FX_BOOL magenta(OBJ_PROP_PARAMS);
- FX_BOOL red(OBJ_PROP_PARAMS);
- FX_BOOL transparent(OBJ_PROP_PARAMS);
- FX_BOOL white(OBJ_PROP_PARAMS);
- FX_BOOL yellow(OBJ_PROP_PARAMS);
-
- FX_BOOL convert(OBJ_METHOD_PARAMS);
- FX_BOOL equal(OBJ_METHOD_PARAMS);
-
-public:
- static void ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
- static void ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
-
-private:
- CPWL_Color m_crTransparent;
- CPWL_Color m_crBlack;
- CPWL_Color m_crWhite;
- CPWL_Color m_crRed;
- CPWL_Color m_crGreen;
- CPWL_Color m_crBlue;
- CPWL_Color m_crCyan;
- CPWL_Color m_crMagenta;
- CPWL_Color m_crYellow;
- CPWL_Color m_crDKGray;
- CPWL_Color m_crGray;
- CPWL_Color m_crLTGray;
-};
-
-class CJS_Color : public CJS_Object
-{
-public:
- CJS_Color(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Color(void){};
-
- DECLARE_JS_CLASS(CJS_Color);
-
- JS_STATIC_PROP(black, color);
- JS_STATIC_PROP(blue, color);
- JS_STATIC_PROP(cyan, color);
- JS_STATIC_PROP(dkGray, color);
- JS_STATIC_PROP(gray, color);
- JS_STATIC_PROP(green, color);
- JS_STATIC_PROP(ltGray, color);
- JS_STATIC_PROP(magenta, color);
- JS_STATIC_PROP(red, color);
- JS_STATIC_PROP(transparent, color);
- JS_STATIC_PROP(white, color);
- JS_STATIC_PROP(yellow, color);
-
- JS_STATIC_METHOD(convert,color);
- JS_STATIC_METHOD(equal,color);
-
-};
-
-#endif //_COLOR_H_
-
diff --git a/src/main/jni/include/javascript/console.h b/src/main/jni/include/javascript/console.h
deleted file mode 100644
index 70d993b8..00000000
--- a/src/main/jni/include/javascript/console.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _CONSOLE_H_
-#define _CONSOLE_H_
-
-class console : public CJS_EmbedObj
-{
-public:
- console(CJS_Object* pJSObject);
- virtual ~console(void);
-
-public:
- FX_BOOL clear(OBJ_METHOD_PARAMS);
- FX_BOOL hide(OBJ_METHOD_PARAMS);
- FX_BOOL println(OBJ_METHOD_PARAMS);
- FX_BOOL show(OBJ_METHOD_PARAMS);
-};
-
-class CJS_Console : public CJS_Object
-{
-public:
- CJS_Console(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Console(void){};
-
- DECLARE_JS_CLASS(CJS_Console);
-
- JS_STATIC_METHOD(clear, console);
- JS_STATIC_METHOD(hide, console);
- JS_STATIC_METHOD(println, console);
- JS_STATIC_METHOD(show, console);
-};
-
-#endif //_CONSOLE_H_
-
diff --git a/src/main/jni/include/javascript/event.h b/src/main/jni/include/javascript/event.h
deleted file mode 100644
index 040a9333..00000000
--- a/src/main/jni/include/javascript/event.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _EVENT_H_
-#define _EVENT_H_
-
-class event : public CJS_EmbedObj
-{
-public:
- event(CJS_Object * pJSObject);
- virtual ~event(void);
-
-public:
- FX_BOOL change(OBJ_PROP_PARAMS);
- FX_BOOL changeEx(OBJ_PROP_PARAMS);
- FX_BOOL commitKey(OBJ_PROP_PARAMS);
- FX_BOOL fieldFull(OBJ_PROP_PARAMS);
- FX_BOOL keyDown(OBJ_PROP_PARAMS);
- FX_BOOL modifier(OBJ_PROP_PARAMS);
- FX_BOOL name(OBJ_PROP_PARAMS);
- FX_BOOL rc(OBJ_PROP_PARAMS);
- FX_BOOL richChange(OBJ_PROP_PARAMS);
- FX_BOOL richChangeEx(OBJ_PROP_PARAMS);
- FX_BOOL richValue(OBJ_PROP_PARAMS);
- FX_BOOL selEnd(OBJ_PROP_PARAMS);
- FX_BOOL selStart(OBJ_PROP_PARAMS);
- FX_BOOL shift(OBJ_PROP_PARAMS);
- FX_BOOL source(OBJ_PROP_PARAMS);
- FX_BOOL target(OBJ_PROP_PARAMS);
- FX_BOOL targetName(OBJ_PROP_PARAMS);
- FX_BOOL type(OBJ_PROP_PARAMS);
- FX_BOOL value(OBJ_PROP_PARAMS);
- FX_BOOL willCommit(OBJ_PROP_PARAMS);
-
-};
-
-class CJS_Event : public CJS_Object
-{
-public:
- CJS_Event(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Event(void){};
-
- DECLARE_JS_CLASS(CJS_Event);
-
- JS_STATIC_PROP(change, event);
- JS_STATIC_PROP(changeEx, event);
- JS_STATIC_PROP(commitKey, event);
- JS_STATIC_PROP(fieldFull, event);
- JS_STATIC_PROP(keyDown, event);
- JS_STATIC_PROP(modifier, event);
- JS_STATIC_PROP(name, event);
- JS_STATIC_PROP(rc, event);
- JS_STATIC_PROP(richChange, event);
- JS_STATIC_PROP(richChangeEx, event);
- JS_STATIC_PROP(richValue, event);
- JS_STATIC_PROP(selEnd, event);
- JS_STATIC_PROP(selStart, event);
- JS_STATIC_PROP(shift, event);
- JS_STATIC_PROP(source, event);
- JS_STATIC_PROP(target, event);
- JS_STATIC_PROP(targetName, event);
- JS_STATIC_PROP(type, event);
- JS_STATIC_PROP(value, event);
- JS_STATIC_PROP(willCommit, event);
-};
-
-#endif //_EVENT_H_
diff --git a/src/main/jni/include/javascript/global.h b/src/main/jni/include/javascript/global.h
deleted file mode 100644
index f5867c50..00000000
--- a/src/main/jni/include/javascript/global.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _GLOBAL_H_
-#define _GLOBAL_H_
-
-class CJS_GlobalData;
-
-struct js_global_data
-{
- js_global_data()
- {
- nType = 0;
- dData = 0;
- bData = FALSE;
- sData = "";
- bPersistent = FALSE;
- bDeleted = FALSE;
- }
-
- ~js_global_data()
- {
- pData.Reset();
- }
- int nType; //0:int 1:bool 2:string 3:obj
- double dData;
- bool bData;
- CFX_ByteString sData;
- v8::Persistent pData;
- bool bPersistent;
- bool bDeleted;
-};
-
-class global_alternate : public CJS_EmbedObj
-{
-public:
- global_alternate(CJS_Object* pJSObject);
- virtual ~global_alternate();
-
-public:
- FX_BOOL setPersistent(OBJ_METHOD_PARAMS);
-
-public:
- FX_BOOL QueryProperty(FX_LPCWSTR propname);
- FX_BOOL DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS_PropValue & vp, JS_ErrorString & sError);
- FX_BOOL DelProperty(IFXJS_Context* cc, FX_LPCWSTR propname, JS_ErrorString & sError);
-
- void Initial(CPDFDoc_Environment* pApp);
-
-private:
- void UpdateGlobalPersistentVariables();
- void CommitGlobalPersisitentVariables();
- void DestroyGlobalPersisitentVariables();
- FX_BOOL SetGlobalVariables(FX_LPCSTR propname, int nType,
- double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent);
-
- void ObjectToArray(v8::Handle pObj, CJS_GlobalVariableArray& array);
- void PutObjectProperty(v8::Handle obj, CJS_KeyValue* pData);
-
-private:
- CFX_MapByteStringToPtr m_mapGlobal;
- CFX_WideString m_sFilePath;
- CJS_GlobalData* m_pGlobalData;
- CPDFDoc_Environment* m_pApp;
-};
-
-
-class CJS_Global : public CJS_Object
-{
-public:
- CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Global(void){};
-
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_SPECIAL_JS_CLASS(CJS_Global);
-
- JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);
-
-};
-
-#endif //_GLOBAL_H_
diff --git a/src/main/jni/include/javascript/report.h b/src/main/jni/include/javascript/report.h
deleted file mode 100644
index fb5adf39..00000000
--- a/src/main/jni/include/javascript/report.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _REPORT_H_
-#define _REPORT_H_
-
-class Report : public CJS_EmbedObj
-{
-public:
- Report(CJS_Object * pJSObject);
- virtual ~Report();
-
-public:
- FX_BOOL save(OBJ_METHOD_PARAMS);
- FX_BOOL writeText(OBJ_METHOD_PARAMS);
-};
-
-class CJS_Report : public CJS_Object
-{
-public:
- CJS_Report(JSFXObject pObject) : CJS_Object(pObject){};
- virtual ~CJS_Report(){};
-
-public:
- DECLARE_JS_CLASS(CJS_Report);
-
- JS_STATIC_METHOD(save, Report)
- JS_STATIC_METHOD(writeText, Report);
-};
-
-#endif //_REPORT_H_
-
diff --git a/src/main/jni/include/javascript/resource.h b/src/main/jni/include/javascript/resource.h
deleted file mode 100644
index 710cc507..00000000
--- a/src/main/jni/include/javascript/resource.h
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#define IDD_JS_MSGBOX 25600
-#define IDD_RESPONSE 25601
-#define IDC_JS_MSG_TEXT 25602
-#define ID_JS_MSG_OK 25603
-#define ID_JS_MSG_CANCEL 25604
-#define IDC_JS_MSG_ICON 25605
-#define ID_JS_MSG_YES 25606
-#define ID_JS_MSG_NO 25607
-#define IDC_JS_QUESTION 25608
-#define ID_JS_OK 25609
-#define ID_JS_CANCEL 25610
-#define IDC_JS_ANSWER 25611
-#define IDC_JS_EDIT 25612
-#define IDS_STRING_JSALERT 25613
-#define IDS_STRING_JSPARAMERROR 25614
-#define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615
-#define IDS_STRING_JSINPUTERROR 25616
-#define IDS_STRING_JSPARAM_TOOLONG 25617
-#define IDS_STRING_JSPARSEDATE 25618
-#define IDS_STRING_JSRANGE1 25619
-#define IDS_STRING_JSRANGE2 25620
-#define IDS_STRING_JSRANGE3 25621
-#define IDS_STRING_JSRANGE4 25622
-#define IDS_STRING_FILEOPENFAIL 25623
-#define IDS_STRING_JSATTENTION 25624
-#define IDS_STRING_JSSUBMITS 25625
-#define IDS_STRING_JSSUBMITF 25626
-#define IDS_STRING_NOTSUPPORT 25627
-#define IDS_STRING_JSBUSY 25628
-#define IDS_STRING_JSEVENT 25629
-#define IDS_STRING_RUN 25630
-#define IDS_STRING_UNHANDLED 25631
-#define IDS_STRING_JSPRINT1 25632
-#define IDS_STRING_JSPRINT2 25633
-#define IDS_STRING_LAUNCHURL 25634
-#define IDS_JSPARAM_INCORRECT 25635
-#define IDD_JS_CONSOLE 25636
-#define IDS_STRING_SAFEMODEL 25636
-#define IDC_EDTSCRIPT 25637
-#define IDC_BTNCLEAR 25638
-#define IDC_EDTOUTPUT 25639
-#define IDC_CHECK_TIPS 25640
-#define IDC_BTNRUN 25641
-
-
-
-static CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT ID)
-{
- switch(ID)
- {
- case IDS_STRING_JSALERT:
- return L"Alert";
- case IDS_STRING_JSPARAMERROR:
- return L"The amount of parameters is not correct !";
- case IDS_STRING_JSAFNUMBER_KEYSTROKE:
- return L"The input value is invalid.";
- case IDS_STRING_JSINPUTERROR:
- return L"Input error !";
- case IDS_STRING_JSPARAM_TOOLONG:
- return L"The value you are going to input is too long.";
- case IDS_STRING_JSPARSEDATE:
- return L"The input string can't be parsed to a valid date time (%s).";
- case IDS_STRING_JSRANGE1:
- return L"Invalid value: must be greater or equal to %s and less than or equal to %s.";
- case IDS_STRING_JSRANGE2:
- return L"Invalid value: must be greater or equal to %s.";
- case IDS_STRING_JSRANGE3:
- return L"Invalid value: must be less than or equal to %s.";
- case IDS_STRING_JSRANGE4:
- return L"Range Error";
- case IDS_STRING_FILEOPENFAIL:
- return L"Opening file failed.";
- case IDS_STRING_JSATTENTION:
- return L"Attention";
- case IDS_STRING_JSSUBMITS:
- return L"Submit form successfully!";
- case IDS_STRING_JSSUBMITF:
- return L"Submit form failed!";
- case IDS_STRING_NOTSUPPORT:
- return L"Not supported.";
- case IDS_STRING_JSBUSY:
- return L"System is busy!";
- case IDS_STRING_JSEVENT:
- return L"The event of the formfield exists!";
- case IDS_STRING_RUN:
- return L"It runs successfully.";
- case IDS_STRING_UNHANDLED:
- return L"An unhandled error!";
- case IDS_STRING_JSPRINT1:
- return L"The second parameter can't convert to Date!";
- case IDS_STRING_JSPRINT2:
- return L"The second parameter isn't a valid Date!";
- case IDS_STRING_LAUNCHURL:
- return L"The Document is trying to connect to \r\n%s\r\nIf you trust the site, choose OK. If you don't trust the site, choose Cancel.";
- case IDS_JSPARAM_INCORRECT:
- return L"The parameter you inputted is incorrect!";
- case IDS_STRING_SAFEMODEL:
- return L"Secure reading mode";
- default:
- return L"";
-
- }
-}
-
diff --git a/src/main/jni/include/javascript/util.h b/src/main/jni/include/javascript/util.h
deleted file mode 100644
index 14857c97..00000000
--- a/src/main/jni/include/javascript/util.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _UTIL_H_
-#define _UTIL_H_
-
-class util : public CJS_EmbedObj
-{
-public:
- util(CJS_Object * pJSObject);
- virtual ~util(void);
-
-public:
- FX_BOOL printd(OBJ_METHOD_PARAMS);
- FX_BOOL printf(OBJ_METHOD_PARAMS);
- FX_BOOL printx(OBJ_METHOD_PARAMS);
- FX_BOOL scand(OBJ_METHOD_PARAMS);
- FX_BOOL byteToChar(OBJ_METHOD_PARAMS);
-
-public:
- static void printd(const std::wstring &cFormat,CJS_Date Date,bool bXFAPicture, std::wstring &cPurpose);
- static void printx(const std::string &cFormat,const std::string &cSource, std::string &cPurpose);
- static int ParstDataType(std::wstring* sFormat);
-};
-
-class CJS_Util : public CJS_Object
-{
-public:
- CJS_Util(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Util(void){};
-
- DECLARE_JS_CLASS(CJS_Util);
-
- JS_STATIC_METHOD(printd, util);
- JS_STATIC_METHOD(printf, util);
- JS_STATIC_METHOD(printx, util);
- JS_STATIC_METHOD(scand, util);
- JS_STATIC_METHOD(byteToChar, util);
-};
-
-FX_INT64 FX_atoi64(const char *nptr);
-#endif //_UTIL_H_
diff --git a/src/main/jni/include/jsapi/fxjs_v8.h b/src/main/jni/include/jsapi/fxjs_v8.h
deleted file mode 100644
index 3ea5054e..00000000
--- a/src/main/jni/include/jsapi/fxjs_v8.h
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXJSAPI_H
-#define FXJSAPI_H
-
-#include
-
-enum FXJSOBJTYPE
-{
- JS_DYNAMIC = 0,
- JS_STATIC = 1,
-};
-
-enum FXJSVALUETYPE
-{
- VT_unknown,
- VT_string,
- VT_number,
- VT_boolean,
- VT_date,
- VT_object,
- VT_fxobject,
- VT_null,
- VT_undefined
-};
-
-struct FXJSErr
-{
- const wchar_t* message;
- const wchar_t* srcline;
- unsigned linnum;
-};
-
-/* --------------------------------------------- API --------------------------------------------- */
-
-typedef v8::Isolate IJS_Runtime;
-class IFXJS_Context;
-class IFXJS_Runtime;
-
-
-#ifndef JSCRIPT_ARGS
-#define JSCRIPT_ARGS
-
-#define JS_PROPGET_ARGS v8::Local property,const v8::PropertyCallbackInfo& info
-#define JS_PROPPUT_ARGS v8::Local property,v8::Local value,const v8::PropertyCallbackInfo& info
-#define JS_METHOD_ARGS const v8::FunctionCallbackInfo& info
-#define JS_CONSTRUCTOR_ARGS IFXJS_Context* cc, v8::Handle obj, v8::Handle global
-#define JS_DESTRUCTOR_ARGS v8::Handle obj
-
-#define JS_PROPQUERY_ARGS v8::Local property,const v8::PropertyCallbackInfo& info
-#define JS_NAMED_PROPGET_ARGS JS_PROPGET_ARGS
-#define JS_NAMED_PROPPUT_ARGS v8::Local property,v8::Local value,const v8::PropertyCallbackInfo& info
-#define JS_PROPDEL_ARGS v8::Local property,const v8::PropertyCallbackInfo& info
-
-typedef unsigned (*LP_CONSTRUCTOR)(JS_CONSTRUCTOR_ARGS);
-typedef unsigned (*LP_DESTRUCTOR)(JS_DESTRUCTOR_ARGS);
-
-#endif
-
-int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew);
-int JS_DefineObjMethod(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall, unsigned nParamNum);
-int JS_DefineObjProperty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut);
-int JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::NamedPropertyQueryCallback pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterCallback pPropPut, v8::NamedPropertyDeleterCallback pPropDel);
-int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Handle pDefault);
-int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall, unsigned nParamNum);
-int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Handle pDefault);
-
-void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Persistent& v8PersistentContext);
-void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Persistent& v8PersistentContext);
-void JS_Initial();
-void JS_Release();
-int JS_Parse(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
-int JS_Execute(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
-v8::Handle JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID);
-v8::Handle JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID);
-void JS_SetThisObj(IJS_Runtime* pJSRuntime, int nThisObjID);
-v8::Handle JS_GetThisObj(IJS_Runtime * pJSRuntime);
-int JS_GetObjDefnID(v8::Handle pObj);
-IJS_Runtime* JS_GetRuntime(v8::Handle pObj);
-int JS_GetObjDefnID(IJS_Runtime * pJSRuntime, const wchar_t* pObjName);
-void JS_Error(v8::Value * pError,const wchar_t * main,const wchar_t * sub);
-unsigned JS_CalcHash(const wchar_t* main, unsigned nLen);
-unsigned JS_CalcHash(const wchar_t* main);
-const wchar_t* JS_GetTypeof(v8::Handle pObj);
-const wchar_t* JS_GetClassname(v8::Handle pObj);
-void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Handle pObj, void* p);
-void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Handle pObj);
-void JS_SetPrivate(v8::Handle pObj, void* p);
-void* JS_GetPrivate(v8::Handle pObj);
-void JS_FreePrivate(v8::Handle pObj);
-v8::Handle JS_GetObjectValue(v8::Handle pObj);
-v8::Handle JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Handle pObj,const wchar_t* PropertyName);
-v8::Handle JS_GetObjectElementNames(v8::Handle pObj);
-void JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, const wchar_t* sValue);
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, int nValue);
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, float fValue);
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, double dValue);
-void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, bool bValue);
-void JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, v8::Handle pPut);
-void JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName);
-unsigned JS_PutArrayElement(v8::Handle pArray,unsigned index,v8::Handle pValue,FXJSVALUETYPE eType);
-v8::Handle JS_GetArrayElemnet(v8::Handle pArray,unsigned index);
-unsigned JS_GetArrayLength(v8::Handle pArray);
-v8::Handle JS_GetListValue(v8::Handle pList, int index);
-
-
-v8::Handle JS_NewArray(IJS_Runtime* pJSRuntime);
-v8::Handle JS_NewNumber(IJS_Runtime* pJSRuntime,int number);
-v8::Handle JS_NewNumber(IJS_Runtime* pJSRuntime,double number);
-v8::Handle JS_NewNumber(IJS_Runtime* pJSRuntime,float number);
-v8::Handle JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b);
-v8::Handle JS_NewObject(IJS_Runtime* pJSRuntime,v8::Handle pObj);
-v8::Handle JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Handle pObj);
-v8::Handle JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string);
-v8::Handle JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen);
-v8::Handle JS_NewNull();
-v8::Handle JS_NewDate(IJS_Runtime* pJSRuntime,double d);
-v8::Handle JS_NewValue(IJS_Runtime* pJSRuntime);
-
-
-int JS_ToInt32(v8::Handle pValue);
-bool JS_ToBoolean(v8::Handle pValue);
-double JS_ToNumber(v8::Handle pValue);
-v8::Handle JS_ToObject(v8::Handle pValue);
-CFX_WideString JS_ToString(v8::Handle pValue);
-v8::Handle JS_ToArray(v8::Handle pValue);
-void JS_ValueCopy(v8::Handle& pTo, v8::Handle pFrom);
-
-double JS_GetDateTime();
-int JS_GetYearFromTime(double dt);
-int JS_GetMonthFromTime(double dt);
-int JS_GetDayFromTime(double dt);
-int JS_GetHourFromTime(double dt);
-int JS_GetMinFromTime(double dt);
-int JS_GetSecFromTime(double dt);
-double JS_DateParse(const wchar_t* string);
-double JS_MakeDay(int nYear, int nMonth, int nDay);
-double JS_MakeTime(int nHour, int nMin, int nSec, int nMs);
-double JS_MakeDate(double day, double time);
-bool JS_PortIsNan(double d);
-double JS_LocalTime(double d);
-
-#endif //FXJSAPI_H
diff --git a/src/main/jni/include/pdfwindow/IPDFWindow.h b/src/main/jni/include/pdfwindow/IPDFWindow.h
deleted file mode 100644
index 22f023d8..00000000
--- a/src/main/jni/include/pdfwindow/IPDFWindow.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _IPDFWINDOW_H_
-#define _IPDFWINDOW_H_
-
-#include "PWL_Wnd.h"
-#include "PWL_EditCtrl.h"
-#include "PWL_Edit.h"
-#include "PWL_ListBox.h"
-#include "PWL_ComboBox.h"
-#include "PWL_Button.h"
-#include "PWL_SpecialButton.h"
-#include "PWL_Icon.h"
-#include "PWL_Label.h"
-#include "PWL_ListCtrl.h"
-#include "PWL_Caret.h"
-#include "PWL_ScrollBar.h"
-#include "PWL_Note.h"
-#include "PWL_IconList.h"
-#include "PWL_FontMap.h"
-#include "PWL_Signature.h"
-#include "PWL_Utils.h"
-
-#endif //_IPDFWINDOW_H_
diff --git a/src/main/jni/include/pdfwindow/PDFWindow.h b/src/main/jni/include/pdfwindow/PDFWindow.h
deleted file mode 100644
index a83be413..00000000
--- a/src/main/jni/include/pdfwindow/PDFWindow.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PDFWINDOW_H_
-#define _PDFWINDOW_H_
-
-// #define VC_EXTRALEAN
-// #include
-// #include
-
-#ifndef _INC_PDFAPI
- #define _INC_PDFAPI
-
- #include "../../../core/include/fpdfapi/fpdf_module.h"
- #include "../../../core/include/fpdfdoc/fpdf_doc.h"
- #include "../../../core/include/fpdfdoc/fpdf_vt.h"
- #include "../../../core/include/fxcrt/fx_xml.h"
-
- #include "../fpdf_fwlevent.h"
- #include "../fx_systemhandler.h"
-#endif
-
-#include "../fxedit/fx_edit.h"
-#endif
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Button.h b/src/main/jni/include/pdfwindow/PWL_Button.h
deleted file mode 100644
index 8416c4de..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Button.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_BUTTON_H_
-#define _PWL_BUTTON_H_
-
-class PWL_CLASS CPWL_Button : public CPWL_Wnd
-{
-public:
- CPWL_Button();
- virtual ~CPWL_Button();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
-
-protected:
- FX_BOOL m_bMouseDown;
-};
-
-#endif // !defined(AFX_PWL_BUTTON_H__5A6080AA_33C5_4FC9_91FC_D9644C41120A__INCLUDED_)
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Caret.h b/src/main/jni/include/pdfwindow/PWL_Caret.h
deleted file mode 100644
index 600e5096..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Caret.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_CARET_H_
-#define _PWL_CARET_H_
-
-struct PWL_CARET_INFO
-{
-public:
- PWL_CARET_INFO() : bVisible(FALSE), ptHead(0,0), ptFoot(0,0)
- {
- }
-
- FX_BOOL bVisible;
- CPDF_Point ptHead;
- CPDF_Point ptFoot;
-};
-
-
-class CPWL_Caret : public CPWL_Wnd
-{
-public:
- CPWL_Caret();
- virtual ~CPWL_Caret();
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void InvalidateRect(CPDF_Rect * pRect = NULL);
-
- virtual void SetVisible(FX_BOOL bVisible) {}
-
- virtual void TimerProc();
-
- void SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);
- CFX_ByteString GetCaretAppearanceStream(const CPDF_Point & ptOffset);
-
-private:
- void GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset);
- CPDF_Rect GetCaretRect() const;
-
- FX_BOOL m_bFlash;
- CPDF_Point m_ptHead;
- CPDF_Point m_ptFoot;
- FX_FLOAT m_fWidth;
- FX_INT32 m_nDelay;
-
-public:
- void SetInvalidRect(CPDF_Rect rc) {m_rcInvalid = rc;}
-private:
- CPDF_Rect m_rcInvalid;
-};
-
-#endif // !defined(AFX_PWL_CARET_H__6A729612_4173_4B65_BCAB_7C6C850ECA47__INCLUDED_)
-
diff --git a/src/main/jni/include/pdfwindow/PWL_ComboBox.h b/src/main/jni/include/pdfwindow/PWL_ComboBox.h
deleted file mode 100644
index 5b91fe4a..00000000
--- a/src/main/jni/include/pdfwindow/PWL_ComboBox.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_COMBOBOX_H_
-#define _PWL_COMBOBOX_H_
-
-class CPWL_CBEdit : public CPWL_Edit
-{
-public:
- CPWL_CBEdit(){};
- virtual ~CPWL_CBEdit(){};
-};
-
-class PWL_CLASS CPWL_CBListBox : public CPWL_ListBox
-{
-public:
- CPWL_CBListBox(){};
- virtual ~CPWL_CBListBox(){};
-
-public:
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);
-};
-
-#define PWL_COMBOBOX_BUTTON_WIDTH 13
-
-class CPWL_CBButton : public CPWL_Wnd
-{
-public:
- CPWL_CBButton(){};
- virtual ~CPWL_CBButton(){};
-
-public:
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
-
-};
-
-class PWL_CLASS CPWL_ComboBox : public CPWL_Wnd
-{
-public:
- CPWL_ComboBox();
- operator CPWL_Edit* () {return m_pEdit;}
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
-
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
-
- virtual CPDF_Rect GetFocusRect() const;
-
- virtual void SetFocus();
- virtual void KillFocus();
-
- FX_BOOL IsModified() const;
-
-public:
- void SetFillerNotify(IPWL_Filler_Notify* pNotify);
-
- CFX_WideString GetText() const;
- void SetText(FX_LPCWSTR text);
-
- void AddString(FX_LPCWSTR string);
- FX_INT32 GetSelect() const;
- void SetSelect(FX_INT32 nItemIndex);
-
- void SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
- void GetEditSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;
- void Clear();
- void SelectAll();
- FX_BOOL IsPopup() const;
-
- void SetSelectText();
-
-private:
- void CreateEdit(const PWL_CREATEPARAM & cp);
- void CreateButton(const PWL_CREATEPARAM & cp);
- void CreateListBox(const PWL_CREATEPARAM & cp);
-
- void SetPopup(FX_BOOL bPopup);
-
-private:
- CPWL_CBEdit* m_pEdit;
- CPWL_CBButton* m_pButton;
- CPWL_CBListBox* m_pList;
-
- FX_BOOL m_bPopup;
- CPDF_Rect m_rcOldWindow;
- FX_INT32 m_nPopupWhere;
- FX_INT32 m_nSelectItem;
- IPWL_Filler_Notify* m_pFillerNotify;
-
-public:
- void AttachFFLData(void* pData) {m_pFormFiller = pData;}
-private:
- void* m_pFormFiller;
-};
-
-#endif // !defined(AFX_PWL_COMBOBOX_H__9D6645F8_64AA_4806_94E8_95FDEDD39C17__INCLUDED_)
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Edit.h b/src/main/jni/include/pdfwindow/PWL_Edit.h
deleted file mode 100644
index d86cb77d..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Edit.h
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_EDIT_H_
-#define _PWL_EDIT_H_
-
-class IPWL_Filler_Notify;
-class CPWL_Edit;
-class IPWL_SpellCheck;
-
-class IPWL_Filler_Notify
-{
-public:
- virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax,
- FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top)
- virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
- CFX_WideString & strChange, const CFX_WideString& strChangeEx,
- int nSelStart, int nSelEnd,
- FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
- virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
-};
-
-class PWL_CLASS CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify
-{
-public:
- CPWL_Edit();
- virtual ~CPWL_Edit();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnDestroy();
- virtual void OnCreated();
- virtual void RePosChildWnd();
- virtual CPDF_Rect GetClientRect() const;
-
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
-
- virtual CPDF_Rect GetFocusRect() const;
-
-public:
- void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE); //0:left 1:right 2:middle
- void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE); //0:top 1:bottom 2:center
-
- void SetCharArray(FX_INT32 nCharArray);
- void SetLimitChar(FX_INT32 nLimitChar);
-
- void SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint = TRUE);
- void SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);
-
- void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
-
- void EnableSpellCheck(FX_BOOL bEnabled);
-
- FX_BOOL CanSelectAll() const;
- FX_BOOL CanClear() const;
- FX_BOOL CanCopy() const;
- FX_BOOL CanCut() const;
- FX_BOOL CanPaste() const;
-
- virtual void CopyText();
- virtual void PasteText();
- virtual void CutText();
-
- virtual void SetText(FX_LPCWSTR csText);
- void ReplaceSel(FX_LPCWSTR csText);
-
- CFX_ByteString GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
- CFX_ByteString GetCaretAppearanceStream(const CPDF_Point & ptOffset) const;
- CFX_ByteString GetSelectAppearanceStream(const CPDF_Point & ptOffset) const;
-
- FX_BOOL IsTextFull() const;
-
- static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray);
-
- void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
-
- void GeneratePageObjects(CPDF_PageObjects* pPageObjects,
- const CPDF_Point& ptOffset, CFX_ArrayTemplate& ObjArray);
- void GeneratePageObjects(CPDF_PageObjects* pPageObjects,
- const CPDF_Point& ptOffset);
-
-protected:
- virtual void OnSetFocus();
- virtual void OnKillFocus();
-
-protected:
- virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem);
-
-private:
- CPVT_WordRange GetSelectWordRange() const;
- virtual void ShowVScrollBar(FX_BOOL bShow);
- FX_BOOL IsVScrollBarVisible() const;
- void SetParamByFlag();
-
- FX_FLOAT GetCharArrayAutoFontSize(FX_INT32 nCharArray);
- CPDF_Point GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
-
- CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
- CPVT_WordRange GetLatinWordsRange(const CPDF_Point & point) const;
- CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace & place) const;
- CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace & place) const;
- CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const;
-
- void AjustArabicWords(const CPVT_WordRange& wr);
-public:
- FX_BOOL IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);
-private:
- IPWL_Filler_Notify* m_pFillerNotify;
- IPWL_SpellCheck* m_pSpellCheck;
- FX_BOOL m_bFocus;
- CPDF_Rect m_rcOldWindow;
-public:
- void AttachFFLData(void* pData) {m_pFormFiller = pData;}
-private:
- void* m_pFormFiller;
-};
-
-#endif
-
diff --git a/src/main/jni/include/pdfwindow/PWL_EditCtrl.h b/src/main/jni/include/pdfwindow/PWL_EditCtrl.h
deleted file mode 100644
index b13d5e1e..00000000
--- a/src/main/jni/include/pdfwindow/PWL_EditCtrl.h
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_EDITCTRL_H_
-#define _PWL_EDITCTRL_H_
-
-enum PWL_EDIT_ALIGNFORMAT_H
-{
- PEAH_LEFT = 0,
- PEAH_MIDDLE,
- PEAH_RIGHT
-};
-
-enum PWL_EDIT_ALIGNFORMAT_V
-{
- PEAV_TOP = 0,
- PEAV_CENTER,
- PEAV_BOTTOM
-};
-
-class IPWL_Edit_Notify;
-class CPWL_EditCtrl;
-class CPWL_Caret;
-class IFX_Edit;
-class CPWL_Edit;
-
-class IPWL_Edit_Notify
-{
-public:
- //when the position of caret is changed in edit
- virtual void OnCaretMove(FX_INT32 x1, FX_INT32 y1, FX_INT32 x2, FX_INT32 y2) {}
- virtual void OnContentChange(const CPDF_Rect& rcContent){}
- //OprType: 0 InsertWord
- //1 InsertReturn
- //2 BackSpace
- //3 Delete
- //4 Clear
- //5 InsertText
- //6 SetText
- virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnAddUndo(CPWL_Edit* pEdit) {}
-};
-
-class PWL_CLASS CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify
-{
- friend class CPWL_Edit_Notify;
-
-public:
- CPWL_EditCtrl();
- virtual ~CPWL_EditCtrl();
-
-public:
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void OnCreated();
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
-
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
-
-public:
- virtual void SetText(FX_LPCWSTR csText);
-
- virtual void CopyText();
- virtual void PasteText();
- virtual void CutText();
-
- CPDF_Rect GetContentRect() const;
- void GetCaretPos(FX_INT32& x, FX_INT32& y) const;
- FX_BOOL IsModified() const;
-
- CFX_WideString GetText() const;
- void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
- void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;
- void GetTextRange(const CPDF_Rect& rect, FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
- CFX_WideString GetText(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
- void Clear();
- void SelectAll();
-
- FX_INT32 GetCaret() const;
- void SetCaret(FX_INT32 nPos);
- FX_INT32 GetTotalWords() const;
-
- void Paint();
-
- void EnableRefresh(FX_BOOL bRefresh);
- CPDF_Point GetScrollPos() const;
- void SetScrollPos(const CPDF_Point& point);
-
- void SetEditNotify(IPWL_Edit_Notify* pNotify) {m_pEditNotify = pNotify;}
-
- void SetCharSet(FX_BYTE nCharSet){m_nCharSet = nCharSet;}
- FX_INT32 GetCharSet() const;
-
- void SetCodePage(FX_INT32 nCodePage){m_nCodePage = nCodePage;}
- FX_INT32 GetCodePage() const {return m_nCodePage;}
-
- CPDF_Font * GetCaretFont() const;
- FX_FLOAT GetCaretFontSize() const;
-
- FX_BOOL CanUndo() const;
- FX_BOOL CanRedo() const;
- void Redo();
- void Undo();
-
- void SetReadyToInput();
-protected:
- virtual void ShowVScrollBar(FX_BOOL bShow);
-
- virtual void InsertWord(FX_WORD word, FX_INT32 nCharset);
- virtual void InsertReturn();
- virtual void InsertText(FX_LPCWSTR csText);
-
- virtual void SetCursor();
- FX_BOOL IsWndHorV();
-
- void Delete();
- void Backspace();
-
-protected:
- void GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const;
- void SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);
-
- void SetEditCaret(FX_BOOL bVisible);
-
-protected:
- virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}
- virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep);
- virtual void IOnSetScrollPosX(FX_FLOAT fx){}
- virtual void IOnSetScrollPosY(FX_FLOAT fy);
- virtual void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);
- virtual void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);
- virtual void IOnContentChange(const CPDF_Rect& rcContent);
- virtual void IOnInvalidateRect(CPDF_Rect * pRect);
-
-private:
- void CreateEditCaret(const PWL_CREATEPARAM & cp);
-
-protected:
- IFX_Edit* m_pEdit;
- CPWL_Caret* m_pEditCaret;
- FX_BOOL m_bMouseDown;
- IPWL_Edit_Notify* m_pEditNotify;
-
-private:
- FX_INT32 m_nCharSet;
- FX_INT32 m_nCodePage;
-};
-
-#endif
-
diff --git a/src/main/jni/include/pdfwindow/PWL_FontMap.h b/src/main/jni/include/pdfwindow/PWL_FontMap.h
deleted file mode 100644
index b3da533b..00000000
--- a/src/main/jni/include/pdfwindow/PWL_FontMap.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_FONTMAP_H_
-#define _PWL_FONTMAP_H_
-
-struct CPWL_FontMap_Data
-{
- CPDF_Font* pFont;
- FX_INT32 nCharset;
- CFX_ByteString sFontName;
-};
-
-struct CPWL_FontMap_Native
-{
- FX_INT32 nCharset;
- CFX_ByteString sFontName;
-};
-
-#ifndef ANSI_CHARSET
-
-#define ANSI_CHARSET 0
-#define DEFAULT_CHARSET 1
-#define SYMBOL_CHARSET 2
-#define SHIFTJIS_CHARSET 128
-#define HANGEUL_CHARSET 129
-#define HANGUL_CHARSET 129
-#define GB2312_CHARSET 134
-#define CHINESEBIG5_CHARSET 136
-#define OEM_CHARSET 255
-#define JOHAB_CHARSET 130
-#define HEBREW_CHARSET 177
-#define ARABIC_CHARSET 178
-#define GREEK_CHARSET 161
-#define TURKISH_CHARSET 162
-#define VIETNAMESE_CHARSET 163
-#define THAI_CHARSET 222
-#define EASTEUROPE_CHARSET 238
-#define RUSSIAN_CHARSET 204
-#define BALTIC_CHARSET 186
-
-#endif
-
-#ifndef PWL_CLASS
-
- #ifdef FX_READER_DLL
- #define PWL_CLASS __declspec(dllexport)
- #else
- #define PWL_CLASS
- #endif
-#endif
-
-class IFX_SystemHandler;
-class PWL_CLASS CPWL_FontMap : public IFX_Edit_FontMap
-{
-public:
- CPWL_FontMap(IFX_SystemHandler* pSystemHandler);
- virtual ~CPWL_FontMap();
-
- virtual CPDF_Font* GetPDFFont(FX_INT32 nFontIndex);
- virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex);
- virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 nCharset, FX_INT32 nFontIndex);
- virtual FX_INT32 CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word);
- virtual FX_INT32 CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);
-
-public:
- virtual void Initial(FX_LPCSTR fontname = NULL);
- void SetSystemHandler(IFX_SystemHandler* pSystemHandler);
-
- FX_INT32 GetFontMapCount() const;
- const CPWL_FontMap_Data* GetFontMapData(FX_INT32 nIndex) const;
-
-public:
- static FX_INT32 GetNativeCharset();
- CFX_ByteString GetNativeFontName(FX_INT32 nCharset);
-
- static CFX_ByteString GetDefaultFontByCharset(FX_INT32 nCharset);
-
- CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, FX_BYTE nCharset);
- static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName);
- CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
- CPDF_Font* AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName,
- FX_BYTE nCharset);
-
-protected:
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);
- virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
- FX_BOOL KnowWord(FX_INT32 nFontIndex, FX_WORD word);
-
- virtual CPDF_Document* GetDocument();
-
- void Empty();
- FX_INT32 GetFontIndex(const CFX_ByteString& sFontName, FX_INT32 nCharset, FX_BOOL bFind);
- FX_INT32 GetPWLFontIndex(FX_WORD word, FX_INT32 nCharset);
- FX_INT32 AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, FX_INT32 nCharset = DEFAULT_CHARSET);
-
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, FX_INT32 nCharset);
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
-
-private:
- CFX_ByteString GetFontName(FX_INT32 nFontIndex);
- FX_INT32 FindFont(const CFX_ByteString& sFontName, FX_INT32 nCharset = DEFAULT_CHARSET);
-
- CFX_ByteString GetNativeFont(FX_INT32 nCharset);
-
-public:
- struct CharsetFontMap {
- FX_INT32 charset;
- const char* fontname;
- };
- static const CharsetFontMap defaultTTFMap[];
-
-protected:
- CFX_ArrayTemplate m_aData;
- CFX_ArrayTemplate m_aNativeFont;
-
-private:
- CPDF_Document* m_pPDFDoc;
- IFX_SystemHandler* m_pSystemHandler;
-};
-
-class PWL_CLASS CPWL_DocFontMap : public CPWL_FontMap
-{
-public:
- CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc);
- virtual ~CPWL_DocFontMap();
-
- virtual CPDF_Document* GetDocument();
-
-private:
- CPDF_Document* m_pAttachedDoc;
-};
-
-#endif
diff --git a/src/main/jni/include/pdfwindow/PWL_Icon.h b/src/main/jni/include/pdfwindow/PWL_Icon.h
deleted file mode 100644
index 4a084fd5..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Icon.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_ICON_H_
-#define _PWL_ICON_H_
-
-class PWL_CLASS CPWL_Image : public CPWL_Wnd
-{
-public:
- CPWL_Image();
- virtual ~CPWL_Image();
-
- virtual CFX_ByteString GetImageAppStream();
-
- virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
- virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);
- virtual CPDF_Stream * GetPDFStream();
-
-public:
- void SetPDFStream(CPDF_Stream* pStream);
- void GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight);
- CPDF_Matrix GetImageMatrix();
- CFX_ByteString GetImageAlias();
- void SetImageAlias(FX_LPCSTR sImageAlias);
-
-protected:
- CPDF_Stream* m_pPDFStream;
- CFX_ByteString m_sImageAlias;
-};
-
-class PWL_CLASS CPWL_Icon : public CPWL_Image
-{
-public:
- CPWL_Icon();
- virtual ~CPWL_Icon();
-
- virtual CPDF_IconFit * GetIconFit(){return m_pIconFit;};
-
- virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
- virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);
-
- FX_INT32 GetScaleMethod();
- FX_BOOL IsProportionalScale();
- void GetIconPosition(FX_FLOAT & fLeft, FX_FLOAT & fBottom);
- FX_BOOL GetFittingBounds();
-
- void SetIconFit(CPDF_IconFit * pIconFit){m_pIconFit = pIconFit;};
-
-private:
- CPDF_IconFit * m_pIconFit;
-};
-
-
-#endif // !defined(AFX_PWL_BUTTON_H__5A6080AA_33C5_4FC9_91FC_D9644C41120A__INCLUDED_)
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_IconList.h b/src/main/jni/include/pdfwindow/PWL_IconList.h
deleted file mode 100644
index f0844485..00000000
--- a/src/main/jni/include/pdfwindow/PWL_IconList.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_IconList_H_
-#define _PWL_IconList_H_
-
-class IPWL_IconList_Notify;
-class CPWL_IconList_Item;
-class CPWL_IconList_Content;
-class CPWL_IconList;
-class CPWL_Label;
-
-class IPWL_IconList_Notify
-{
-public:
- virtual void OnNoteListSelChanged(FX_INT32 nItemIndex) = 0;
-};
-
-class CPWL_IconList_Item : public CPWL_Wnd
-{
-public:
- CPWL_IconList_Item();
- virtual ~CPWL_IconList_Item();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
-
- void SetSelect(FX_BOOL bSelected);
- FX_BOOL IsSelected() const;
- void SetData(void* pData);
- void SetIcon(FX_INT32 nIconIndex);
- void SetText(const CFX_WideString& str);
- void SetIconFillColor(const CPWL_Color& color);
- CFX_WideString GetText() const;
-
-protected:
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual void OnEnabled();
- virtual void OnDisabled();
-
-private:
- FX_INT32 m_nIconIndex;
- void* m_pData;
- FX_BOOL m_bSelected;
- CPWL_Label* m_pText;
- CPWL_Color m_crIcon;
-};
-
-class CPWL_IconList_Content : public CPWL_ListCtrl
-{
-public:
- CPWL_IconList_Content(FX_INT32 nListCount);
- virtual ~CPWL_IconList_Content();
-
- void SetSelect(FX_INT32 nIndex);
- FX_INT32 GetSelect() const;
- void SetNotify(IPWL_IconList_Notify* pNotify);
- void EnableNotify(FX_BOOL bNotify);
- void SetListData(FX_INT32 nItemIndex, void* pData);
- void SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);
- void SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);
- void SetIconFillColor(const CPWL_Color& color);
- CFX_WideString GetListString(FX_INT32 nItemIndex) const;
- IPWL_IconList_Notify* GetNotify() const;
- void ScrollToItem(FX_INT32 nItemIndex);
-
-protected:
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point);
- virtual FX_BOOL OnKeyDown(FX_WORD nChar);
-
-private:
- CPWL_IconList_Item* GetListItem(FX_INT32 nItemIndex) const;
- void SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect);
- FX_INT32 FindItemIndex(const CPDF_Point& point);
-
- FX_BOOL m_nSelectIndex;
- IPWL_IconList_Notify* m_pNotify;
- FX_BOOL m_bEnableNotify;
- FX_BOOL m_bMouseDown;
- FX_INT32 m_nListCount;
-};
-
-class PWL_CLASS CPWL_IconList : public CPWL_Wnd
-{
-public:
- CPWL_IconList(FX_INT32 nListCount);
- virtual ~CPWL_IconList();
-
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point);
-
- void SetSelect(FX_INT32 nIndex);
- void SetTopItem(FX_INT32 nIndex);
- FX_INT32 GetSelect() const;
- void SetNotify(IPWL_IconList_Notify* pNotify);
- void EnableNotify(FX_BOOL bNotify);
- void SetListData(FX_INT32 nItemIndex, void* pData);
- void SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);
- void SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);
- void SetIconFillColor(const CPWL_Color& color);
- CFX_WideString GetListString(FX_INT32 nItemIndex) const;
-
-protected:
- virtual void OnCreated();
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
-
-private:
- CPWL_IconList_Content* m_pListContent;
- FX_INT32 m_nListCount;
-};
-
-#endif //_PWL_IconList_H_
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Label.h b/src/main/jni/include/pdfwindow/PWL_Label.h
deleted file mode 100644
index 29ea5132..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Label.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_LABEL_H_
-#define _PWL_LABEL_H_
-
-class IFX_Edit;
-
-class PWL_CLASS CPWL_Label : public CPWL_Wnd
-{
-public:
- CPWL_Label();
- virtual ~CPWL_Label();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
-
-public:
- void SetText(FX_LPCWSTR csText);
- CFX_WideString GetText() const;
-
- void SetLimitChar(FX_INT32 nLimitChar);
- void SetHorzScale(FX_INT32 nHorzScale);
- void SetCharSpace(FX_FLOAT fCharSpace);
-
- CPDF_Rect GetContentRect() const;
- FX_INT32 GetTotalWords();
-
- CFX_ByteString GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
-
-protected:
- virtual void OnCreated();
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void RePosChildWnd();
-
-private:
- void SetParamByFlag();
-
-private:
- IFX_Edit* m_pEdit;
-};
-
-#endif
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_ListBox.h b/src/main/jni/include/pdfwindow/PWL_ListBox.h
deleted file mode 100644
index 79615790..00000000
--- a/src/main/jni/include/pdfwindow/PWL_ListBox.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_LISTBOX_H_
-#define _PWL_LISTBOX_H_
-
-class CPDF_ListCtrl;
-class CPWL_List_Notify;
-class CPWL_ListBox;
-class IPWL_Filler_Notify;
-
-class CPWL_List_Notify : public IFX_List_Notify
-{
-public:
- CPWL_List_Notify(CPWL_ListBox * pList);
- virtual ~CPWL_List_Notify();
-
- void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}
- void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep);
- void IOnSetScrollPosX(FX_FLOAT fx){}
- void IOnSetScrollPosY(FX_FLOAT fy);
- void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);
- void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);
- void IOnInvalidateRect(CPDF_Rect * pRect);
-
-private:
- CPWL_ListBox* m_pList;
-};
-
-class PWL_CLASS CPWL_ListBox : public CPWL_Wnd
-{
-public:
- CPWL_ListBox();
- virtual ~CPWL_ListBox();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreated();
- virtual void OnDestroy();
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
- virtual void KillFocus();
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
- virtual void RePosChildWnd();
- virtual void SetText(FX_LPCWSTR csText,FX_BOOL bRefresh = TRUE);
- virtual CFX_WideString GetText() const;
- virtual CPDF_Rect GetFocusRect() const;
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
-
- void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag);
-
- void AddString(FX_LPCWSTR string);
- void SetTopVisibleIndex(FX_INT32 nItemIndex);
- void ScrollToListItem(FX_INT32 nItemIndex);
- void ResetContent();
- void Reset();
- void Select(FX_INT32 nItemIndex);
- void SetCaret(FX_INT32 nItemIndex);
- void SetHoverSel(FX_BOOL bHoverSel);
-
- FX_INT32 GetCount() const;
- FX_BOOL IsMultipleSel() const;
- FX_INT32 GetCaretIndex() const;
- FX_INT32 GetCurSel() const;
- FX_BOOL IsItemSelected(FX_INT32 nItemIndex) const;
- FX_INT32 GetTopVisibleIndex() const;
- FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;
- CPDF_Rect GetContentRect() const;
- FX_FLOAT GetFirstHeight() const;
- CPDF_Rect GetListRect() const;
-
- void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
-
-protected:
- IFX_List* m_pList;
- CPWL_List_Notify* m_pListNotify;
- FX_BOOL m_bMouseDown;
- FX_BOOL m_bHoverSel;
- IPWL_Filler_Notify* m_pFillerNotify;
-public:
- void AttachFFLData(void* pData) {m_pFormFiller = pData;}
-private:
- void* m_pFormFiller;
-};
-
-#endif // !defined(AFX_PWL_LISTBOX_H__F8C0DD72_CC3C_4806_86FB_E9D02B04A34B__INCLUDED_)
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_ListCtrl.h b/src/main/jni/include/pdfwindow/PWL_ListCtrl.h
deleted file mode 100644
index 8997296f..00000000
--- a/src/main/jni/include/pdfwindow/PWL_ListCtrl.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_LISTCTRL_H_
-#define _PWL_LISTCTRL_H_
-
-class CPWL_ListCtrl;
-
-class CPWL_ListCtrl : public CPWL_Wnd
-{
-public:
- CPWL_ListCtrl();
- virtual ~CPWL_ListCtrl();
-
-public:
- void SetScrollPos(const CPDF_Point& point);
- CPDF_Point GetScrollPos() const;
- CPDF_Rect GetScrollArea() const;
-
- void SetItemSpace(FX_FLOAT fSpace);
- void SetTopSpace(FX_FLOAT fSpace);
- void SetBottomSpace(FX_FLOAT fSpace);
- void ResetFace();
- void ResetContent(FX_INT32 nStart);
- FX_INT32 GetItemIndex(CPWL_Wnd* pItem);
- FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth);
-
-protected:
- virtual void RePosChildWnd();
- virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
-public:
- CPDF_Point InToOut(const CPDF_Point& point) const;
- CPDF_Point OutToIn(const CPDF_Point& point) const;
- CPDF_Rect InToOut(const CPDF_Rect& rect) const;
- CPDF_Rect OutToIn(const CPDF_Rect& rect) const;
-
-private:
- void ResetAll(FX_BOOL bMove,FX_INT32 nStart);
-
-private:
- CPDF_Rect m_rcContent;
- CPDF_Point m_ptScroll;
- FX_FLOAT m_fItemSpace;
- FX_FLOAT m_fTopSpace;
- FX_FLOAT m_fBottomSpace;
-};
-
-#endif
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Note.h b/src/main/jni/include/pdfwindow/PWL_Note.h
deleted file mode 100644
index 7cc9e04b..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Note.h
+++ /dev/null
@@ -1,355 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_NOTE_H_
-#define _PWL_NOTE_H_
-
-class IPWL_NoteNotify;
-class IPWL_NoteHandler;
-class IPWL_NoteItem;
-class CPWL_NoteItem;
-class CPWL_Note;
-class CPWL_Label;
-class CPWL_Edit;
-class CPWL_Note_Icon;
-class CPWL_Note_CloseBox;
-class CPWL_Note_LBBox;
-class CPWL_Note_RBBox;
-class CPWL_Note_Edit;
-class CPWL_Note_Options;
-class CPWL_Note_Contents;
-class IPopup_Note;
-
-
-class IPWL_NoteNotify
-{
-public:
- virtual void OnNoteMove(const FX_RECT& rtWin) = 0;
- virtual void OnNoteShow(FX_BOOL bShow) = 0;
- virtual void OnNoteActivate(FX_BOOL bActive) = 0;
- virtual void OnNoteClose() = 0;
- virtual void OnItemCreate(IPWL_NoteItem* pItem) = 0;
- virtual void OnItemDelete(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetAuthorName(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetBkColor(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetContents(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetDateTime(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetSubjectName(IPWL_NoteItem* pItem) = 0;
- virtual void OnPopupMenu(FX_INT32 x, FX_INT32 y) = 0;
- virtual void OnPopupMenu(IPWL_NoteItem* pItem, FX_INT32 x, FX_INT32 y) = 0;
-};
-
-class IPWL_NoteHandler
-{
-public:
- virtual void OnNoteColorChanged(const CPWL_Color& color) = 0;
-};
-
-class IPWL_NoteItem
-{
-public:
- virtual void SetPrivateData(void* pData) = 0;
- virtual void SetBkColor(const CPWL_Color& color) = 0;
- virtual void SetSubjectName(const CFX_WideString& sName) = 0;
- virtual void SetAuthorName(const CFX_WideString& sName) = 0;
- virtual void SetDateTime(FX_SYSTEMTIME time) = 0;
- virtual void SetContents(const CFX_WideString& sContents) = 0;
-
- virtual IPWL_NoteItem* CreateSubItem() = 0;
- virtual FX_INT32 CountSubItems() const = 0;
- virtual IPWL_NoteItem* GetSubItems(FX_INT32 index) const = 0;
- virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;
- virtual void SetFocus() = 0;
-
- virtual IPWL_NoteItem* GetParentItem() const = 0;
- virtual void* GetPrivateData() const = 0;
- virtual CFX_WideString GetAuthorName() const = 0;
- virtual CPWL_Color GetBkColor() const = 0;
- virtual CFX_WideString GetContents() const = 0;
- virtual FX_SYSTEMTIME GetDateTime() const = 0;
- virtual CFX_WideString GetSubjectName() const = 0;
-
- virtual CPWL_Edit* GetEdit() const = 0;
-};
-
-class PWL_CLASS CPWL_Note_Icon : public CPWL_Wnd
-{
-public:
- CPWL_Note_Icon();
- virtual ~CPWL_Note_Icon();
-
- void SetIconType(FX_INT32 nType);
-
-public:
-
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
-private:
- FX_INT32 m_nType;
-};
-
-class CPWL_Note_CloseBox : public CPWL_Button
-{
-public:
- CPWL_Note_CloseBox();
- virtual ~CPWL_Note_CloseBox();
-
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
-
-private:
- FX_BOOL m_bMouseDown;
-};
-
-class CPWL_Note_LBBox : public CPWL_Wnd
-{
-public:
- CPWL_Note_LBBox();
- virtual ~CPWL_Note_LBBox();
-
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-};
-
-class CPWL_Note_RBBox : public CPWL_Wnd
-{
-public:
- CPWL_Note_RBBox();
- virtual ~CPWL_Note_RBBox();
-
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-};
-
-class CPWL_Note_Edit : public CPWL_Edit
-{
-public:
- CPWL_Note_Edit();
- virtual ~CPWL_Note_Edit();
-
- void EnableNotify(FX_BOOL bEnable) {m_bEnableNotify = bEnable;}
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
- FX_FLOAT GetItemLeftMargin();
- FX_FLOAT GetItemRightMargin();
-
- virtual void SetText(FX_LPCWSTR csText);
-
-protected:
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
- virtual void RePosChildWnd();
- virtual void OnSetFocus();
- virtual void OnKillFocus();
-
-private:
- FX_BOOL m_bEnableNotify;
- FX_FLOAT m_fOldItemHeight;
- FX_BOOL m_bSizeChanged;
- FX_FLOAT m_fOldMin;
- FX_FLOAT m_fOldMax;
-};
-
-class CPWL_Note_Options : public CPWL_Wnd
-{
-public:
- CPWL_Note_Options();
- virtual ~CPWL_Note_Options();
-
- CPDF_Rect GetContentRect() const;
- virtual void SetTextColor(const CPWL_Color & color);
- void SetText(const CFX_WideString& sText);
-
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
-private:
- CPWL_Label* m_pText;
-};
-
-class CPWL_Note_Contents : public CPWL_ListCtrl
-{
-public:
- CPWL_Note_Contents();
- virtual ~CPWL_Note_Contents();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
-
- void SetEditFocus(FX_BOOL bLast);
- CPWL_Edit* GetEdit() const;
-
-public:
- void SetText(const CFX_WideString& sText);
- CFX_WideString GetText() const;
-
- CPWL_NoteItem* CreateSubItem();
- void DeleteSubItem(IPWL_NoteItem* pNoteItem);
- FX_INT32 CountSubItems() const;
- IPWL_NoteItem* GetSubItems(FX_INT32 index) const;
-
- virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
-
-protected:
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
-private:
- CPWL_Note_Edit* m_pEdit;
-};
-
-class PWL_CLASS CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem
-{
-public:
- CPWL_NoteItem();
- virtual ~CPWL_NoteItem();
-
-public:
- virtual void SetPrivateData(void* pData);
- virtual void SetBkColor(const CPWL_Color& color);
- virtual void SetSubjectName(const CFX_WideString& sName);
- virtual void SetAuthorName(const CFX_WideString& sName);
- virtual void SetDateTime(FX_SYSTEMTIME time);
- virtual void SetContents(const CFX_WideString& sContents);
-
- virtual IPWL_NoteItem* CreateSubItem();
- virtual FX_INT32 CountSubItems() const;
- virtual IPWL_NoteItem* GetSubItems(FX_INT32 index) const;
- virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem);
- virtual void SetFocus(){SetNoteFocus(FALSE);}
-
- virtual IPWL_NoteItem* GetParentItem() const;
- virtual void* GetPrivateData() const;
- virtual CFX_WideString GetAuthorName() const;
- virtual CPWL_Color GetBkColor() const;
- virtual CFX_WideString GetContents() const;
- virtual FX_SYSTEMTIME GetDateTime() const;
- virtual CFX_WideString GetSubjectName() const;
- virtual FX_BOOL IsTopItem() const { return FALSE;}
- virtual CPWL_Edit* GetEdit() const;
-
-public:
- virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual CFX_ByteString GetClassName() const;
- virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point);
- virtual IPWL_NoteItem* GetFocusedNoteItem() const;
-
- virtual void ResetSubjectName(FX_INT32 nItemIndex);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
-
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
-
-public:
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
- virtual FX_FLOAT GetItemLeftMargin();
- virtual FX_FLOAT GetItemRightMargin();
- CPWL_NoteItem* CreateNoteItem();
- CPWL_NoteItem* GetParentNoteItem() const;
-
- void SetNoteFocus(FX_BOOL bLast);
- void OnContentsValidate();
-
- void OnCreateNoteItem();
-
-protected:
- void PopupNoteItemMenu(const CPDF_Point& point);
-
- virtual const CPWL_Note* GetNote() const;
- virtual IPWL_NoteNotify* GetNoteNotify() const;
-
-protected:
- CPWL_Label* m_pSubject;
- CPWL_Label* m_pDateTime;
- CPWL_Note_Contents* m_pContents;
-
-private:
- void* m_pPrivateData;
- FX_SYSTEMTIME m_dtNote;
- CFX_WideString m_sAuthor;
-
- FX_FLOAT m_fOldItemHeight;
- FX_BOOL m_bSizeChanged;
- FX_BOOL m_bAllowModify;
-};
-
-class PWL_CLASS CPWL_Note : public CPWL_NoteItem
-{
-public:
- CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler);
- virtual ~CPWL_Note();
-
-public:
- virtual void SetSubjectName(const CFX_WideString& sName);
- virtual void SetAuthorName(const CFX_WideString& sName);
- virtual CFX_WideString GetAuthorName() const;
- virtual void SetBkColor(const CPWL_Color& color);
- virtual void ResetSubjectName(FX_INT32 nItemIndex){}
- virtual FX_BOOL IsTopItem() const {return TRUE;}
- virtual const CPWL_Note* GetNote() const;
- virtual IPWL_NoteNotify* GetNoteNotify() const;
-
-public:
- IPWL_NoteItem* Reply();
- void EnableNotify(FX_BOOL bEnabled);
- void SetIconType(FX_INT32 nType);
- void SetOptionsText(const CFX_WideString& sText);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
-
- CFX_WideString GetReplyString() const;
- void SetReplyString(const CFX_WideString& string);
-
- //0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options
- FX_INT32 NoteHitTest(const CPDF_Point& point) const;
- CPDF_Rect GetCaptionRect() const {return m_rcCaption;}
- IPopup_Note* GetPopupNote() const {return m_pPopupNote;}
-
-public:
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
-
- FX_BOOL ResetScrollBar();
- void RePosNoteChildren();
- FX_BOOL ScrollBarShouldVisible();
-
-private:
- CPWL_Label* m_pAuthor;
- CPWL_Note_Icon* m_pIcon;
- CPWL_Note_CloseBox* m_pCloseBox;
- CPWL_Note_LBBox* m_pLBBox;
- CPWL_Note_RBBox* m_pRBBox;
- CPWL_ScrollBar* m_pContentsBar;
- CPWL_Note_Options* m_pOptions;
- IPWL_NoteNotify* m_pNoteNotify;
- FX_BOOL m_bResizing;
- PWL_SCROLL_INFO m_OldScrollInfo;
- CPDF_Rect m_rcCaption;
- FX_BOOL m_bEnalbleNotify;
- IPopup_Note* m_pPopupNote;
- IPWL_NoteHandler* m_pNoteHandler;
- CFX_WideString m_sReplyString;
-};
-
-#endif
-
diff --git a/src/main/jni/include/pdfwindow/PWL_ScrollBar.h b/src/main/jni/include/pdfwindow/PWL_ScrollBar.h
deleted file mode 100644
index d256542b..00000000
--- a/src/main/jni/include/pdfwindow/PWL_ScrollBar.h
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_SCROLLBAR_H_
-#define _PWL_SCROLLBAR_H_
-
-class CPWL_SBButton;
-class CPWL_ScrollBar;
-
-struct PWL_SCROLL_INFO
-{
-public:
- PWL_SCROLL_INFO() : fContentMin(0.0f), fContentMax(0.0f), fPlateWidth(0.0f), fBigStep(0.0f), fSmallStep(0.0f)
- {
- }
- FX_FLOAT fContentMin;
- FX_FLOAT fContentMax;
- FX_FLOAT fPlateWidth;
- FX_FLOAT fBigStep;
- FX_FLOAT fSmallStep;
-};
-
-enum PWL_SCROLLBAR_TYPE
-{
- SBT_HSCROLL,
- SBT_VSCROLL
-};
-
-enum PWL_SBBUTTON_TYPE
-{
- PSBT_MIN,
- PSBT_MAX,
- PSBT_POS
-};
-
-class CPWL_SBButton : public CPWL_Wnd
-{
-public:
- CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,PWL_SBBUTTON_TYPE eButtonType);
- virtual ~CPWL_SBButton();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
-
-protected:
- PWL_SCROLLBAR_TYPE m_eScrollBarType;
- PWL_SBBUTTON_TYPE m_eSBButtonType;
-
- FX_BOOL m_bMouseDown;
-};
-
-struct PWL_FLOATRANGE
-{
-public:
- PWL_FLOATRANGE();
- PWL_FLOATRANGE(FX_FLOAT min,FX_FLOAT max);
- void Default();
- void Set(FX_FLOAT min,FX_FLOAT max);
- FX_BOOL In(FX_FLOAT x) const;
- FX_FLOAT GetWidth() const;
-
- FX_FLOAT fMin,fMax;
-};
-
-struct PWL_SCROLL_PRIVATEDATA
-{
-public:
- PWL_SCROLL_PRIVATEDATA();
-
- void Default();
- void SetScrollRange(FX_FLOAT min,FX_FLOAT max);
- void SetClientWidth(FX_FLOAT width);
- void SetSmallStep(FX_FLOAT step);
- void SetBigStep(FX_FLOAT step);
- FX_BOOL SetPos(FX_FLOAT pos);
-
- void AddSmall();
- void SubSmall();
- void AddBig();
- void SubBig();
-
- PWL_FLOATRANGE ScrollRange;
- FX_FLOAT fClientWidth;
- FX_FLOAT fScrollPos;
- FX_FLOAT fBigStep;
- FX_FLOAT fSmallStep;
-};
-
-class CPWL_ScrollBar : public CPWL_Wnd
-{
-public:
- CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL);
- virtual ~CPWL_ScrollBar();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
-
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- FX_FLOAT GetScrollBarWidth() const;
- PWL_SCROLLBAR_TYPE GetScrollBarType() const {return m_sbType;};
-
- void SetNotifyForever(FX_BOOL bForever) {m_bNotifyForever = bForever;}
-
-protected:
- void SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClientWidth);
- void SetScrollPos(FX_FLOAT fPos);
- void MovePosButton(FX_BOOL bRefresh);
- void SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep);
- void NotifyScrollWindow();
- CPDF_Rect GetScrollArea() const;
-
-private:
- void CreateButtons(const PWL_CREATEPARAM & cp);
-
- void OnMinButtonLBDown(const CPDF_Point & point);
- void OnMinButtonLBUp(const CPDF_Point & point);
- void OnMinButtonMouseMove(const CPDF_Point & point);
-
- void OnMaxButtonLBDown(const CPDF_Point & point);
- void OnMaxButtonLBUp(const CPDF_Point & point);
- void OnMaxButtonMouseMove(const CPDF_Point & point);
-
- void OnPosButtonLBDown(const CPDF_Point & point);
- void OnPosButtonLBUp(const CPDF_Point & point);
- void OnPosButtonMouseMove(const CPDF_Point & point);
-
- FX_FLOAT TrueToFace(FX_FLOAT);
- FX_FLOAT FaceToTrue(FX_FLOAT);
-
- virtual void TimerProc();
-
-private:
- PWL_SCROLLBAR_TYPE m_sbType;
- PWL_SCROLL_INFO m_OriginInfo;
- CPWL_SBButton* m_pMinButton;
- CPWL_SBButton* m_pMaxButton;
- CPWL_SBButton* m_pPosButton;
- PWL_SCROLL_PRIVATEDATA m_sData;
- FX_BOOL m_bMouseDown;
- FX_BOOL m_bMinOrMax;
- FX_BOOL m_bNotifyForever;
- FX_FLOAT m_nOldPos;
- FX_FLOAT m_fOldPosButton;
-};
-
-#endif // !defined(AFX_PWL_SCROLLBAR_H__DCFEC082_2651_48A4_B8F3_63F1B3CC5E10__INCLUDED_)
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Signature.h b/src/main/jni/include/pdfwindow/PWL_Signature.h
deleted file mode 100644
index ec4479bb..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Signature.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_SIGNATURE_H_
-#define _PWL_SIGNATURE_H_
-
-class CPWL_Signature;
-class CPWL_Label;
-class CPWL_Signature_Image;
-
-class CPWL_Signature_Image : public CPWL_Image
-{
-public:
- CPWL_Signature_Image();
- virtual ~CPWL_Signature_Image();
-
- void SetImage(CFX_DIBSource* pImage);
- CFX_DIBSource* GetImage();
-
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
-
- virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
-
-private:
- CFX_DIBSource* m_pImage;
-};
-
-class PWL_CLASS CPWL_Signature : public CPWL_Wnd
-{
-public:
- CPWL_Signature();
- virtual ~CPWL_Signature();
-
- void SetText(FX_LPCWSTR sText);
- void SetDescription(FX_LPCWSTR string);
- void SetImage(CFX_DIBSource* pImage);
- void SetImageStream(CPDF_Stream * pStream, FX_LPCSTR sImageAlias);
-
- void SetTextFlag(FX_BOOL bTextExist);
- void SetImageFlag(FX_BOOL bImageExist);
- void SetFoxitFlag(FX_BOOL bFlagExist);
-
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
-
-private:
- CPWL_Label* m_pText;
- CPWL_Label* m_pDescription;
- CPWL_Signature_Image* m_pImage;
-
- FX_BOOL m_bTextExist;
- FX_BOOL m_bImageExist;
- FX_BOOL m_bFlagExist;
-};
-
-#endif // _PWL_SIGNATURE_H_
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_SpecialButton.h b/src/main/jni/include/pdfwindow/PWL_SpecialButton.h
deleted file mode 100644
index ae882ea5..00000000
--- a/src/main/jni/include/pdfwindow/PWL_SpecialButton.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_SPECIALBUTTON_H_
-#define _PWL_SPECIALBUTTON_H_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-class PWL_CLASS CPWL_PushButton : public CPWL_Button
-{
-public:
- CPWL_PushButton();
- virtual ~CPWL_PushButton();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual CPDF_Rect GetFocusRect() const;
-};
-
-class PWL_CLASS CPWL_CheckBox : public CPWL_Button
-{
-public:
- CPWL_CheckBox();
- virtual ~CPWL_CheckBox();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point);
- virtual FX_BOOL OnChar(FX_WORD nChar);
-
- void SetCheck(FX_BOOL bCheck);
- FX_BOOL IsChecked() const;
-
-private:
- FX_BOOL m_bChecked;
-};
-
-class PWL_CLASS CPWL_RadioButton : public CPWL_Button
-{
-public:
- CPWL_RadioButton();
- virtual ~CPWL_RadioButton();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point);
- virtual FX_BOOL OnChar(FX_WORD nChar);
-
- void SetCheck(FX_BOOL bCheck);
- FX_BOOL IsChecked() const;
-
-private:
- FX_BOOL m_bChecked;
-};
-
-#endif
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Utils.h b/src/main/jni/include/pdfwindow/PWL_Utils.h
deleted file mode 100644
index 489eb4a7..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Utils.h
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_UTILS_H_
-#define _PWL_UTILS_H_
-
-template T PWL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
-template T PWL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
-
-#define PWL_PDF2WIN(color) (FX_BYTE(color*255))
-#define PWL_WIN2PDF(color) ((FX_FLOAT)((FX_FLOAT)color/255.0f))
-
-#define PWL_MAKEDWORD(low,high) ((FX_DWORD)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high))<<16)))
-#define PWL_GETLOWWORD(dword) ((FX_WORD)(dword))
-#define PWL_GETHIGHWORD(dword) ((FX_WORD)(dword>>16))
-
-#define PWL_ICONTYPE_CHECKMARK 0
-#define PWL_ICONTYPE_CIRCLE 1
-#define PWL_ICONTYPE_COMMENT 2
-#define PWL_ICONTYPE_CROSS 3
-#define PWL_ICONTYPE_HELP 4
-#define PWL_ICONTYPE_INSERTTEXT 5
-#define PWL_ICONTYPE_KEY 6
-#define PWL_ICONTYPE_NEWPARAGRAPH 7
-#define PWL_ICONTYPE_TEXTNOTE 8
-#define PWL_ICONTYPE_PARAGRAPH 9
-#define PWL_ICONTYPE_RIGHTARROW 10
-#define PWL_ICONTYPE_RIGHTPOINTER 11
-#define PWL_ICONTYPE_STAR 12
-#define PWL_ICONTYPE_UPARROW 13
-#define PWL_ICONTYPE_UPLEFTARROW 14
-
-#define PWL_ICONTYPE_GRAPH 15
-#define PWL_ICONTYPE_PAPERCLIP 16
-#define PWL_ICONTYPE_ATTACHMENT 17
-#define PWL_ICONTYPE_TAG 18
-
-#define PWL_ICONTYPE_FOXIT 19
-
-#define PWL_ICONTYPE_UNKNOWN -1
-
-//checkbox & radiobutton style
-#define PCS_CHECK 0
-#define PCS_CIRCLE 1
-#define PCS_CROSS 2
-#define PCS_DIAMOND 3
-#define PCS_SQUARE 4
-#define PCS_STAR 5
-
-#define PWL_PI 3.14159265358979f
-#define PWL_BEZIER 0.5522847498308f
-
-//pushbutton layout style
-#define PPBL_LABEL 0
-#define PPBL_ICON 1
-#define PPBL_ICONTOPLABELBOTTOM 2
-#define PPBL_LABELTOPICONBOTTOM 3
-#define PPBL_ICONLEFTLABELRIGHT 4
-#define PPBL_LABELLEFTICONRIGHT 5
-#define PPBL_LABELOVERICON 6
-
-class CPWL_Point : public CPDF_Point
-{
-public:
- CPWL_Point() : CPDF_Point(0.0f,0.0f){}
- CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx,fy) {}
- CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {}
-};
-
-enum PWL_PATHDATA_TYPE
-{
- PWLPT_MOVETO,
- PWLPT_LINETO,
- PWLPT_BEZIERTO,
- PWLPT_UNKNOWN
-};
-
-enum PWL_PATH_TYPE
-{
- PWLPT_PATHDATA,
- PWLPT_STREAM
-};
-
-class CPWL_PathData
-{
-public:
- CPWL_PathData() : point(), type(PWLPT_UNKNOWN){}
- CPWL_PathData(const CPWL_Point& pt, PWL_PATHDATA_TYPE tp) : point(pt), type(tp) {}
-
- CPWL_Point point;
- PWL_PATHDATA_TYPE type;
-};
-
-class IPWL_SpellCheck;
-
-class PWL_CLASS CPWL_Utils
-{
-public:
- static CPDF_Rect InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
- static CPDF_Rect DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
- static FX_BOOL IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);
- static FX_BOOL ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild);
- static CPDF_Rect ScaleRect(const CPDF_Rect& rcRect,FX_FLOAT fScale);
- static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
- static CPDF_Rect GetCenterSquare(const CPDF_Rect & rect);
- static CPWL_Color SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorSub);
- static CPWL_Color DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevide);
- static CPDF_Rect MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);
- static CPDF_Rect OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y);
- static CPDF_Point OffsetPoint(const CPDF_Point & point,FX_FLOAT x,FX_FLOAT y);
- static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, FX_INT32 nTransparancy = 255);
- static FX_BOOL IsBlackOrWhite(const CPWL_Color& color);
- static CPWL_Color GetReverseColor(const CPWL_Color& color);
-
- static CFX_ByteString GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke = TRUE);
- static CFX_ByteString GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,
- const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
- FX_INT32 nStyle, const CPWL_Dash & dash);
- static CFX_ByteString GetCircleBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,
- const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
- FX_INT32 nStyle, const CPWL_Dash & dash);
- static CFX_ByteString GetRectFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);
- static CFX_ByteString GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);
-
- static CFX_ByteString GetPushButtonAppStream(const CPDF_Rect & rcBBox,
- IFX_Edit_FontMap * pFontMap,
- CPDF_Stream * pIconStream,
- CPDF_IconFit & IconFit,
- const CFX_WideString & sLabel,
- const CPWL_Color & crText,
- FX_FLOAT fFontSize,
- FX_INT32 nLayOut);
- static CFX_ByteString GetCheckBoxAppStream(const CPDF_Rect & rcBBox,
- FX_INT32 nStyle,
- const CPWL_Color & crText);
- static CFX_ByteString GetRadioButtonAppStream(const CPDF_Rect & rcBBox,
- FX_INT32 nStyle,
- const CPWL_Color & crText);
-
- static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL,
- FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
- static CFX_ByteString GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
- const CPVT_WordRange * pRange = NULL);
- static CFX_ByteString GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellCheck* pSpellCheck,
- const CPDF_Point & ptOffset,
- const CPVT_WordRange * pRange = NULL);
- static CFX_ByteString GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap,
- const CFX_WideString & sText, FX_INT32 nAlignmentH, FX_INT32 nAlignmentV,
- FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText);
- static CFX_ByteString GetDropButtonAppStream(const CPDF_Rect & rcBBox);
-
- static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,
- const CPWL_Color & color, FX_INT32 nTransparancy);
- static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect & rect,const FX_COLORREF & color);
- static void DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,
- const FX_COLORREF & color, FX_FLOAT fWidth);
- static void DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Point & ptMoveTo, const CPDF_Point & ptLineTo, const FX_COLORREF & color, FX_FLOAT fWidth);
- static void DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect & rect, FX_FLOAT fWidth,
- const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
- FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy);
- static void DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Point* pPts, FX_INT32 nCount, const FX_COLORREF& color);
- static void DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect,
- FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_INT32 nEndGray);
- static void DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange,
- IPWL_SpellCheck* pSpellCheck);
-public:
- static void ConvertCMYK2RGB(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);
- static void ConvertRGB2CMYK(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);
-
- static void ConvertRGB2GRAY(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dGray);
- static void ConvertGRAY2RGB(FX_FLOAT dGray,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);
-
- static void ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray);
- static void ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);
-
- static void PWLColorToARGB(const CPWL_Color& color, FX_INT32& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue);
-
-public:
- static CFX_ByteString GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rect, const CPWL_Color& crFill,
- const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);
- static void DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill,
- const CPWL_Color& crStroke, const FX_INT32 nTransparancy);
-
-private:
- static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount);
- static void GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, FX_INT32 nCount);
-
- static CFX_ByteString GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
-
- static CFX_ByteString GetAP_Check(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Circle(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Cross(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Diamond(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Square(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Star(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fRotate);
-
- static void GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Circle(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Paragraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
-};
-
-#endif // !defined(AFX_PWL_UTILS_H__D32812AD_A875_4E08_9D3C_0A57020987C6__INCLUDED_)
-
-
diff --git a/src/main/jni/include/pdfwindow/PWL_Wnd.h b/src/main/jni/include/pdfwindow/PWL_Wnd.h
deleted file mode 100644
index c3dd9b7a..00000000
--- a/src/main/jni/include/pdfwindow/PWL_Wnd.h
+++ /dev/null
@@ -1,493 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef _PWL_WND_H_
-#define _PWL_WND_H_
-
-class IPWL_Provider;
-class CPWL_Wnd;
-class CPWL_MsgControl;
-class CPWL_Wnd;
-class CPWL_ScrollBar;
-class CPWL_Timer;
-class CPWL_TimerHandler;
-class IPWL_SpellCheck;
-class IFX_SystemHandler;
-
-#ifdef FX_READER_DLL
- #ifdef PWL_EXPORT
- #define PWL_CLASS __declspec(dllexport)
- #define PWL_FUNCTION PWL_CLASS
- #else
- #define PWL_CLASS
- #define PWL_FUNCTION
- #endif
-#else
- #define PWL_CLASS
- #define PWL_FUNCTION
-#endif
-
-//window styles
-#define PWS_CHILD 0x80000000L
-#define PWS_BORDER 0x40000000L
-#define PWS_BACKGROUND 0x20000000L
-#define PWS_HSCROLL 0x10000000L
-#define PWS_VSCROLL 0x08000000L
-#define PWS_VISIBLE 0x04000000L
-#define PWS_DISABLE 0x02000000L
-#define PWS_READONLY 0x01000000L
-#define PWS_AUTOFONTSIZE 0x00800000L
-#define PWS_AUTOTRANSPARENT 0x00400000L
-#define PWS_NOREFRESHCLIP 0x00200000L
-
-//edit and label styles
-#define PES_MULTILINE 0x0001L
-#define PES_PASSWORD 0x0002L
-#define PES_LEFT 0x0004L
-#define PES_RIGHT 0x0008L
-#define PES_MIDDLE 0x0010L
-#define PES_TOP 0x0020L
-#define PES_BOTTOM 0x0040L
-#define PES_CENTER 0x0080L
-#define PES_CHARARRAY 0x0100L
-#define PES_AUTOSCROLL 0x0200L
-#define PES_AUTORETURN 0x0400L
-#define PES_UNDO 0x0800L
-#define PES_RICH 0x1000L
-#define PES_SPELLCHECK 0x2000L
-#define PES_TEXTOVERFLOW 0x4000L
-#define PES_NOREAD 0x8000L
-
-//listbox styles
-#define PLBS_MULTIPLESEL 0x0001L
-#define PLBS_HOVERSEL 0x0008L
-
-//combobox styles
-#define PCBS_ALLOWCUSTOMTEXT 0x0001L
-
-//richedit styles
-#define PRES_MULTILINE 0x0001L
-#define PRES_AUTORETURN 0x0002L
-#define PRES_AUTOSCROLL 0x0004L
-#define PRES_SPELLCHECK 0x0008L
-#define PRES_UNDO 0x0100L
-#define PRES_MULTIPAGES 0x0200L
-#define PRES_TEXTOVERFLOW 0x0400L
-
-//border style
-#define PBS_SOLID 0
-#define PBS_DASH 1
-#define PBS_BEVELED 2
-#define PBS_INSET 3
-#define PBS_UNDERLINED 4
-#define PBS_SHADOW 5
-
-//notification messages
-#define PNM_ADDCHILD 0x00000000L
-#define PNM_REMOVECHILD 0x00000001L
-#define PNM_SETSCROLLINFO 0x00000002L
-#define PNM_SETSCROLLPOS 0x00000003L
-#define PNM_SCROLLWINDOW 0x00000004L
-#define PNM_LBUTTONDOWN 0x00000005L
-#define PNM_LBUTTONUP 0x00000006L
-#define PNM_MOUSEMOVE 0x00000007L
-#define PNM_NOTERESET 0x00000008L
-#define PNM_SETCARETINFO 0x00000009L
-#define PNM_SELCHANGED 0x0000000AL
-#define PNM_NOTEEDITCHANGED 0x0000000BL
-
-#define PWL_CLASSNAME_EDIT "CPWL_Edit"
-
-struct CPWL_Dash
-{
- CPWL_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase)
- {}
-
- FX_INT32 nDash;
- FX_INT32 nGap;
- FX_INT32 nPhase;
-};
-
-struct PWL_CLASS CPWL_Color
-{
- CPWL_Color(FX_INT32 type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f)
- : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4)
- {}
-
- CPWL_Color(FX_INT32 r, FX_INT32 g, FX_INT32 b) :
- nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f), fColor3(b/255.0f), fColor4(0)
- {}
-
- void ConvertColorType(FX_INT32 nColorType);
-
- /*
- COLORTYPE_TRANSPARENT
- COLORTYPE_RGB
- COLORTYPE_CMYK
- COLORTYPE_GRAY
- */
- FX_INT32 nColorType;
- FX_FLOAT fColor1,fColor2,fColor3,fColor4;
-};
-
-inline FX_BOOL operator == (const CPWL_Color &c1, const CPWL_Color &c2)
-{
- return c1.nColorType == c2.nColorType &&
- c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 &&
- c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0.0001 &&
- c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0.0001 &&
- c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
-}
-
-inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2)
-{
- return !operator == (c1, c2);
-}
-
-#define PWL_SCROLLBAR_WIDTH 12.0f
-#define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f
-#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f
-#define PWL_SCROLLBAR_TRANSPARANCY 150
-#define PWL_SCROLLBAR_BKCOLOR CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f)
-#define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB,1,1,1)
-#define PWL_DEFAULT_SELBACKCOLOR CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f)
-#define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR
-#define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB,0,0,0)
-#define PWL_DEFAULT_FONTSIZE 9.0f
-#define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY,0)
-#define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY,1)
-#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY,0.50)
-#define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRAY,0.75)
-#define PWL_TRIANGLE_HALFLEN 2.0f
-#define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f
-#define PWL_INVALIDATE_INFLATE 2
-
-class IPWL_SpellCheck
-{
-public:
- virtual FX_BOOL CheckWord(FX_LPCSTR sWord) = 0;
- virtual void SuggestWords(FX_LPCSTR sWord, CFX_ByteStringArray & sSuggest) = 0;
-};
-
-class IPWL_Provider
-{
-public:
- //get a matrix which map user space to CWnd client space
- virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0;
-
- /*
- 0 L"&Undo\tCtrl+Z"
- 1 L"&Redo\tCtrl+Shift+Z"
- 2 L"Cu&t\tCtrl+X"
- 3 L"&Copy\tCtrl+C"
- 4 L"&Paste\tCtrl+V"
- 5 L"&Delete"
- 6 L"&Select All\tCtrl+A"
- */
- virtual CFX_WideString LoadPopupMenuString(FX_INT32 nIndex) = 0;
-};
-
-class IPWL_FocusHandler
-{
-public:
- virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0;
- virtual void OnKillFocus(CPWL_Wnd* pWnd) = 0;
-};
-
-struct PWL_CREATEPARAM
-{
-public:
- PWL_CREATEPARAM() : rcRectWnd(0,0,0,0),
- pSystemHandler(NULL),
- pFontMap(NULL),
- pProvider(NULL),
- pFocusHandler(NULL),
- dwFlags(0),
- sBackgroundColor(),
- hAttachedWnd(NULL),
- pSpellCheck(NULL),
- nBorderStyle(PBS_SOLID),
- dwBorderWidth(1),
- sBorderColor(),
- sTextColor(),
- sTextStrokeColor(),
- nTransparency(255),
- fFontSize(PWL_DEFAULT_FONTSIZE),
- sDash(3,0,0),
- pAttachedData(NULL),
- pParentWnd(NULL),
- pMsgControl(NULL),
- eCursorType(FXCT_ARROW),
- mtChild(1,0,0,1,0,0)
- {
- }
-
- CPDF_Rect rcRectWnd; //required
- IFX_SystemHandler* pSystemHandler; //required
- IFX_Edit_FontMap* pFontMap; //required for text window
- IPWL_Provider* pProvider; //required for self coordinate
- IPWL_FocusHandler* pFocusHandler; //optional
- FX_DWORD dwFlags; //optional
- CPWL_Color sBackgroundColor; //optional
- FX_HWND hAttachedWnd; //required for no-reader framework
- IPWL_SpellCheck* pSpellCheck; //required for spellchecking
- FX_INT32 nBorderStyle; //optional
- FX_INT32 dwBorderWidth; //optional
- CPWL_Color sBorderColor; //optional
- CPWL_Color sTextColor; //optional
- CPWL_Color sTextStrokeColor; //optional
- FX_INT32 nTransparency; //optional
- FX_FLOAT fFontSize; //optional
- CPWL_Dash sDash; //optional
- void* pAttachedData; //optional
- CPWL_Wnd* pParentWnd; //ignore
- CPWL_MsgControl* pMsgControl; //ignore
- FX_INT32 eCursorType; //ignore
- CPDF_Matrix mtChild; //ignore
-};
-
-class CPWL_Timer
-{
-public:
- CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);
- virtual ~CPWL_Timer();
-
- FX_INT32 SetPWLTimer(FX_INT32 nElapse);
- void KillPWLTimer();
- static void TimerProc(FX_INT32 idEvent);
-
-private:
- FX_INT32 m_nTimerID;
- CPWL_TimerHandler* m_pAttached;
- IFX_SystemHandler* m_pSystemHandler;
-};
-
-class PWL_CLASS CPWL_TimerHandler
-{
-public:
- CPWL_TimerHandler();
- virtual ~CPWL_TimerHandler();
-
- void BeginTimer(FX_INT32 nElapse);
- void EndTimer();
- virtual void TimerProc();
- virtual IFX_SystemHandler* GetSystemHandler() const = 0;
-
-private:
- CPWL_Timer* m_pTimer;
-};
-
-class PWL_CLASS CPWL_Wnd : public CPWL_TimerHandler
-{
- friend class CPWL_MsgControl;
-public:
- CPWL_Wnd();
- virtual ~CPWL_Wnd();
-
- void Create(const PWL_CREATEPARAM & cp);
- virtual CFX_ByteString GetClassName() const;
- void Destroy();
- void Move(const CPDF_Rect & rcNew,FX_BOOL bReset,FX_BOOL bRefresh);
- virtual void InvalidateRect(CPDF_Rect* pRect = NULL);
-
- void GetAppearanceStream(CFX_ByteString & sAppStream);
- void DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnKeyUp(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
- virtual void SetFocus();
- virtual void KillFocus();
- void SetCapture();
- void ReleaseCapture();
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
- virtual void SetTextColor(const CPWL_Color & color);
- virtual void SetTextStrokeColor(const CPWL_Color & color);
- virtual void SetVisible(FX_BOOL bVisible);
-
- virtual CPDF_Rect GetFocusRect() const;
- virtual CPWL_Color GetBackgroundColor() const;
- virtual CPWL_Color GetBorderColor() const;
- virtual CPWL_Color GetTextColor() const;
- virtual CPWL_Color GetTextStrokeColor() const;
- virtual FX_FLOAT GetFontSize() const;
- virtual FX_INT32 GetInnerBorderWidth() const;
- virtual CPWL_Color GetBorderLeftTopColor(FX_INT32 nBorderStyle) const;
- virtual CPWL_Color GetBorderRightBottomColor(FX_INT32 nBorderStyle) const;
-
- virtual FX_BOOL IsModified() const {return FALSE;}
-
- virtual void SetFontSize(FX_FLOAT fFontSize);
-
- void SetBackgroundColor(const CPWL_Color & color);
- void SetBorderColor(const CPWL_Color & color);
- void SetBorderWidth(FX_INT32 nBorderWidth);
- void SetClipRect(const CPDF_Rect & rect);
- void SetBorderStyle(FX_INT32 eBorderStyle);
- void SetBorderDash(const CPWL_Dash & sDash);
-
- CPDF_Rect GetOriginWindowRect() const;
- virtual CPDF_Rect GetWindowRect() const;
- virtual CPDF_Rect GetClientRect() const;
- CPDF_Point GetCenterPoint() const;
- CPDF_Rect GetClientCenterSquare() const;
- CPDF_Rect GetWindowCenterSquare() const;
- FX_INT32 GetBorderWidth() const;
- FX_BOOL IsVisible() const {return m_bVisible;}
- FX_BOOL HasFlag(FX_DWORD dwFlags) const;
- void AddFlag(FX_DWORD dwFlags);
- void RemoveFlag(FX_DWORD dwFlags);
- CPDF_Rect GetClipRect() const;
- CPWL_Wnd* GetParentWindow() const;
- FX_INT32 GetBorderStyle() const;
- CPWL_Dash GetBorderDash() const;
- void* GetAttachedData() const;
-
- FX_BOOL WndHitTest(const CPDF_Point & point) const;
- FX_BOOL ClientHitTest(const CPDF_Point & point) const;
- FX_BOOL IsCaptureMouse() const;
-
- const CPWL_Wnd* GetFocused() const;
- FX_BOOL IsFocused() const;
- FX_BOOL IsReadOnly() const;
- CPWL_ScrollBar* GetVScrollBar() const;
-
- IFX_Edit_FontMap* GetFontMap() const;
- IPWL_Provider* GetProvider() const;
- virtual IFX_SystemHandler* GetSystemHandler() const;
- IPWL_FocusHandler* GetFocusHandler() const;
-
- FX_INT32 GetTransparency();
- void SetTransparency(FX_INT32 nTransparency);
-
- CPDF_Matrix GetChildToRoot() const;
- CPDF_Matrix GetChildMatrix() const;
- void SetChildMatrix(const CPDF_Matrix& mt);
- CPDF_Matrix GetWindowMatrix() const;
-
- virtual CPDF_Point ChildToParent(const CPDF_Point& point) const;
- virtual CPDF_Rect ChildToParent(const CPDF_Rect& rect) const;
- virtual CPDF_Point ParentToChild(const CPDF_Point& point) const;
- virtual CPDF_Rect ParentToChild(const CPDF_Rect& rect) const;
-
- //those methods only implemented by listctrl item
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) {return 0;}
- virtual FX_FLOAT GetItemLeftMargin() {return 0;}
- virtual FX_FLOAT GetItemRightMargin() {return 0;}
-
- void EnableWindow(FX_BOOL bEnable);
- FX_BOOL IsEnabled();
- virtual void SetCursor();
-
-protected:
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
- void GetAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream);
-
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void OnCreated();
- virtual void OnDestroy();
-
- virtual void OnSetFocus();
- virtual void OnKillFocus();
-
- virtual void OnEnabled();
- virtual void OnDisabled();
-
- void SetNotifyFlag(FX_BOOL bNotifying = TRUE){m_bNotifying = bNotifying;};
-
- FX_BOOL IsValid() const;
- PWL_CREATEPARAM GetCreationParam() const;
- FX_BOOL IsNotifying() const {return m_bNotifying;}
-
- void InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew);
-
- void PWLtoWnd(const CPDF_Point & point, FX_INT32& x, FX_INT32& y) const;
- FX_RECT PWLtoWnd(const CPDF_Rect & rect) const;
- FX_HWND GetAttachedHWnd() const;
-
- FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const;
- FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const;
- const CPWL_Wnd* GetRootWnd() const;
-
- FX_BOOL IsCTRLpressed(FX_DWORD nFlag) const;
- FX_BOOL IsSHIFTpressed(FX_DWORD nFlag) const;
- FX_BOOL IsALTpressed(FX_DWORD nFlag) const;
- FX_BOOL IsINSERTpressed(FX_DWORD nFlag) const;
-
-private:
- void AddChild(CPWL_Wnd * pWnd);
- void RemoveChild(CPWL_Wnd * pWnd);
-
- void CreateScrollBar(const PWL_CREATEPARAM & cp);
- void CreateVScrollBar(const PWL_CREATEPARAM & cp);
-
- void AjustStyle();
- void CreateMsgControl();
- void DestroyMsgControl();
-
- CPWL_MsgControl* GetMsgControl() const;
-
-protected:
- CFX_ArrayTemplate m_aChildren;
-
-private:
- PWL_CREATEPARAM m_sPrivateParam;
-
- CPWL_ScrollBar* m_pVScrollBar;
-
- CPDF_Rect m_rcWindow;
- CPDF_Rect m_rcClip;
-
- FX_BOOL m_bCreated;
- FX_BOOL m_bVisible;
- FX_BOOL m_bNotifying;
- FX_BOOL m_bEnabled;
-};
-
-// #ifndef VK_END
-//
-// #define VK_END 0x23
-// #define VK_HOME 0x24
-// #define VK_LEFT 0x25
-// #define VK_UP 0x26
-// #define VK_RIGHT 0x27
-// #define VK_DOWN 0x28
-// #define VK_INSERT 0x2D
-// #define VK_DELETE 0x2E
-//
-// #define VK_BACK 0x08
-// #define VK_TAB 0x09
-//
-// #define VK_CLEAR 0x0C
-// #define VK_RETURN 0x0D
-// #define VK_ESCAPE 0x1B
-// #define VK_SPACE 0x20
-// #endif
-//
-// #define VK_NONE 0
-
-#endif // !defined(AFX_PWL_WND_H__D32812AD_A875_4E08_9D3C_0A57020987C6__INCLUDED_)
-
-
diff --git a/src/main/jni/include/prof.h b/src/main/jni/include/prof.h
deleted file mode 100755
index 24486127..00000000
--- a/src/main/jni/include/prof.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Part of the android-ndk-profiler library.
- * Copyright (C) Richard Quirk
- *
- * This library is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- */
-#ifndef prof_h_seen
-#define prof_h_seen
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void monstartup(const char *libname);
-void moncleanup(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/main/jni/include/utils/AndroidThreads.h b/src/main/jni/include/utils/AndroidThreads.h
deleted file mode 100644
index 4eee14d7..00000000
--- a/src/main/jni/include/utils/AndroidThreads.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _LIBS_UTILS_ANDROID_THREADS_H
-#define _LIBS_UTILS_ANDROID_THREADS_H
-
-#include
-#include
-
-#if defined(HAVE_PTHREADS)
-# include
-#endif
-
-#include
-
-// ---------------------------------------------------------------------------
-// C API
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Create and run a new thread.
-extern int androidCreateThread(android_thread_func_t, void *);
-
-// Create thread with lots of parameters
-extern int androidCreateThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-// Get some sort of unique identifier for the current thread.
-extern android_thread_id_t androidGetThreadId();
-
-// Low-level thread creation -- never creates threads that can
-// interact with the Java VM.
-extern int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-// set the same of the running thread
-extern void androidSetThreadName(const char* name);
-
-// Used by the Java Runtime to control how threads are created, so that
-// they can be proper and lovely Java threads.
-typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction,
- void *userData,
- const char* threadName,
- int32_t threadPriority,
- size_t threadStackSize,
- android_thread_id_t *threadId);
-
-extern void androidSetCreateThreadFunc(android_create_thread_fn func);
-
-// ------------------------------------------------------------------
-// Extra functions working with raw pids.
-
-// Get pid for the current thread.
-extern pid_t androidGetTid();
-
-#ifdef HAVE_ANDROID_OS
-// Change the priority AND scheduling group of a particular thread. The priority
-// should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION
-// if the priority set failed, else another value if just the group set failed;
-// in either case errno is set. Thread ID zero means current thread.
-extern int androidSetThreadPriority(pid_t tid, int prio);
-
-// Get the current priority of a particular thread. Returns one of the
-// ANDROID_PRIORITY constants or a negative result in case of error.
-extern int androidGetThreadPriority(pid_t tid);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-// ----------------------------------------------------------------------------
-// C++ API
-#ifdef __cplusplus
-namespace android {
-// ----------------------------------------------------------------------------
-
-// Create and run a new thread.
-inline bool createThread(thread_func_t f, void *a) {
- return androidCreateThread(f, a) ? true : false;
-}
-
-// Create thread with lots of parameters
-inline bool createThreadEtc(thread_func_t entryFunction,
- void *userData,
- const char* threadName = "android:unnamed_thread",
- int32_t threadPriority = PRIORITY_DEFAULT,
- size_t threadStackSize = 0,
- thread_id_t *threadId = 0)
-{
- return androidCreateThreadEtc(entryFunction, userData, threadName,
- threadPriority, threadStackSize, threadId) ? true : false;
-}
-
-// Get some sort of unique identifier for the current thread.
-inline thread_id_t getThreadId() {
- return androidGetThreadId();
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-#endif // __cplusplus
-// ----------------------------------------------------------------------------
-
-#endif // _LIBS_UTILS_ANDROID_THREADS_H
diff --git a/src/main/jni/include/utils/Atomic.h b/src/main/jni/include/utils/Atomic.h
deleted file mode 100644
index 7eb476c9..00000000
--- a/src/main/jni/include/utils/Atomic.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2005 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_UTILS_ATOMIC_H
-#define ANDROID_UTILS_ATOMIC_H
-
-#include
-
-#endif // ANDROID_UTILS_ATOMIC_H
diff --git a/src/main/jni/include/utils/BasicHashtable.h b/src/main/jni/include/utils/BasicHashtable.h
deleted file mode 100644
index c235d625..00000000
--- a/src/main/jni/include/utils/BasicHashtable.h
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_BASIC_HASHTABLE_H
-#define ANDROID_BASIC_HASHTABLE_H
-
-#include
-#include
-#include