Home | History | Annotate | Download | only in pdfapi
      1 /*
      2  * Copyright 2013 Google Inc.
      3 
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #include "SkPdfInteractiveFormDictionary_autogen.h"
      9 #include "SkPdfNativeDoc.h"
     10 
     11 SkPdfArray* SkPdfInteractiveFormDictionary::Fields(SkPdfNativeDoc* doc) {
     12   SkPdfNativeObject* ret = get("Fields", "");
     13   if (doc) {ret = doc->resolveReference(ret);}
     14   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
     15   // TODO(edisonn): warn about missing required field, assert for known good pdfs
     16   return NULL;
     17 }
     18 
     19 bool SkPdfInteractiveFormDictionary::has_Fields() const {
     20   return get("Fields", "") != NULL;
     21 }
     22 
     23 bool SkPdfInteractiveFormDictionary::NeedAppearances(SkPdfNativeDoc* doc) {
     24   SkPdfNativeObject* ret = get("NeedAppearances", "");
     25   if (doc) {ret = doc->resolveReference(ret);}
     26   if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
     27   // TODO(edisonn): warn about missing default value for optional fields
     28   return false;
     29 }
     30 
     31 bool SkPdfInteractiveFormDictionary::has_NeedAppearances() const {
     32   return get("NeedAppearances", "") != NULL;
     33 }
     34 
     35 int64_t SkPdfInteractiveFormDictionary::SigFlags(SkPdfNativeDoc* doc) {
     36   SkPdfNativeObject* ret = get("SigFlags", "");
     37   if (doc) {ret = doc->resolveReference(ret);}
     38   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
     39   // TODO(edisonn): warn about missing default value for optional fields
     40   return 0;
     41 }
     42 
     43 bool SkPdfInteractiveFormDictionary::has_SigFlags() const {
     44   return get("SigFlags", "") != NULL;
     45 }
     46 
     47 SkPdfArray* SkPdfInteractiveFormDictionary::CO(SkPdfNativeDoc* doc) {
     48   SkPdfNativeObject* ret = get("CO", "");
     49   if (doc) {ret = doc->resolveReference(ret);}
     50   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
     51   // TODO(edisonn): warn about missing default value for optional fields
     52   return NULL;
     53 }
     54 
     55 bool SkPdfInteractiveFormDictionary::has_CO() const {
     56   return get("CO", "") != NULL;
     57 }
     58 
     59 SkPdfDictionary* SkPdfInteractiveFormDictionary::DR(SkPdfNativeDoc* doc) {
     60   SkPdfNativeObject* ret = get("DR", "");
     61   if (doc) {ret = doc->resolveReference(ret);}
     62   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
     63   // TODO(edisonn): warn about missing default value for optional fields
     64   return NULL;
     65 }
     66 
     67 bool SkPdfInteractiveFormDictionary::has_DR() const {
     68   return get("DR", "") != NULL;
     69 }
     70 
     71 SkString SkPdfInteractiveFormDictionary::DA(SkPdfNativeDoc* doc) {
     72   SkPdfNativeObject* ret = get("DA", "");
     73   if (doc) {ret = doc->resolveReference(ret);}
     74   if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
     75   // TODO(edisonn): warn about missing default value for optional fields
     76   return SkString();
     77 }
     78 
     79 bool SkPdfInteractiveFormDictionary::has_DA() const {
     80   return get("DA", "") != NULL;
     81 }
     82 
     83 int64_t SkPdfInteractiveFormDictionary::Q(SkPdfNativeDoc* doc) {
     84   SkPdfNativeObject* ret = get("Q", "");
     85   if (doc) {ret = doc->resolveReference(ret);}
     86   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
     87   // TODO(edisonn): warn about missing default value for optional fields
     88   return 0;
     89 }
     90 
     91 bool SkPdfInteractiveFormDictionary::has_Q() const {
     92   return get("Q", "") != NULL;
     93 }
     94