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