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

Side by Side Diff: xfa/fxfa/parser/cxfa_document.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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/parser/cxfa_document.h ('k') | xfa/fxfa/parser/cxfa_document_parser.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 "core/fxcrt/fx_ext.h" 7 #include "core/fxcrt/fx_ext.h"
8 #include "xfa/fxfa/app/xfa_ffnotify.h" 8 #include "xfa/fxfa/app/xfa_ffnotify.h"
9 #include "xfa/fxfa/parser/cscript_datawindow.h" 9 #include "xfa/fxfa/parser/cscript_datawindow.h"
10 #include "xfa/fxfa/parser/cscript_eventpseudomodel.h" 10 #include "xfa/fxfa/parser/cscript_eventpseudomodel.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (pExistingNode) { 43 if (pExistingNode) {
44 pExistingNode->SetTemplateNode(pProtoNode); 44 pExistingNode->SetTemplateNode(pProtoNode);
45 for (CXFA_Node* pTemplateChild = 45 for (CXFA_Node* pTemplateChild =
46 pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); 46 pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild);
47 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( 47 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
48 XFA_NODEITEM_NextSibling)) { 48 XFA_NODEITEM_NextSibling)) {
49 MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild); 49 MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild);
50 } 50 }
51 return; 51 return;
52 } 52 }
53 CXFA_Node* pNewNode = pProtoNode->Clone(TRUE); 53 CXFA_Node* pNewNode = pProtoNode->Clone(true);
54 pNewNode->SetTemplateNode(pProtoNode); 54 pNewNode->SetTemplateNode(pProtoNode);
55 pDestNodeParent->InsertChild(pNewNode, nullptr); 55 pDestNodeParent->InsertChild(pNewNode, nullptr);
56 } 56 }
57 57
58 void MergeNode(CXFA_Document* pDocument, 58 void MergeNode(CXFA_Document* pDocument,
59 CXFA_Node* pDestNode, 59 CXFA_Node* pDestNode,
60 CXFA_Node* pProtoNode) { 60 CXFA_Node* pProtoNode) {
61 { 61 {
62 CXFA_NodeIterator sIterator(pDestNode); 62 CXFA_NodeIterator sIterator(pDestNode);
63 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 63 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return pNode; 227 return pNode;
228 } 228 }
229 229
230 return nullptr; 230 return nullptr;
231 } 231 }
232 232
233 void CXFA_Document::AddPurgeNode(CXFA_Node* pNode) { 233 void CXFA_Document::AddPurgeNode(CXFA_Node* pNode) {
234 m_PurgeNodes.insert(pNode); 234 m_PurgeNodes.insert(pNode);
235 } 235 }
236 236
237 FX_BOOL CXFA_Document::RemovePurgeNode(CXFA_Node* pNode) { 237 bool CXFA_Document::RemovePurgeNode(CXFA_Node* pNode) {
238 return !!m_PurgeNodes.erase(pNode); 238 return !!m_PurgeNodes.erase(pNode);
239 } 239 }
240 240
241 void CXFA_Document::PurgeNodes() { 241 void CXFA_Document::PurgeNodes() {
242 for (CXFA_Node* pNode : m_PurgeNodes) 242 for (CXFA_Node* pNode : m_PurgeNodes)
243 delete pNode; 243 delete pNode;
244 244
245 m_PurgeNodes.clear(); 245 m_PurgeNodes.clear();
246 } 246 }
247 247
248 void CXFA_Document::SetFlag(uint32_t dwFlag, FX_BOOL bOn) { 248 void CXFA_Document::SetFlag(uint32_t dwFlag, bool bOn) {
249 if (bOn) 249 if (bOn)
250 m_dwDocFlags |= dwFlag; 250 m_dwDocFlags |= dwFlag;
251 else 251 else
252 m_dwDocFlags &= ~dwFlag; 252 m_dwDocFlags &= ~dwFlag;
253 } 253 }
254 254
255 FX_BOOL CXFA_Document::IsInteractive() { 255 bool CXFA_Document::IsInteractive() {
256 if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) 256 if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive)
257 return !!(m_dwDocFlags & XFA_DOCFLAG_Interactive); 257 return !!(m_dwDocFlags & XFA_DOCFLAG_Interactive);
258 258
259 CXFA_Node* pConfig = ToNode(GetXFAObject(XFA_HASHCODE_Config)); 259 CXFA_Node* pConfig = ToNode(GetXFAObject(XFA_HASHCODE_Config));
260 if (!pConfig) 260 if (!pConfig)
261 return FALSE; 261 return false;
262 262
263 CFX_WideString wsInteractive; 263 CFX_WideString wsInteractive;
264 CXFA_Node* pPresent = pConfig->GetFirstChildByClass(XFA_Element::Present); 264 CXFA_Node* pPresent = pConfig->GetFirstChildByClass(XFA_Element::Present);
265 if (!pPresent) 265 if (!pPresent)
266 return FALSE; 266 return false;
267 267
268 CXFA_Node* pPDF = pPresent->GetFirstChildByClass(XFA_Element::Pdf); 268 CXFA_Node* pPDF = pPresent->GetFirstChildByClass(XFA_Element::Pdf);
269 if (!pPDF) 269 if (!pPDF)
270 return FALSE; 270 return false;
271 271
272 CXFA_Node* pFormFiller = pPDF->GetChild(0, XFA_Element::Interactive); 272 CXFA_Node* pFormFiller = pPDF->GetChild(0, XFA_Element::Interactive);
273 if (pFormFiller) { 273 if (pFormFiller) {
274 m_dwDocFlags |= XFA_DOCFLAG_HasInteractive; 274 m_dwDocFlags |= XFA_DOCFLAG_HasInteractive;
275 if (pFormFiller->TryContent(wsInteractive) && 275 if (pFormFiller->TryContent(wsInteractive) &&
276 wsInteractive == FX_WSTRC(L"1")) { 276 wsInteractive == FX_WSTRC(L"1")) {
277 m_dwDocFlags |= XFA_DOCFLAG_Interactive; 277 m_dwDocFlags |= XFA_DOCFLAG_Interactive;
278 return TRUE; 278 return true;
279 } 279 }
280 } 280 }
281 return FALSE; 281 return false;
282 } 282 }
283 283
284 CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { 284 CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() {
285 if (!m_pLocalMgr) { 285 if (!m_pLocalMgr) {
286 CFX_WideString wsLanguage; 286 CFX_WideString wsLanguage;
287 GetNotify()->GetAppProvider()->GetLanguage(wsLanguage); 287 GetNotify()->GetAppProvider()->GetLanguage(wsLanguage);
288 m_pLocalMgr = new CXFA_LocaleMgr( 288 m_pLocalMgr = new CXFA_LocaleMgr(
289 ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage); 289 ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage);
290 } 290 }
291 return m_pLocalMgr; 291 return m_pLocalMgr;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { 418 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) {
419 continue; 419 continue;
420 } 420 }
421 } 421 }
422 if (!pProtoNode) 422 if (!pProtoNode)
423 continue; 423 continue;
424 424
425 MergeNode(this, pUseHrefNode, pProtoNode); 425 MergeNode(this, pUseHrefNode, pProtoNode);
426 } 426 }
427 } 427 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_document.h ('k') | xfa/fxfa/parser/cxfa_document_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698