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

Side by Side Diff: fpdfsdk/cpdfsdk_widget.cpp

Issue 2400473002: Start proxying CPDFSDK_Document methods through CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Rebase to master Created 4 years, 2 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/cpdfsdk_pageview.cpp ('k') | fpdfsdk/cpdfsdk_widgethandler.h » ('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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/cpdfsdk_widget.h" 7 #include "fpdfsdk/cpdfsdk_widget.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 m_hMixXFAWidget(nullptr), 62 m_hMixXFAWidget(nullptr),
63 m_pWidgetHandler(nullptr) 63 m_pWidgetHandler(nullptr)
64 #endif // PDF_ENABLE_XFA 64 #endif // PDF_ENABLE_XFA
65 { 65 {
66 } 66 }
67 67
68 CPDFSDK_Widget::~CPDFSDK_Widget() {} 68 CPDFSDK_Widget::~CPDFSDK_Widget() {}
69 69
70 #ifdef PDF_ENABLE_XFA 70 #ifdef PDF_ENABLE_XFA
71 CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const { 71 CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
72 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 72 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
73 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
74 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 73 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
75 if (!m_hMixXFAWidget) { 74 if (!m_hMixXFAWidget) {
76 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { 75 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
77 CFX_WideString sName; 76 CFX_WideString sName;
78 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) { 77 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
79 sName = GetAnnotName(); 78 sName = GetAnnotName();
80 if (sName.IsEmpty()) 79 if (sName.IsEmpty())
81 sName = GetName(); 80 sName = GetName();
82 } else { 81 } else {
83 sName = GetName(); 82 sName = GetName();
84 } 83 }
85 84
86 if (!sName.IsEmpty()) 85 if (!sName.IsEmpty())
87 m_hMixXFAWidget = pDocView->GetWidgetByName(sName, nullptr); 86 m_hMixXFAWidget = pDocView->GetWidgetByName(sName, nullptr);
88 } 87 }
89 } 88 }
90 return m_hMixXFAWidget; 89 return m_hMixXFAWidget;
91 } 90 }
92 91
93 return nullptr; 92 return nullptr;
94 } 93 }
95 94
96 CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() { 95 CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
97 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 96 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
98 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
99 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 97 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
100 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { 98 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
101 CFX_WideString sName = GetName(); 99 CFX_WideString sName = GetName();
102 if (!sName.IsEmpty()) 100 if (!sName.IsEmpty())
103 return pDocView->GetWidgetByName(sName, nullptr); 101 return pDocView->GetWidgetByName(sName, nullptr);
104 } 102 }
105 } 103 }
106 104
107 return nullptr; 105 return nullptr;
108 } 106 }
109 107
110 CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const { 108 CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
111 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 109 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
112 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
113 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 110 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
114 if (!m_pWidgetHandler) { 111 if (!m_pWidgetHandler) {
115 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) 112 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView())
116 m_pWidgetHandler = pDocView->GetWidgetHandler(); 113 m_pWidgetHandler = pDocView->GetWidgetHandler();
117 } 114 }
118 return m_pWidgetHandler; 115 return m_pWidgetHandler;
119 } 116 }
120 117
121 return nullptr; 118 return nullptr;
122 } 119 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 213 }
217 } 214 }
218 215
219 pAcc = hWidget->GetDataAcc(); 216 pAcc = hWidget->GetDataAcc();
220 return pXFAWidgetHandler->HasEvent(pAcc, eEventType); 217 return pXFAWidgetHandler->HasEvent(pAcc, eEventType);
221 } 218 }
222 219
223 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, 220 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
224 PDFSDK_FieldAction& data, 221 PDFSDK_FieldAction& data,
225 CPDFSDK_PageView* pPageView) { 222 CPDFSDK_PageView* pPageView) {
226 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 223 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
227 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
228 224
229 CXFA_FFWidget* hWidget = GetMixXFAWidget(); 225 CXFA_FFWidget* hWidget = GetMixXFAWidget();
230 if (!hWidget) 226 if (!hWidget)
231 return FALSE; 227 return FALSE;
232 228
233 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); 229 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
234 if (eEventType == XFA_EVENT_Unknown) 230 if (eEventType == XFA_EVENT_Unknown)
235 return FALSE; 231 return FALSE;
236 232
237 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); 233 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); 316 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit);
321 break; 317 break;
322 } 318 }
323 } 319 }
324 320
325 if (bSynchronizeElse) 321 if (bSynchronizeElse)
326 pWidgetAcc->ProcessValueChanged(); 322 pWidgetAcc->ProcessValueChanged();
327 } 323 }
328 324
329 void CPDFSDK_Widget::SynchronizeXFAValue() { 325 void CPDFSDK_Widget::SynchronizeXFAValue() {
330 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 326 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
331 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
332 CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView(); 327 CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
333 if (!pXFADocView) 328 if (!pXFADocView)
334 return; 329 return;
335 330
336 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { 331 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
337 if (GetXFAWidgetHandler()) { 332 if (GetXFAWidgetHandler()) {
338 CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget, GetFormField(), 333 CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget, GetFormField(),
339 GetFormControl()); 334 GetFormControl());
340 } 335 }
341 } 336 }
342 } 337 }
343 338
344 void CPDFSDK_Widget::SynchronizeXFAItems() { 339 void CPDFSDK_Widget::SynchronizeXFAItems() {
345 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 340 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
346 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
347 CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView(); 341 CXFA_FFDocView* pXFADocView = pDoc->GetXFADocView();
348 if (!pXFADocView) 342 if (!pXFADocView)
349 return; 343 return;
350 344
351 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { 345 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
352 if (GetXFAWidgetHandler()) 346 if (GetXFAWidgetHandler())
353 SynchronizeXFAItems(pXFADocView, hWidget, GetFormField(), nullptr); 347 SynchronizeXFAItems(pXFADocView, hWidget, GetFormField(), nullptr);
354 } 348 }
355 } 349 }
356 350
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 return TRUE; 496 return TRUE;
503 } 497 }
504 498
505 int CPDFSDK_Widget::GetFieldType() const { 499 int CPDFSDK_Widget::GetFieldType() const {
506 CPDF_FormField* pField = GetFormField(); 500 CPDF_FormField* pField = GetFormField();
507 return pField ? pField->GetFieldType() : FIELDTYPE_UNKNOWN; 501 return pField ? pField->GetFieldType() : FIELDTYPE_UNKNOWN;
508 } 502 }
509 503
510 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { 504 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() {
511 #ifdef PDF_ENABLE_XFA 505 #ifdef PDF_ENABLE_XFA
512 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 506 CPDFXFA_Document* pDoc = m_pPageView->GetFormFillEnv()->GetXFADocument();
513 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
514 int nDocType = pDoc->GetDocType(); 507 int nDocType = pDoc->GetDocType();
515 if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA) 508 if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA)
516 return TRUE; 509 return TRUE;
517 #endif // PDF_ENABLE_XFA 510 #endif // PDF_ENABLE_XFA
518 return CPDFSDK_BAAnnot::IsAppearanceValid(); 511 return CPDFSDK_BAAnnot::IsAppearanceValid();
519 } 512 }
520 513
521 int CPDFSDK_Widget::GetLayoutOrder() const { 514 int CPDFSDK_Widget::GetLayoutOrder() const {
522 return 2; 515 return 2;
523 } 516 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 CPDFSDK_PageView* pPageView) { 838 CPDFSDK_PageView* pPageView) {
846 int nFieldType = GetFieldType(); 839 int nFieldType = GetFieldType();
847 if (!m_pInterForm->IsNeedHighLight(nFieldType)) 840 if (!m_pInterForm->IsNeedHighLight(nFieldType))
848 return; 841 return;
849 842
850 CFX_FloatRect rc = GetRect(); 843 CFX_FloatRect rc = GetRect();
851 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); 844 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType);
852 uint8_t alpha = m_pInterForm->GetHighlightAlpha(); 845 uint8_t alpha = m_pInterForm->GetHighlightAlpha();
853 846
854 CFX_FloatRect rcDevice; 847 CFX_FloatRect rcDevice;
855 ASSERT(m_pInterForm->GetDocument()); 848 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
856 CPDFSDK_FormFillEnvironment* pEnv = m_pInterForm->GetDocument()->GetEnv(); 849 if (!pFormFillEnv)
857 if (!pEnv)
858 return; 850 return;
859 CFX_Matrix page2device; 851 CFX_Matrix page2device;
860 pPageView->GetCurrentMatrix(page2device); 852 pPageView->GetCurrentMatrix(page2device);
861 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom), 853 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom),
862 rcDevice.left, rcDevice.bottom); 854 rcDevice.left, rcDevice.bottom);
863 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top), 855 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top),
864 rcDevice.right, rcDevice.top); 856 rcDevice.right, rcDevice.top);
865 857
866 rcDevice.Normalize(); 858 rcDevice.Normalize();
867 859
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 984
993 if (pDownIcon) { 985 if (pDownIcon) {
994 if (CPDF_Dictionary* pImageDict = pDownIcon->GetDict()) { 986 if (CPDF_Dictionary* pImageDict = pDownIcon->GetDict()) {
995 if (pImageDict->GetStringFor("Name").IsEmpty()) 987 if (pImageDict->GetStringFor("Name").IsEmpty())
996 pImageDict->SetStringFor("Name", "ImgC"); 988 pImageDict->SetStringFor("Name", "ImgC");
997 } 989 }
998 } 990 }
999 991
1000 CPDF_IconFit iconFit = pControl->GetIconFit(); 992 CPDF_IconFit iconFit = pControl->GetIconFit();
1001 993
1002 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 994 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
1003 CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); 995 CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
1004
1005 CBA_FontMap font_map(this, pEnv->GetSysHandler());
1006 font_map.SetAPType("N"); 996 font_map.SetAPType("N");
1007 997
1008 CFX_ByteString csAP = 998 CFX_ByteString csAP =
1009 CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + 999 CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) +
1010 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, 1000 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
1011 crLeftTop, crRightBottom, nBorderStyle, 1001 crLeftTop, crRightBottom, nBorderStyle,
1012 dsBorder) + 1002 dsBorder) +
1013 CPWL_Utils::GetPushButtonAppStream( 1003 CPWL_Utils::GetPushButtonAppStream(
1014 iconFit.GetFittingBounds() ? rcWindow : rcClient, &font_map, 1004 iconFit.GetFittingBounds() ? rcWindow : rcClient, &font_map,
1015 pNormalIcon, iconFit, csNormalCaption, crText, fFontSize, nLayout); 1005 pNormalIcon, iconFit, csNormalCaption, crText, fFontSize, nLayout);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 CFX_ByteTextBuf sBody, sLines; 1360 CFX_ByteTextBuf sBody, sLines;
1371 1361
1372 CFX_FloatRect rcClient = GetClientRect(); 1362 CFX_FloatRect rcClient = GetClientRect();
1373 CFX_FloatRect rcButton = rcClient; 1363 CFX_FloatRect rcButton = rcClient;
1374 rcButton.left = rcButton.right - 13; 1364 rcButton.left = rcButton.right - 13;
1375 rcButton.Normalize(); 1365 rcButton.Normalize();
1376 1366
1377 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); 1367 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
1378 pEdit->EnableRefresh(FALSE); 1368 pEdit->EnableRefresh(FALSE);
1379 1369
1380 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 1370 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
1381 CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); 1371 CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
1382 CBA_FontMap font_map(this, pEnv->GetSysHandler());
1383 pEdit->SetFontMap(&font_map); 1372 pEdit->SetFontMap(&font_map);
1384 1373
1385 CFX_FloatRect rcEdit = rcClient; 1374 CFX_FloatRect rcEdit = rcClient;
1386 rcEdit.right = rcButton.left; 1375 rcEdit.right = rcButton.left;
1387 rcEdit.Normalize(); 1376 rcEdit.Normalize();
1388 1377
1389 pEdit->SetPlateRect(rcEdit); 1378 pEdit->SetPlateRect(rcEdit);
1390 pEdit->SetAlignmentV(1, TRUE); 1379 pEdit->SetAlignmentV(1, TRUE);
1391 1380
1392 FX_FLOAT fFontSize = GetFontSize(); 1381 FX_FLOAT fFontSize = GetFontSize();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 1425
1437 void CPDFSDK_Widget::ResetAppearance_ListBox() { 1426 void CPDFSDK_Widget::ResetAppearance_ListBox() {
1438 CPDF_FormControl* pControl = GetFormControl(); 1427 CPDF_FormControl* pControl = GetFormControl();
1439 CPDF_FormField* pField = pControl->GetField(); 1428 CPDF_FormField* pField = pControl->GetField();
1440 CFX_FloatRect rcClient = GetClientRect(); 1429 CFX_FloatRect rcClient = GetClientRect();
1441 CFX_ByteTextBuf sBody, sLines; 1430 CFX_ByteTextBuf sBody, sLines;
1442 1431
1443 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); 1432 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
1444 pEdit->EnableRefresh(FALSE); 1433 pEdit->EnableRefresh(FALSE);
1445 1434
1446 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 1435 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
1447 CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); 1436 CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
1448
1449 CBA_FontMap font_map(this, pEnv->GetSysHandler());
1450 pEdit->SetFontMap(&font_map); 1437 pEdit->SetFontMap(&font_map);
1451 1438
1452 pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); 1439 pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f));
1453 1440
1454 FX_FLOAT fFontSize = GetFontSize(); 1441 FX_FLOAT fFontSize = GetFontSize();
1455 1442
1456 pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize); 1443 pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize);
1457 1444
1458 pEdit->Initialize(); 1445 pEdit->Initialize();
1459 1446
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 } 1510 }
1524 1511
1525 void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { 1512 void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
1526 CPDF_FormControl* pControl = GetFormControl(); 1513 CPDF_FormControl* pControl = GetFormControl();
1527 CPDF_FormField* pField = pControl->GetField(); 1514 CPDF_FormField* pField = pControl->GetField();
1528 CFX_ByteTextBuf sBody, sLines; 1515 CFX_ByteTextBuf sBody, sLines;
1529 1516
1530 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); 1517 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
1531 pEdit->EnableRefresh(FALSE); 1518 pEdit->EnableRefresh(FALSE);
1532 1519
1533 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 1520 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pInterForm->GetFormFillEnv();
1534 CPDFSDK_FormFillEnvironment* pEnv = pDoc->GetEnv(); 1521 CBA_FontMap font_map(this, pFormFillEnv->GetSysHandler());
1535
1536 CBA_FontMap font_map(this, pEnv->GetSysHandler());
1537 pEdit->SetFontMap(&font_map); 1522 pEdit->SetFontMap(&font_map);
1538 1523
1539 CFX_FloatRect rcClient = GetClientRect(); 1524 CFX_FloatRect rcClient = GetClientRect();
1540 pEdit->SetPlateRect(rcClient); 1525 pEdit->SetPlateRect(rcClient);
1541 pEdit->SetAlignmentH(pControl->GetControlAlignment(), TRUE); 1526 pEdit->SetAlignmentH(pControl->GetControlAlignment(), TRUE);
1542 1527
1543 uint32_t dwFieldFlags = pField->GetFieldFlags(); 1528 uint32_t dwFieldFlags = pField->GetFieldFlags();
1544 FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; 1529 FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1;
1545 1530
1546 if (bMultiLine) { 1531 if (bMultiLine) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 } 1824 }
1840 1825
1841 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { 1826 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) {
1842 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP")) 1827 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP"))
1843 pAPDict->RemoveFor(sAPType); 1828 pAPDict->RemoveFor(sAPType);
1844 } 1829 }
1845 1830
1846 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, 1831 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
1847 PDFSDK_FieldAction& data, 1832 PDFSDK_FieldAction& data,
1848 CPDFSDK_PageView* pPageView) { 1833 CPDFSDK_PageView* pPageView) {
1849 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 1834 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
1850 CPDFSDK_FormFillEnvironment* pEnv = pDocument->GetEnv();
1851 1835
1852 #ifdef PDF_ENABLE_XFA 1836 #ifdef PDF_ENABLE_XFA
1853 CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); 1837 CPDFXFA_Document* pXFADoc = pFormFillEnv->GetXFADocument();
1854 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { 1838 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
1855 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit); 1839 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit);
1856 1840
1857 if (eEventType != XFA_EVENT_Unknown) { 1841 if (eEventType != XFA_EVENT_Unknown) {
1858 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { 1842 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
1859 CXFA_EventParam param; 1843 CXFA_EventParam param;
1860 param.m_eType = eEventType; 1844 param.m_eType = eEventType;
1861 param.m_wsChange = data.sChange; 1845 param.m_wsChange = data.sChange;
1862 param.m_iCommitKey = data.nCommitKey; 1846 param.m_iCommitKey = data.nCommitKey;
1863 param.m_bShift = data.bShift; 1847 param.m_bShift = data.bShift;
1864 param.m_iSelStart = data.nSelStart; 1848 param.m_iSelStart = data.nSelStart;
1865 param.m_iSelEnd = data.nSelEnd; 1849 param.m_iSelEnd = data.nSelEnd;
1866 param.m_wsFullText = data.sValue; 1850 param.m_wsFullText = data.sValue;
1867 param.m_bKeyDown = data.bKeyDown; 1851 param.m_bKeyDown = data.bKeyDown;
1868 param.m_bModifier = data.bModifier; 1852 param.m_bModifier = data.bModifier;
1869 param.m_wsNewText = data.sValue; 1853 param.m_wsNewText = data.sValue;
1870 if (data.nSelEnd > data.nSelStart) 1854 if (data.nSelEnd > data.nSelStart)
1871 param.m_wsNewText.Delete(data.nSelStart, 1855 param.m_wsNewText.Delete(data.nSelStart,
1872 data.nSelEnd - data.nSelStart); 1856 data.nSelEnd - data.nSelStart);
1873 for (int i = data.sChange.GetLength() - 1; i >= 0; i--) 1857 for (int i = data.sChange.GetLength() - 1; i >= 0; i--)
1874 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]); 1858 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]);
1875 param.m_wsPrevText = data.sValue; 1859 param.m_wsPrevText = data.sValue;
1876 1860
1877 CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc(); 1861 CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc();
1878 param.m_pTarget = pAcc; 1862 param.m_pTarget = pAcc;
1879 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param); 1863 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, &param);
1880 1864
1881 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) 1865 if (CXFA_FFDocView* pDocView = pXFADoc->GetXFADocView())
1882 pDocView->UpdateDocView(); 1866 pDocView->UpdateDocView();
1883 1867
1884 if (nRet == XFA_EVENTERROR_Success) 1868 if (nRet == XFA_EVENTERROR_Success)
1885 return TRUE; 1869 return TRUE;
1886 } 1870 }
1887 } 1871 }
1888 } 1872 }
1889 #endif // PDF_ENABLE_XFA 1873 #endif // PDF_ENABLE_XFA
1890 1874
1891 CPDF_Action action = GetAAction(type); 1875 CPDF_Action action = GetAAction(type);
1892 if (action.GetDict() && action.GetType() != CPDF_Action::Unknown) { 1876 if (action.GetDict() && action.GetType() != CPDF_Action::Unknown) {
1893 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); 1877 CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHander();
1894 return pActionHandler->DoAction_Field(action, type, pDocument, 1878 return pActionHandler->DoAction_Field(
1895 GetFormField(), data); 1879 action, type, pFormFillEnv->GetSDKDocument(), GetFormField(), data);
1896 } 1880 }
1897 return FALSE; 1881 return FALSE;
1898 } 1882 }
1899 1883
1900 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { 1884 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) {
1901 switch (eAAT) { 1885 switch (eAAT) {
1902 case CPDF_AAction::CursorEnter: 1886 case CPDF_AAction::CursorEnter:
1903 case CPDF_AAction::CursorExit: 1887 case CPDF_AAction::CursorExit:
1904 case CPDF_AAction::ButtonDown: 1888 case CPDF_AAction::ButtonDown:
1905 case CPDF_AAction::ButtonUp: 1889 case CPDF_AAction::ButtonUp:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 return FALSE; 1931 return FALSE;
1948 1932
1949 if (!IsVisible()) 1933 if (!IsVisible())
1950 return FALSE; 1934 return FALSE;
1951 1935
1952 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) 1936 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
1953 return FALSE; 1937 return FALSE;
1954 1938
1955 return TRUE; 1939 return TRUE;
1956 } 1940 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_pageview.cpp ('k') | fpdfsdk/cpdfsdk_widgethandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698