• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "fxjs/xfa/cjx_draw.h"
8 
9 #include "fxjs/cfxjse_value.h"
10 #include "xfa/fxfa/cxfa_widgetacc.h"
11 #include "xfa/fxfa/parser/cxfa_draw.h"
12 
CJX_Draw(CXFA_Draw * node)13 CJX_Draw::CJX_Draw(CXFA_Draw* node) : CJX_Container(node) {}
14 
15 CJX_Draw::~CJX_Draw() = default;
16 
h(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)17 void CJX_Draw::h(CFXJSE_Value* pValue,
18                  bool bSetting,
19                  XFA_Attribute eAttribute) {
20   Script_Attribute_String(pValue, bSetting, eAttribute);
21 }
22 
w(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)23 void CJX_Draw::w(CFXJSE_Value* pValue,
24                  bool bSetting,
25                  XFA_Attribute eAttribute) {
26   Script_Attribute_String(pValue, bSetting, eAttribute);
27 }
28 
x(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)29 void CJX_Draw::x(CFXJSE_Value* pValue,
30                  bool bSetting,
31                  XFA_Attribute eAttribute) {
32   Script_Attribute_String(pValue, bSetting, eAttribute);
33 }
34 
y(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)35 void CJX_Draw::y(CFXJSE_Value* pValue,
36                  bool bSetting,
37                  XFA_Attribute eAttribute) {
38   Script_Attribute_String(pValue, bSetting, eAttribute);
39 }
40 
hAlign(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)41 void CJX_Draw::hAlign(CFXJSE_Value* pValue,
42                       bool bSetting,
43                       XFA_Attribute eAttribute) {
44   Script_Attribute_String(pValue, bSetting, eAttribute);
45 }
46 
use(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)47 void CJX_Draw::use(CFXJSE_Value* pValue,
48                    bool bSetting,
49                    XFA_Attribute eAttribute) {
50   Script_Attribute_String(pValue, bSetting, eAttribute);
51 }
52 
rotate(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)53 void CJX_Draw::rotate(CFXJSE_Value* pValue,
54                       bool bSetting,
55                       XFA_Attribute eAttribute) {
56   Script_Attribute_String(pValue, bSetting, eAttribute);
57 }
58 
presence(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)59 void CJX_Draw::presence(CFXJSE_Value* pValue,
60                         bool bSetting,
61                         XFA_Attribute eAttribute) {
62   Script_Attribute_String(pValue, bSetting, eAttribute);
63 }
64 
vAlign(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)65 void CJX_Draw::vAlign(CFXJSE_Value* pValue,
66                       bool bSetting,
67                       XFA_Attribute eAttribute) {
68   Script_Attribute_String(pValue, bSetting, eAttribute);
69 }
70 
maxH(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)71 void CJX_Draw::maxH(CFXJSE_Value* pValue,
72                     bool bSetting,
73                     XFA_Attribute eAttribute) {
74   Script_Attribute_String(pValue, bSetting, eAttribute);
75 }
76 
maxW(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)77 void CJX_Draw::maxW(CFXJSE_Value* pValue,
78                     bool bSetting,
79                     XFA_Attribute eAttribute) {
80   Script_Attribute_String(pValue, bSetting, eAttribute);
81 }
82 
minH(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)83 void CJX_Draw::minH(CFXJSE_Value* pValue,
84                     bool bSetting,
85                     XFA_Attribute eAttribute) {
86   Script_Attribute_String(pValue, bSetting, eAttribute);
87 }
88 
minW(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)89 void CJX_Draw::minW(CFXJSE_Value* pValue,
90                     bool bSetting,
91                     XFA_Attribute eAttribute) {
92   Script_Attribute_String(pValue, bSetting, eAttribute);
93 }
94 
relevant(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)95 void CJX_Draw::relevant(CFXJSE_Value* pValue,
96                         bool bSetting,
97                         XFA_Attribute eAttribute) {
98   Script_Attribute_String(pValue, bSetting, eAttribute);
99 }
100 
rawValue(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)101 void CJX_Draw::rawValue(CFXJSE_Value* pValue,
102                         bool bSetting,
103                         XFA_Attribute eAttribute) {
104   defaultValue(pValue, bSetting, eAttribute);
105 }
106 
defaultValue(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)107 void CJX_Draw::defaultValue(CFXJSE_Value* pValue,
108                             bool bSetting,
109                             XFA_Attribute eAttribute) {
110   if (!bSetting) {
111     WideString content = GetContent(true);
112     if (content.IsEmpty())
113       pValue->SetNull();
114     else
115       pValue->SetString(content.UTF8Encode().AsStringView());
116 
117     return;
118   }
119 
120   if (!pValue || !pValue->IsString())
121     return;
122 
123   XFA_Element uiType = GetXFANode()->GetWidgetAcc()->GetUIType();
124   if (uiType != XFA_Element::Text)
125     return;
126 
127   WideString wsNewValue = pValue->ToWideString();
128   SetContent(wsNewValue, wsNewValue, true, true, true);
129 }
130 
colSpan(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)131 void CJX_Draw::colSpan(CFXJSE_Value* pValue,
132                        bool bSetting,
133                        XFA_Attribute eAttribute) {
134   Script_Attribute_String(pValue, bSetting, eAttribute);
135 }
136 
usehref(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)137 void CJX_Draw::usehref(CFXJSE_Value* pValue,
138                        bool bSetting,
139                        XFA_Attribute eAttribute) {
140   Script_Attribute_String(pValue, bSetting, eAttribute);
141 }
142 
locale(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)143 void CJX_Draw::locale(CFXJSE_Value* pValue,
144                       bool bSetting,
145                       XFA_Attribute eAttribute) {
146   Script_Attribute_String(pValue, bSetting, eAttribute);
147 }
148 
anchorType(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)149 void CJX_Draw::anchorType(CFXJSE_Value* pValue,
150                           bool bSetting,
151                           XFA_Attribute eAttribute) {
152   Script_Attribute_String(pValue, bSetting, eAttribute);
153 }
154