| OLD | NEW |
| 1 #ifndef __DEFINED__SkPdfJavascriptDictionary | 1 #ifndef __DEFINED__SkPdfJavascriptDictionary |
| 2 #define __DEFINED__SkPdfJavascriptDictionary | 2 #define __DEFINED__SkPdfJavascriptDictionary |
| 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 // Entries in the JavaScript dictionary |
| 8 class SkPdfJavascriptDictionary : public SkPdfDictionary { | 9 class SkPdfJavascriptDictionary : public SkPdfDictionary { |
| 9 public: | 10 public: |
| 10 virtual SkPdfObjectType getType() const { return kJavascriptDictionary_SkPdfOb
jectType;} | 11 virtual SkPdfObjectType getType() const { return kJavascriptDictionary_SkPdfOb
jectType;} |
| 11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kJavascr
iptDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kJavascr
iptDictionary_SkPdfObjectType + 1);} |
| 12 public: | 13 public: |
| 13 virtual SkPdfJavascriptDictionary* asJavascriptDictionary() {return this;} | 14 virtual SkPdfJavascriptDictionary* asJavascriptDictionary() {return this;} |
| 14 virtual const SkPdfJavascriptDictionary* asJavascriptDictionary() const {retur
n this;} | 15 virtual const SkPdfJavascriptDictionary* asJavascriptDictionary() const {retur
n 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 SkPdfJavascriptDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObj
ect* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfJavascriptDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObj
ect* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
| 519 | 520 |
| 520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
| 521 | 522 |
| 522 SkPdfJavascriptDictionary& operator=(const SkPdfJavascriptDictionary& from) {t
his->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *t
his;} | 523 SkPdfJavascriptDictionary& operator=(const SkPdfJavascriptDictionary& from) {t
his->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *t
his;} |
| 523 | 524 |
| 525 /** (Optional) A string or stream containing a JavaScript script to be executed |
| 526 * just before the FDF file is imported. |
| 527 **/ |
| 528 bool has_Before() const { |
| 529 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Befor
e", "", NULL)); |
| 530 } |
| 531 |
| 524 bool isBeforeAString() const { | 532 bool isBeforeAString() const { |
| 525 SkPdfObject* ret = NULL; | 533 SkPdfObject* ret = NULL; |
| 526 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return false; | 534 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return false; |
| 527 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; | 535 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; |
| 528 } | 536 } |
| 529 | 537 |
| 530 std::string getBeforeAsString() const { | 538 std::string getBeforeAsString() const { |
| 531 std::string ret = ""; | 539 std::string ret = ""; |
| 532 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return ret; | 540 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return ret; |
| 533 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 541 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 534 return ""; | 542 return ""; |
| 535 } | 543 } |
| 536 | 544 |
| 537 bool isBeforeAStream() const { | 545 bool isBeforeAStream() const { |
| 538 SkPdfObject* ret = NULL; | 546 SkPdfObject* ret = NULL; |
| 539 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return false; | 547 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return false; |
| 540 return ret->podofo()->HasStream(); | 548 return ret->podofo()->HasStream(); |
| 541 } | 549 } |
| 542 | 550 |
| 543 SkPdfStream getBeforeAsStream() const { | 551 SkPdfStream getBeforeAsStream() const { |
| 544 SkPdfStream ret = SkPdfStream(); | 552 SkPdfStream ret = SkPdfStream(); |
| 545 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return ret; | 553 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Before",
"", &ret)) return ret; |
| 546 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 554 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 547 return SkPdfStream(); | 555 return SkPdfStream(); |
| 548 } | 556 } |
| 549 | 557 |
| 558 /** (Optional) A string or stream containing a JavaScript script to be executed |
| 559 * just after the FDF file is imported. |
| 560 **/ |
| 561 bool has_After() const { |
| 562 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After
", "", NULL)); |
| 563 } |
| 564 |
| 550 bool isAfterAString() const { | 565 bool isAfterAString() const { |
| 551 SkPdfObject* ret = NULL; | 566 SkPdfObject* ret = NULL; |
| 552 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After",
"", &ret)) return false; | 567 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After",
"", &ret)) return false; |
| 553 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; | 568 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; |
| 554 } | 569 } |
| 555 | 570 |
| 556 std::string getAfterAsString() const { | 571 std::string getAfterAsString() const { |
| 557 std::string ret = ""; | 572 std::string ret = ""; |
| 558 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After", "
", &ret)) return ret; | 573 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After", "
", &ret)) return ret; |
| 559 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 574 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 560 return ""; | 575 return ""; |
| 561 } | 576 } |
| 562 | 577 |
| 563 bool isAfterAStream() const { | 578 bool isAfterAStream() const { |
| 564 SkPdfObject* ret = NULL; | 579 SkPdfObject* ret = NULL; |
| 565 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After",
"", &ret)) return false; | 580 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After",
"", &ret)) return false; |
| 566 return ret->podofo()->HasStream(); | 581 return ret->podofo()->HasStream(); |
| 567 } | 582 } |
| 568 | 583 |
| 569 SkPdfStream getAfterAsStream() const { | 584 SkPdfStream getAfterAsStream() const { |
| 570 SkPdfStream ret = SkPdfStream(); | 585 SkPdfStream ret = SkPdfStream(); |
| 571 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After", "
", &ret)) return ret; | 586 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "After", "
", &ret)) return ret; |
| 572 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 587 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 573 return SkPdfStream(); | 588 return SkPdfStream(); |
| 574 } | 589 } |
| 575 | 590 |
| 591 /** (Optional) An array defining additional JavaScript scripts to be added to |
| 592 * those defined in the JavaScript entry of the document's name dictionary (see |
| 593 * Section 3.6.3, "Name Dictionary"). The array contains an even number of |
| 594 * elements, organized in pairs. The first element of each pair is a name and t
he |
| 595 * second is a string or stream defining the script corresponding to that name. |
| 596 * Each of the defined scripts will be added to those already defined in the na
me |
| 597 * dictionary and then executed before the script defined in the Before entry i
s |
| 598 * executed. As described in "JavaScript Actions" on page 556, these scripts ar
e |
| 599 * used to define JavaScript functions for use by other scripts in the document
. |
| 600 **/ |
| 601 bool has_Doc() const { |
| 602 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Doc",
"", NULL)); |
| 603 } |
| 604 |
| 576 SkPdfArray Doc() const { | 605 SkPdfArray Doc() const { |
| 577 SkPdfArray ret; | 606 SkPdfArray ret; |
| 578 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Doc", "",
&ret)) return ret; | 607 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Doc", "",
&ret)) return ret; |
| 579 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 608 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 580 return SkPdfArray(); | 609 return SkPdfArray(); |
| 581 } | 610 } |
| 582 | 611 |
| 583 }; | 612 }; |
| 584 | 613 |
| 585 #endif // __DEFINED__SkPdfJavascriptDictionary | 614 #endif // __DEFINED__SkPdfJavascriptDictionary |
| OLD | NEW |