diff options
author | Paul Gardiner <paul@glidos.net> | 2012-05-28 13:51:30 +0100 |
---|---|---|
committer | Paul Gardiner <paul@glidos.net> | 2012-05-28 13:51:30 +0100 |
commit | 741fe4a4d7bbd6ee914504be7e85356a741601c4 (patch) | |
tree | c25f6f4ea0d06c97fe4b021571a7a897eef856f5 /pdf/pdf_jsimp_v8.cpp | |
parent | fa5ee3a96cb4cb184cf6cc807a67632666b936bf (diff) | |
download | mupdf-741fe4a4d7bbd6ee914504be7e85356a741601c4.tar.xz |
Forms: implement JavaScript Field methods setFillColor and setTextColor
Diffstat (limited to 'pdf/pdf_jsimp_v8.cpp')
-rw-r--r-- | pdf/pdf_jsimp_v8.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pdf/pdf_jsimp_v8.cpp b/pdf/pdf_jsimp_v8.cpp index 8c03ef9e..27eb0a12 100644 --- a/pdf/pdf_jsimp_v8.cpp +++ b/pdf/pdf_jsimp_v8.cpp @@ -156,6 +156,11 @@ public: return **utf8; } + double toNumber() + { + return pobj->NumberValue(); + } + Handle<Value> toValue() { return pobj; @@ -360,6 +365,28 @@ extern "C" char *pdf_jsimp_toString_cpp(pdf_jsimp *imp, pdf_jsimp_obj *obj, char return NULL; } +extern "C" char *pdf_jsimp_toNumber_cpp(pdf_jsimp *imp, pdf_jsimp_obj *obj, double *num) +{ + *num = reinterpret_cast<PDFJSImpObject *>(obj)->toNumber(); + return NULL; +} + +extern "C" char *pdf_jsimp_array_len_cpp(pdf_jsimp *imp, pdf_jsimp_obj *obj, int *len) +{ + Local<Value> val = reinterpret_cast<PDFJSImpObject *>(obj)->toValue()->ToObject(); + Local<Array> arr = Local<Array>::Cast(val); + *len = arr->Length(); + return NULL; +} + +extern "C" char *pdf_jsimp_array_item_cpp(pdf_jsimp *imp, pdf_jsimp_obj *obj, int i, pdf_jsimp_obj **item) +{ + Local<Value> val = reinterpret_cast<PDFJSImpObject *>(obj)->toValue()->ToObject(); + Local<Array> arr = Local<Array>::Cast(val); + *item = reinterpret_cast<pdf_jsimp_obj *>(new PDFJSImpObject(arr->Get(Number::New(i)))); + return NULL; +} + extern "C" char *pdf_jsimp_execute_cpp(pdf_jsimp *imp, char *code) { PDFJSImp *vImp = reinterpret_cast<PDFJSImp *>(imp); |