summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_imagedata.cpp
blob: cacbf9558dcdee7a26e21b0438dce95c95e4d955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "xfa/fxfa/parser/cxfa_imagedata.h"

#include "xfa/fxfa/parser/cxfa_node.h"

CXFA_ImageData::CXFA_ImageData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}

XFA_AttributeEnum CXFA_ImageData::GetAspect() const {
  return m_pNode->JSObject()->GetEnum(XFA_Attribute::Aspect);
}

WideString CXFA_ImageData::GetContentType() const {
  return m_pNode->JSObject()
      ->TryCData(XFA_Attribute::ContentType, true)
      .value_or(L"");
}

WideString CXFA_ImageData::GetHref() const {
  return m_pNode->JSObject()->TryCData(XFA_Attribute::Href, true).value_or(L"");
}

XFA_AttributeEnum CXFA_ImageData::GetTransferEncoding() const {
  return static_cast<XFA_AttributeEnum>(
      m_pNode->JSObject()->GetEnum(XFA_Attribute::TransferEncoding));
}

WideString CXFA_ImageData::GetContent() const {
  return m_pNode->JSObject()->TryContent(false, true).value_or(L"");
}

void CXFA_ImageData::SetContentType(const WideString& wsContentType) {
  m_pNode->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType,
                                false, false);
}

void CXFA_ImageData::SetHref(const WideString& wsHref) {
  m_pNode->JSObject()->SetCData(XFA_Attribute::Href, wsHref, false, false);
}

void CXFA_ImageData::SetTransferEncoding(XFA_AttributeEnum iTransferEncoding) {
  m_pNode->JSObject()->SetEnum(XFA_Attribute::TransferEncoding,
                               iTransferEncoding, false);
}