Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: fpdfsdk/fsdk_baseform.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fsdk_annothandler.cpp ('k') | fpdfsdk/fsdk_mgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/include/fsdk_baseform.h" 7 #include "fpdfsdk/include/fsdk_baseform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 , 45 ,
46 m_hMixXFAWidget(NULL), 46 m_hMixXFAWidget(NULL),
47 m_pWidgetHandler(NULL) 47 m_pWidgetHandler(NULL)
48 #endif // PDF_ENABLE_XFA 48 #endif // PDF_ENABLE_XFA
49 { 49 {
50 } 50 }
51 51
52 CPDFSDK_Widget::~CPDFSDK_Widget() {} 52 CPDFSDK_Widget::~CPDFSDK_Widget() {}
53 53
54 #ifdef PDF_ENABLE_XFA 54 #ifdef PDF_ENABLE_XFA
55 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const { 55 CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
56 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 56 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
57 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 57 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
58 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 58 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
59 if (!m_hMixXFAWidget) { 59 if (!m_hMixXFAWidget) {
60 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 60 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
61 CFX_WideString sName; 61 CFX_WideString sName;
62 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) { 62 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
63 sName = GetAnnotName(); 63 sName = GetAnnotName();
64 if (sName.IsEmpty()) 64 if (sName.IsEmpty())
65 sName = GetName(); 65 sName = GetName();
66 } else { 66 } else {
67 sName = GetName(); 67 sName = GetName();
68 } 68 }
69 69
70 if (!sName.IsEmpty()) 70 if (!sName.IsEmpty())
71 m_hMixXFAWidget = pDocView->GetWidgetByName(sName); 71 m_hMixXFAWidget = pDocView->GetWidgetByName(sName);
72 } 72 }
73 } 73 }
74 return m_hMixXFAWidget; 74 return m_hMixXFAWidget;
75 } 75 }
76 76
77 return NULL; 77 return NULL;
78 } 78 }
79 79
80 IXFA_Widget* CPDFSDK_Widget::GetGroupMixXFAWidget() { 80 CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
81 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 81 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
82 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 82 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
83 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 83 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
84 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 84 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
85 CFX_WideString sName = GetName(); 85 CFX_WideString sName = GetName();
86 if (!sName.IsEmpty()) 86 if (!sName.IsEmpty())
87 return pDocView->GetWidgetByName(sName); 87 return pDocView->GetWidgetByName(sName);
88 } 88 }
89 } 89 }
90 90
91 return nullptr; 91 return nullptr;
92 } 92 }
93 93
94 IXFA_WidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const { 94 CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
95 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 95 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
96 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 96 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
97 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 97 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
98 if (!m_pWidgetHandler) { 98 if (!m_pWidgetHandler) {
99 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 99 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
100 m_pWidgetHandler = pDocView->GetWidgetHandler(); 100 m_pWidgetHandler = pDocView->GetWidgetHandler();
101 } 101 }
102 } 102 }
103 return m_pWidgetHandler; 103 return m_pWidgetHandler;
104 } 104 }
105 105
106 return NULL; 106 return NULL;
107 } 107 }
108 108
109 static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) { 109 static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 case CPDF_AAction::DocumentSaved: 175 case CPDF_AAction::DocumentSaved:
176 case CPDF_AAction::PrintDocument: 176 case CPDF_AAction::PrintDocument:
177 case CPDF_AAction::DocumentPrinted: 177 case CPDF_AAction::DocumentPrinted:
178 break; 178 break;
179 } 179 }
180 180
181 return eEventType; 181 return eEventType;
182 } 182 }
183 183
184 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { 184 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) {
185 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 185 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
186 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 186 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
187 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); 187 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
188 188
189 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && 189 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
190 GetFieldType() == FIELDTYPE_RADIOBUTTON) { 190 GetFieldType() == FIELDTYPE_RADIOBUTTON) {
191 if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWidget()) { 191 if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) {
192 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget); 192 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget);
193 if (pXFAWidgetHandler->HasEvent(pAcc, eEventType)) 193 if (pXFAWidgetHandler->HasEvent(pAcc, eEventType))
194 return TRUE; 194 return TRUE;
195 } 195 }
196 } 196 }
197 197
198 { 198 {
199 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget); 199 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget);
200 return pXFAWidgetHandler->HasEvent(pAcc, eEventType); 200 return pXFAWidgetHandler->HasEvent(pAcc, eEventType);
201 } 201 }
202 } 202 }
203 } 203 }
204 204
205 return FALSE; 205 return FALSE;
206 } 206 }
207 207
208 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, 208 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
209 PDFSDK_FieldAction& data, 209 PDFSDK_FieldAction& data,
210 CPDFSDK_PageView* pPageView) { 210 CPDFSDK_PageView* pPageView) {
211 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 211 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
212 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 212 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
213 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 213 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
214 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); 214 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
215 215
216 if (eEventType != XFA_EVENT_Unknown) { 216 if (eEventType != XFA_EVENT_Unknown) {
217 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 217 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
218 CXFA_EventParam param; 218 CXFA_EventParam param;
219 param.m_eType = eEventType; 219 param.m_eType = eEventType;
220 param.m_wsChange = data.sChange; 220 param.m_wsChange = data.sChange;
221 param.m_iCommitKey = data.nCommitKey; 221 param.m_iCommitKey = data.nCommitKey;
222 param.m_bShift = data.bShift; 222 param.m_bShift = data.bShift;
223 param.m_iSelStart = data.nSelStart; 223 param.m_iSelStart = data.nSelStart;
224 param.m_iSelEnd = data.nSelEnd; 224 param.m_iSelEnd = data.nSelEnd;
225 param.m_wsFullText = data.sValue; 225 param.m_wsFullText = data.sValue;
226 param.m_bKeyDown = data.bKeyDown; 226 param.m_bKeyDown = data.bKeyDown;
227 param.m_bModifier = data.bModifier; 227 param.m_bModifier = data.bModifier;
228 param.m_wsNewText = data.sValue; 228 param.m_wsNewText = data.sValue;
229 if (data.nSelEnd > data.nSelStart) 229 if (data.nSelEnd > data.nSelStart)
230 param.m_wsNewText.Delete(data.nSelStart, 230 param.m_wsNewText.Delete(data.nSelStart,
231 data.nSelEnd - data.nSelStart); 231 data.nSelEnd - data.nSelStart);
232 for (int i = 0; i < data.sChange.GetLength(); i++) 232 for (int i = 0; i < data.sChange.GetLength(); i++)
233 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]); 233 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]);
234 param.m_wsPrevText = data.sValue; 234 param.m_wsPrevText = data.sValue;
235 235
236 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && 236 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
237 GetFieldType() == FIELDTYPE_RADIOBUTTON) { 237 GetFieldType() == FIELDTYPE_RADIOBUTTON) {
238 if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWidget()) { 238 if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) {
239 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget); 239 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget);
240 param.m_pTarget = pAcc; 240 param.m_pTarget = pAcc;
241 if (pXFAWidgetHandler->ProcessEvent(pAcc, &param) != 241 if (pXFAWidgetHandler->ProcessEvent(pAcc, &param) !=
242 XFA_EVENTERROR_Success) { 242 XFA_EVENTERROR_Success) {
243 return FALSE; 243 return FALSE;
244 } 244 }
245 } 245 }
246 } 246 }
247 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget); 247 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget);
248 param.m_pTarget = pAcc; 248 param.m_pTarget = pAcc;
249 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param); 249 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
250 250
251 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 251 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
252 pDocView->UpdateDocView(); 252 pDocView->UpdateDocView();
253 } 253 }
254 return nRet == XFA_EVENTERROR_Success; 254 return nRet == XFA_EVENTERROR_Success;
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 return FALSE; 259 return FALSE;
260 } 260 }
261 261
262 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { 262 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
263 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 263 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
264 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 264 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
265 CPDF_FormField* pFormField = GetFormField(); 265 CPDF_FormField* pFormField = GetFormField();
266 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 266 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
267 switch (GetFieldType()) { 267 switch (GetFieldType()) {
268 case FIELDTYPE_CHECKBOX: 268 case FIELDTYPE_CHECKBOX:
269 case FIELDTYPE_RADIOBUTTON: { 269 case FIELDTYPE_RADIOBUTTON: {
270 CPDF_FormControl* pFormCtrl = GetFormControl(); 270 CPDF_FormControl* pFormCtrl = GetFormControl();
271 XFA_CHECKSTATE eCheckState = 271 XFA_CHECKSTATE eCheckState =
272 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; 272 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
273 pWidgetAcc->SetCheckState(eCheckState); 273 pWidgetAcc->SetCheckState(eCheckState);
274 } break; 274 } break;
(...skipping 28 matching lines...) Expand all
303 if (bSynchronizeElse) 303 if (bSynchronizeElse)
304 pWidgetAcc->ProcessValueChanged(); 304 pWidgetAcc->ProcessValueChanged();
305 } 305 }
306 } 306 }
307 } 307 }
308 } 308 }
309 309
310 void CPDFSDK_Widget::SynchronizeXFAValue() { 310 void CPDFSDK_Widget::SynchronizeXFAValue() {
311 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 311 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
312 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 312 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
313 IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); 313 CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
314 if (!pXFADocView) 314 if (!pXFADocView)
315 return; 315 return;
316 316
317 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 317 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
318 if (GetXFAWidgetHandler()) { 318 if (GetXFAWidgetHandler()) {
319 CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget, GetFormField(), 319 CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget, GetFormField(),
320 GetFormControl()); 320 GetFormControl());
321 } 321 }
322 } 322 }
323 } 323 }
324 324
325 void CPDFSDK_Widget::SynchronizeXFAItems() { 325 void CPDFSDK_Widget::SynchronizeXFAItems() {
326 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 326 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
327 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 327 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
328 IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); 328 CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
329 if (!pXFADocView) 329 if (!pXFADocView)
330 return; 330 return;
331 331
332 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 332 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
333 if (GetXFAWidgetHandler()) 333 if (GetXFAWidgetHandler())
334 SynchronizeXFAItems(pXFADocView, hWidget, GetFormField(), nullptr); 334 SynchronizeXFAItems(pXFADocView, hWidget, GetFormField(), nullptr);
335 } 335 }
336 } 336 }
337 337
338 void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView, 338 void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
339 IXFA_Widget* hWidget, 339 CXFA_FFWidget* hWidget,
340 CPDF_FormField* pFormField, 340 CPDF_FormField* pFormField,
341 CPDF_FormControl* pFormControl) { 341 CPDF_FormControl* pFormControl) {
342 ASSERT(hWidget); 342 ASSERT(hWidget);
343 343
344 if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandler()) { 344 if (CXFA_FFWidgetHandler* pXFAWidgetHandler =
345 pXFADocView->GetWidgetHandler()) {
345 ASSERT(pFormControl); 346 ASSERT(pFormControl);
346 347
347 switch (pFormField->GetFieldType()) { 348 switch (pFormField->GetFieldType()) {
348 case FIELDTYPE_CHECKBOX: { 349 case FIELDTYPE_CHECKBOX: {
349 if (CXFA_WidgetAcc* pWidgetAcc = 350 if (CXFA_WidgetAcc* pWidgetAcc =
350 pXFAWidgetHandler->GetDataAcc(hWidget)) { 351 pXFAWidgetHandler->GetDataAcc(hWidget)) {
351 pFormField->CheckControl( 352 pFormField->CheckControl(
352 pFormField->GetControlIndex(pFormControl), 353 pFormField->GetControlIndex(pFormControl),
353 pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true); 354 pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true);
354 } 355 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 401
401 CFX_WideString sValue; 402 CFX_WideString sValue;
402 pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); 403 pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
403 pFormField->SetValue(sValue, TRUE); 404 pFormField->SetValue(sValue, TRUE);
404 } 405 }
405 } break; 406 } break;
406 } 407 }
407 } 408 }
408 } 409 }
409 410
410 void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView, 411 void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
411 IXFA_Widget* hWidget, 412 CXFA_FFWidget* hWidget,
412 CPDF_FormField* pFormField, 413 CPDF_FormField* pFormField,
413 CPDF_FormControl* pFormControl) { 414 CPDF_FormControl* pFormControl) {
414 ASSERT(hWidget); 415 ASSERT(hWidget);
415 416
416 if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandler()) { 417 if (CXFA_FFWidgetHandler* pXFAWidgetHandler =
418 pXFADocView->GetWidgetHandler()) {
417 switch (pFormField->GetFieldType()) { 419 switch (pFormField->GetFieldType()) {
418 case FIELDTYPE_LISTBOX: { 420 case FIELDTYPE_LISTBOX: {
419 pFormField->ClearSelection(FALSE); 421 pFormField->ClearSelection(FALSE);
420 pFormField->ClearOptions(TRUE); 422 pFormField->ClearOptions(TRUE);
421 423
422 if (CXFA_WidgetAcc* pWidgetAcc = 424 if (CXFA_WidgetAcc* pWidgetAcc =
423 pXFAWidgetHandler->GetDataAcc(hWidget)) { 425 pXFAWidgetHandler->GetDataAcc(hWidget)) {
424 for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; 426 for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz;
425 i++) { 427 i++) {
426 CFX_WideString swText; 428 CFX_WideString swText;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); 587 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance();
586 CFX_ByteString csFont = ""; 588 CFX_ByteString csFont = "";
587 FX_FLOAT fFontSize = 0.0f; 589 FX_FLOAT fFontSize = 0.0f;
588 pDa.GetFont(csFont, fFontSize); 590 pDa.GetFont(csFont, fFontSize);
589 591
590 return fFontSize; 592 return fFontSize;
591 } 593 }
592 594
593 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { 595 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
594 #ifdef PDF_ENABLE_XFA 596 #ifdef PDF_ENABLE_XFA
595 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 597 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
596 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 598 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
597 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 599 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
598 if (nIndex < pWidgetAcc->CountSelectedItems()) 600 if (nIndex < pWidgetAcc->CountSelectedItems())
599 return pWidgetAcc->GetSelectedItem(nIndex); 601 return pWidgetAcc->GetSelectedItem(nIndex);
600 } 602 }
601 } 603 }
602 } 604 }
603 #endif // PDF_ENABLE_XFA 605 #endif // PDF_ENABLE_XFA
604 CPDF_FormField* pFormField = GetFormField(); 606 CPDF_FormField* pFormField = GetFormField();
605 return pFormField->GetSelectedIndex(nIndex); 607 return pFormField->GetSelectedIndex(nIndex);
606 } 608 }
607 609
608 #ifdef PDF_ENABLE_XFA 610 #ifdef PDF_ENABLE_XFA
609 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const { 611 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const {
610 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 612 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
611 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 613 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
612 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 614 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
613 CFX_WideString sValue; 615 CFX_WideString sValue;
614 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display 616 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display
615 : XFA_VALUEPICTURE_Edit); 617 : XFA_VALUEPICTURE_Edit);
616 return sValue; 618 return sValue;
617 } 619 }
618 } 620 }
619 } 621 }
620 #else 622 #else
621 CFX_WideString CPDFSDK_Widget::GetValue() const { 623 CFX_WideString CPDFSDK_Widget::GetValue() const {
(...skipping 12 matching lines...) Expand all
634 return pFormField->GetOptionLabel(nIndex); 636 return pFormField->GetOptionLabel(nIndex);
635 } 637 }
636 638
637 int CPDFSDK_Widget::CountOptions() const { 639 int CPDFSDK_Widget::CountOptions() const {
638 CPDF_FormField* pFormField = GetFormField(); 640 CPDF_FormField* pFormField = GetFormField();
639 return pFormField->CountOptions(); 641 return pFormField->CountOptions();
640 } 642 }
641 643
642 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { 644 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
643 #ifdef PDF_ENABLE_XFA 645 #ifdef PDF_ENABLE_XFA
644 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 646 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
645 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 647 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
646 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 648 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
647 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) 649 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
648 return pWidgetAcc->GetItemState(nIndex); 650 return pWidgetAcc->GetItemState(nIndex);
649 651
650 return FALSE; 652 return FALSE;
651 } 653 }
652 } 654 }
653 } 655 }
654 #endif // PDF_ENABLE_XFA 656 #endif // PDF_ENABLE_XFA
655 CPDF_FormField* pFormField = GetFormField(); 657 CPDF_FormField* pFormField = GetFormField();
656 return pFormField->IsItemSelected(nIndex); 658 return pFormField->IsItemSelected(nIndex);
657 } 659 }
658 660
659 int CPDFSDK_Widget::GetTopVisibleIndex() const { 661 int CPDFSDK_Widget::GetTopVisibleIndex() const {
660 CPDF_FormField* pFormField = GetFormField(); 662 CPDF_FormField* pFormField = GetFormField();
661 return pFormField->GetTopVisibleIndex(); 663 return pFormField->GetTopVisibleIndex();
662 } 664 }
663 665
664 bool CPDFSDK_Widget::IsChecked() const { 666 bool CPDFSDK_Widget::IsChecked() const {
665 #ifdef PDF_ENABLE_XFA 667 #ifdef PDF_ENABLE_XFA
666 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 668 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
667 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 669 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
668 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) 670 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget))
669 return pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On; 671 return pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On;
670 } 672 }
671 } 673 }
672 #endif // PDF_ENABLE_XFA 674 #endif // PDF_ENABLE_XFA
673 CPDF_FormControl* pFormCtrl = GetFormControl(); 675 CPDF_FormControl* pFormCtrl = GetFormControl();
674 return pFormCtrl->IsChecked(); 676 return pFormCtrl->IsChecked();
675 } 677 }
676 678
677 int CPDFSDK_Widget::GetAlignment() const { 679 int CPDFSDK_Widget::GetAlignment() const {
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 } 1870 }
1869 1871
1870 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, 1872 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
1871 PDFSDK_FieldAction& data, 1873 PDFSDK_FieldAction& data,
1872 CPDFSDK_PageView* pPageView) { 1874 CPDFSDK_PageView* pPageView) {
1873 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 1875 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
1874 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 1876 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
1875 1877
1876 #ifdef PDF_ENABLE_XFA 1878 #ifdef PDF_ENABLE_XFA
1877 CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); 1879 CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
1878 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 1880 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
1879 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit); 1881 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit);
1880 1882
1881 if (eEventType != XFA_EVENT_Unknown) { 1883 if (eEventType != XFA_EVENT_Unknown) {
1882 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 1884 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
1883 CXFA_EventParam param; 1885 CXFA_EventParam param;
1884 param.m_eType = eEventType; 1886 param.m_eType = eEventType;
1885 param.m_wsChange = data.sChange; 1887 param.m_wsChange = data.sChange;
1886 param.m_iCommitKey = data.nCommitKey; 1888 param.m_iCommitKey = data.nCommitKey;
1887 param.m_bShift = data.bShift; 1889 param.m_bShift = data.bShift;
1888 param.m_iSelStart = data.nSelStart; 1890 param.m_iSelStart = data.nSelStart;
1889 param.m_iSelEnd = data.nSelEnd; 1891 param.m_iSelEnd = data.nSelEnd;
1890 param.m_wsFullText = data.sValue; 1892 param.m_wsFullText = data.sValue;
1891 param.m_bKeyDown = data.bKeyDown; 1893 param.m_bKeyDown = data.bKeyDown;
1892 param.m_bModifier = data.bModifier; 1894 param.m_bModifier = data.bModifier;
1893 param.m_wsNewText = data.sValue; 1895 param.m_wsNewText = data.sValue;
1894 if (data.nSelEnd > data.nSelStart) 1896 if (data.nSelEnd > data.nSelStart)
1895 param.m_wsNewText.Delete(data.nSelStart, 1897 param.m_wsNewText.Delete(data.nSelStart,
1896 data.nSelEnd - data.nSelStart); 1898 data.nSelEnd - data.nSelStart);
1897 for (int i = data.sChange.GetLength() - 1; i >= 0; i--) 1899 for (int i = data.sChange.GetLength() - 1; i >= 0; i--)
1898 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]); 1900 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]);
1899 param.m_wsPrevText = data.sValue; 1901 param.m_wsPrevText = data.sValue;
1900 1902
1901 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget); 1903 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hWidget);
1902 param.m_pTarget = pAcc; 1904 param.m_pTarget = pAcc;
1903 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param); 1905 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
1904 1906
1905 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 1907 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
1906 pDocView->UpdateDocView(); 1908 pDocView->UpdateDocView();
1907 } 1909 }
1908 1910
1909 if (nRet == XFA_EVENTERROR_Success) 1911 if (nRet == XFA_EVENTERROR_Success)
1910 return TRUE; 1912 return TRUE;
1911 } 1913 }
1912 } 1914 }
1913 } 1915 }
1914 #endif // PDF_ENABLE_XFA 1916 #endif // PDF_ENABLE_XFA
1915 1917
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 int nFieldFlags = GetFieldFlags(); 1978 int nFieldFlags = GetFieldFlags();
1977 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) 1979 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
1978 return FALSE; 1980 return FALSE;
1979 1981
1980 return TRUE; 1982 return TRUE;
1981 } 1983 }
1982 return FALSE; 1984 return FALSE;
1983 } 1985 }
1984 1986
1985 #ifdef PDF_ENABLE_XFA 1987 #ifdef PDF_ENABLE_XFA
1986 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, 1988 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot,
1987 CPDFSDK_PageView* pPageView, 1989 CPDFSDK_PageView* pPageView,
1988 CPDFSDK_InterForm* pInterForm) 1990 CPDFSDK_InterForm* pInterForm)
1989 : CPDFSDK_Annot(pPageView), 1991 : CPDFSDK_Annot(pPageView),
1990 m_pInterForm(pInterForm), 1992 m_pInterForm(pInterForm),
1991 m_hXFAWidget(pAnnot) {} 1993 m_hXFAWidget(pAnnot) {}
1992 1994
1993 FX_BOOL CPDFSDK_XFAWidget::IsXFAField() { 1995 FX_BOOL CPDFSDK_XFAWidget::IsXFAField() {
1994 return TRUE; 1996 return TRUE;
1995 } 1997 }
1996 1998
1997 CFX_ByteString CPDFSDK_XFAWidget::GetType() const { 1999 CFX_ByteString CPDFSDK_XFAWidget::GetType() const {
1998 return FSDK_XFAWIDGET_TYPENAME; 2000 return FSDK_XFAWIDGET_TYPENAME;
1999 } 2001 }
2000 2002
2001 CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const { 2003 CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const {
2002 CPDFSDK_PageView* pPageView = GetPageView(); 2004 CPDFSDK_PageView* pPageView = GetPageView();
2003 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 2005 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
2004 CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); 2006 CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
2005 IXFA_DocView* pDocView = pDoc->GetXFADocView(); 2007 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
2006 IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); 2008 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler();
2007 2009
2008 CFX_RectF rcBBox; 2010 CFX_RectF rcBBox;
2009 pWidgetHandler->GetRect(GetXFAWidget(), rcBBox); 2011 pWidgetHandler->GetRect(GetXFAWidget(), rcBBox);
2010 2012
2011 return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, 2013 return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
2012 rcBBox.top + rcBBox.height); 2014 rcBBox.top + rcBBox.height);
2013 } 2015 }
2014 #endif // PDF_ENABLE_XFA 2016 #endif // PDF_ENABLE_XFA
2015 2017
2016 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument) 2018 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 2145
2144 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) { 2146 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) {
2145 m_bCalculate = bEnabled; 2147 m_bCalculate = bEnabled;
2146 } 2148 }
2147 2149
2148 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const { 2150 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const {
2149 return m_bCalculate; 2151 return m_bCalculate;
2150 } 2152 }
2151 2153
2152 #ifdef PDF_ENABLE_XFA 2154 #ifdef PDF_ENABLE_XFA
2153 void CPDFSDK_InterForm::AddXFAMap(IXFA_Widget* hWidget, 2155 void CPDFSDK_InterForm::AddXFAMap(CXFA_FFWidget* hWidget,
2154 CPDFSDK_XFAWidget* pWidget) { 2156 CPDFSDK_XFAWidget* pWidget) {
2155 m_XFAMap.SetAt(hWidget, pWidget); 2157 m_XFAMap.SetAt(hWidget, pWidget);
2156 } 2158 }
2157 2159
2158 void CPDFSDK_InterForm::RemoveXFAMap(IXFA_Widget* hWidget) { 2160 void CPDFSDK_InterForm::RemoveXFAMap(CXFA_FFWidget* hWidget) {
2159 m_XFAMap.RemoveKey(hWidget); 2161 m_XFAMap.RemoveKey(hWidget);
2160 } 2162 }
2161 2163
2162 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) { 2164 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(CXFA_FFWidget* hWidget) {
2163 CPDFSDK_XFAWidget* pWidget = NULL; 2165 CPDFSDK_XFAWidget* pWidget = NULL;
2164 m_XFAMap.Lookup(hWidget, pWidget); 2166 m_XFAMap.Lookup(hWidget, pWidget);
2165 2167
2166 return pWidget; 2168 return pWidget;
2167 } 2169 }
2168 2170
2169 void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) { 2171 void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) {
2170 m_bXfaCalculate = bEnabled; 2172 m_bXfaCalculate = bEnabled;
2171 } 2173 }
2172 FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const { 2174 FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const {
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2861 break; 2863 break;
2862 } 2864 }
2863 } 2865 }
2864 } 2866 }
2865 2867
2866 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { 2868 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
2867 CFX_FloatRect rcAnnot; 2869 CFX_FloatRect rcAnnot;
2868 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 2870 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
2869 return rcAnnot; 2871 return rcAnnot;
2870 } 2872 }
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_annothandler.cpp ('k') | fpdfsdk/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698