13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/* 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2013 Google Inc. 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Use of this source code is governed by a BSD-style license that can be 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * found in the LICENSE file. 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry */ 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "SkPdfPrinterMarkAnnotationDictionary_autogen.h" 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "SkPdfNativeDoc.h" 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 113c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySkString SkPdfPrinterMarkAnnotationDictionary::Subtype(SkPdfNativeDoc* doc) { 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SkPdfNativeObject* ret = get("Subtype", ""); 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (doc) {ret = doc->resolveReference(ret);} 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2(); 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // TODO(edisonn): warn about missing required field, assert for known good pdfs 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return SkString(); 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool SkPdfPrinterMarkAnnotationDictionary::has_Subtype() const { 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return get("Subtype", "") != NULL; 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 233c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySkString SkPdfPrinterMarkAnnotationDictionary::MN(SkPdfNativeDoc* doc) { 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SkPdfNativeObject* ret = get("MN", ""); 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (doc) {ret = doc->resolveReference(ret);} 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2(); 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // TODO(edisonn): warn about missing default value for optional fields 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return SkString(); 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool SkPdfPrinterMarkAnnotationDictionary::has_MN() const { 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return get("MN", "") != NULL; 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry