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

Side by Side Diff: xfa/fxfa/app/xfa_ffwidgethandler.cpp

Issue 2083453003: Split the XFA_OBJECTTYPE enum into two parts. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix == nullptr Created 4 years, 6 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 | « xfa/fxfa/app/xfa_ffwidgetacc.cpp ('k') | xfa/fxfa/include/fxfa_basic.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 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 "xfa/fxfa/include/xfa_ffwidgethandler.h" 7 #include "xfa/fxfa/include/xfa_ffwidgethandler.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 case XFA_EVENT_Validate: 228 case XFA_EVENT_Validate:
229 if (m_pDocView->GetDoc()->GetDocProvider()->IsValidationsEnabled( 229 if (m_pDocView->GetDoc()->GetDocProvider()->IsValidationsEnabled(
230 m_pDocView->GetDoc())) { 230 m_pDocView->GetDoc())) {
231 return pWidgetAcc->ProcessValidate(); 231 return pWidgetAcc->ProcessValidate();
232 } 232 }
233 return XFA_EVENTERROR_Disabled; 233 return XFA_EVENTERROR_Disabled;
234 case XFA_EVENT_InitCalculate: { 234 case XFA_EVENT_InitCalculate: {
235 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); 235 CXFA_Calculate calc = pWidgetAcc->GetCalculate();
236 if (!calc) 236 if (!calc)
237 return XFA_EVENTERROR_NotExist; 237 return XFA_EVENTERROR_NotExist;
238 if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) 238 if (pWidgetAcc->GetNode()->IsUserInteractive())
239 return XFA_EVENTERROR_Disabled; 239 return XFA_EVENTERROR_Disabled;
240 240
241 CXFA_Script script = calc.GetScript(); 241 CXFA_Script script = calc.GetScript();
242 return pWidgetAcc->ExecuteScript(script, pParam); 242 return pWidgetAcc->ExecuteScript(script, pParam);
243 } 243 }
244 default: 244 default:
245 break; 245 break;
246 } 246 }
247 int32_t iRet = 247 int32_t iRet =
248 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); 248 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
249 return iRet; 249 return iRet;
250 } 250 }
251 251
252 CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, 252 CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent,
253 XFA_WIDGETTYPE eType, 253 XFA_WIDGETTYPE eType,
254 CXFA_FFWidget* hBefore) { 254 CXFA_FFWidget* hBefore) {
255 CXFA_Node* pParentFormItem = 255 CXFA_Node* pParentFormItem =
256 hParent ? hParent->GetDataAcc()->GetNode() : nullptr; 256 hParent ? hParent->GetDataAcc()->GetNode() : nullptr;
257 CXFA_Node* pBeforeFormItem = 257 CXFA_Node* pBeforeFormItem =
258 hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr; 258 hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr;
259 CXFA_Node* pNewFormItem = 259 CXFA_Node* pNewFormItem =
260 CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem); 260 CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem);
261 if (!pNewFormItem) 261 if (!pNewFormItem)
262 return nullptr; 262 return nullptr;
263 263
264 pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized, true); 264 pNewFormItem->GetTemplateNode()->SetFlag(XFA_NodeFlag_Initialized, true);
265 pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized, true); 265 pNewFormItem->SetFlag(XFA_NodeFlag_Initialized, true);
266 m_pDocView->RunLayout(); 266 m_pDocView->RunLayout();
267 CXFA_LayoutItem* pLayout = 267 CXFA_LayoutItem* pLayout =
268 m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem); 268 m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);
269 return static_cast<CXFA_FFWidget*>(pLayout); 269 return static_cast<CXFA_FFWidget*>(pLayout);
270 } 270 }
271 271
272 CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( 272 CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
273 XFA_WIDGETTYPE eType, 273 XFA_WIDGETTYPE eType,
274 CXFA_Node* pParent, 274 CXFA_Node* pParent,
275 CXFA_Node* pBefore) const { 275 CXFA_Node* pBefore) const {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 543 }
544 544
545 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { 545 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const {
546 return GetXFADoc()->GetParser()->GetFactory(); 546 return GetXFADoc()->GetParser()->GetFactory();
547 } 547 }
548 548
549 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { 549 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const {
550 return m_pDocView->GetDoc()->GetXFADoc(); 550 return m_pDocView->GetDoc()->GetXFADoc();
551 } 551 }
552 552
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffwidgetacc.cpp ('k') | xfa/fxfa/include/fxfa_basic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698