OLD | NEW |
1 #ifndef __DEFINED__SkPdfJavascriptActionDictionary | 1 #ifndef __DEFINED__SkPdfJavascriptActionDictionary |
2 #define __DEFINED__SkPdfJavascriptActionDictionary | 2 #define __DEFINED__SkPdfJavascriptActionDictionary |
3 | 3 |
4 #include "SkPdfEnums_autogen.h" | 4 #include "SkPdfEnums_autogen.h" |
5 #include "SkPdfArray_autogen.h" | 5 #include "SkPdfArray_autogen.h" |
6 #include "SkPdfDictionary_autogen.h" | 6 #include "SkPdfDictionary_autogen.h" |
7 | 7 |
| 8 // Additional entries specific to a JavaScript action |
8 class SkPdfJavascriptActionDictionary : public SkPdfDictionary { | 9 class SkPdfJavascriptActionDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kJavascriptActionDictionary_S
kPdfObjectType;} | 11 virtual SkPdfObjectType getType() const { return kJavascriptActionDictionary_S
kPdfObjectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kJavascr
iptActionDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kJavascr
iptActionDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfJavascriptActionDictionary* asJavascriptActionDictionary() {retur
n this;} | 14 virtual SkPdfJavascriptActionDictionary* asJavascriptActionDictionary() {retur
n this;} |
14 virtual const SkPdfJavascriptActionDictionary* asJavascriptActionDictionary()
const {return this;} | 15 virtual const SkPdfJavascriptActionDictionary* asJavascriptActionDictionary()
const {return this;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} | 18 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 515 |
515 public: | 516 public: |
516 private: | 517 private: |
517 public: | 518 public: |
518 SkPdfJavascriptActionDictionary(const PdfMemDocument* podofoDoc = NULL, const
PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfJavascriptActionDictionary(const PdfMemDocument* podofoDoc = NULL, const
PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfJavascriptActionDictionary& operator=(const SkPdfJavascriptActionDictiona
ry& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoOb
j; return *this;} | 523 SkPdfJavascriptActionDictionary& operator=(const SkPdfJavascriptActionDictiona
ry& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoOb
j; return *this;} |
523 | 524 |
| 525 /** (Required) The type of action that this dictionary describes; must be JavaSc
ript |
| 526 * for a JavaScript action. |
| 527 **/ |
| 528 bool has_S() const { |
| 529 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "
", NULL)); |
| 530 } |
| 531 |
524 std::string S() const { | 532 std::string S() const { |
525 std::string ret; | 533 std::string ret; |
526 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "", &re
t)) return ret; | 534 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "", &re
t)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 535 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return ""; | 536 return ""; |
529 } | 537 } |
530 | 538 |
| 539 /** (Required) A string or stream containing the JavaScript script to be execute
d. |
| 540 * Note: PDFDocEncoding or Unicode encoding (the latter identified by the Unico
de |
| 541 * prefix U+ FEFF) is used to encode the contents of the string or stream. (See
imple- |
| 542 * mentation note 89 in Appendix H.) |
| 543 **/ |
| 544 bool has_JS() const { |
| 545 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS",
"", NULL)); |
| 546 } |
| 547 |
531 bool isJSAString() const { | 548 bool isJSAString() const { |
532 SkPdfObject* ret = NULL; | 549 SkPdfObject* ret = NULL; |
533 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return false; | 550 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return false; |
534 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; | 551 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; |
535 } | 552 } |
536 | 553 |
537 std::string getJSAsString() const { | 554 std::string getJSAsString() const { |
538 std::string ret = ""; | 555 std::string ret = ""; |
539 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return ret; | 556 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return ret; |
540 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 557 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
541 return ""; | 558 return ""; |
542 } | 559 } |
543 | 560 |
544 bool isJSAStream() const { | 561 bool isJSAStream() const { |
545 SkPdfObject* ret = NULL; | 562 SkPdfObject* ret = NULL; |
546 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return false; | 563 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return false; |
547 return ret->podofo()->HasStream(); | 564 return ret->podofo()->HasStream(); |
548 } | 565 } |
549 | 566 |
550 SkPdfStream getJSAsStream() const { | 567 SkPdfStream getJSAsStream() const { |
551 SkPdfStream ret = SkPdfStream(); | 568 SkPdfStream ret = SkPdfStream(); |
552 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return ret; | 569 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "JS", "",
&ret)) return ret; |
553 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 570 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
554 return SkPdfStream(); | 571 return SkPdfStream(); |
555 } | 572 } |
556 | 573 |
557 }; | 574 }; |
558 | 575 |
559 #endif // __DEFINED__SkPdfJavascriptActionDictionary | 576 #endif // __DEFINED__SkPdfJavascriptActionDictionary |
OLD | NEW |