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

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

Issue 2017863002: Fix MSVC C4800 build warnings. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: put C4800 back Created 4 years, 7 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/parser/xfa_document_datamerger_imp.cpp ('k') | no next file » | 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/parser/xfa_object.h" 7 #include "xfa/fxfa/parser/xfa_object.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2136 CXFA_WidgetData* pWidgetData = GetWidgetData();
2137 if (!pWidgetData) { 2137 if (!pWidgetData) {
2138 return; 2138 return;
2139 } 2139 }
2140 if (bSetting) { 2140 if (bSetting) {
2141 int32_t iIndex = FXJSE_Value_ToInteger(pValue); 2141 int32_t iIndex = FXJSE_Value_ToInteger(pValue);
2142 if (iIndex == -1) { 2142 if (iIndex == -1) {
2143 pWidgetData->ClearAllSelections(); 2143 pWidgetData->ClearAllSelections();
2144 return; 2144 return;
2145 } 2145 }
2146 pWidgetData->SetItemState(iIndex, TRUE, TRUE, TRUE); 2146 pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE);
2147 } else { 2147 } else {
2148 FXJSE_Value_SetInteger(pValue, pWidgetData->GetSelectedItem()); 2148 FXJSE_Value_SetInteger(pValue, pWidgetData->GetSelectedItem());
2149 } 2149 }
2150 } 2150 }
2151 void CXFA_Node::Script_Field_ClearItems(CFXJSE_Arguments* pArguments) { 2151 void CXFA_Node::Script_Field_ClearItems(CFXJSE_Arguments* pArguments) {
2152 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2152 CXFA_WidgetData* pWidgetData = GetWidgetData();
2153 if (!pWidgetData) { 2153 if (!pWidgetData) {
2154 return; 2154 return;
2155 } 2155 }
2156 pWidgetData->DeleteItem(-1, TRUE); 2156 pWidgetData->DeleteItem(-1, TRUE);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 } 2305 }
2306 } 2306 }
2307 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { 2307 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) {
2308 int32_t iLength = pArguments->GetLength(); 2308 int32_t iLength = pArguments->GetLength();
2309 if (iLength != 2) { 2309 if (iLength != 2) {
2310 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2310 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
2311 L"setItemState"); 2311 L"setItemState");
2312 return; 2312 return;
2313 } 2313 }
2314 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2314 CXFA_WidgetData* pWidgetData = GetWidgetData();
2315 if (!pWidgetData) { 2315 if (!pWidgetData)
2316 return; 2316 return;
2317 } 2317
2318 int32_t iIndex = pArguments->GetInt32(0); 2318 int32_t iIndex = pArguments->GetInt32(0);
2319 if (pArguments->GetInt32(1) != 0) { 2319 if (pArguments->GetInt32(1) != 0) {
2320 pWidgetData->SetItemState(iIndex, TRUE, TRUE, TRUE); 2320 pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE);
2321 } else { 2321 } else {
2322 if (pWidgetData->GetItemState(iIndex)) { 2322 if (pWidgetData->GetItemState(iIndex))
2323 pWidgetData->SetItemState(iIndex, FALSE, TRUE, TRUE); 2323 pWidgetData->SetItemState(iIndex, FALSE, true, TRUE, TRUE);
2324 }
2325 } 2324 }
2326 } 2325 }
2327 void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { 2326 void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) {
2328 int32_t iLength = pArguments->GetLength(); 2327 int32_t iLength = pArguments->GetLength();
2329 if (iLength < 1 || iLength > 2) { 2328 if (iLength < 1 || iLength > 2) {
2330 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addItem"); 2329 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addItem");
2331 return; 2330 return;
2332 } 2331 }
2333 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2332 CXFA_WidgetData* pWidgetData = GetWidgetData();
2334 if (!pWidgetData) { 2333 if (!pWidgetData) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 FX_BOOL bSetting, 2374 FX_BOOL bSetting,
2376 XFA_ATTRIBUTE eAttribute) { 2375 XFA_ATTRIBUTE eAttribute) {
2377 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2376 CXFA_WidgetData* pWidgetData = GetWidgetData();
2378 if (!pWidgetData) { 2377 if (!pWidgetData) {
2379 return; 2378 return;
2380 } 2379 }
2381 if (bSetting) { 2380 if (bSetting) {
2382 CFX_ByteString bsValue; 2381 CFX_ByteString bsValue;
2383 FXJSE_Value_ToUTF8String(pValue, bsValue); 2382 FXJSE_Value_ToUTF8String(pValue, bsValue);
2384 pWidgetData->SetSelectedMemberByValue( 2383 pWidgetData->SetSelectedMemberByValue(
2385 CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC(), TRUE, TRUE); 2384 CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC(), true, TRUE,
2385 TRUE);
2386 } else { 2386 } else {
2387 CFX_WideString wsValue = GetScriptContent(TRUE); 2387 CFX_WideString wsValue = GetScriptContent(TRUE);
2388 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); 2388 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode();
2389 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { 2389 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) {
2390 FXJSE_Value_SetNull(pValue); 2390 FXJSE_Value_SetNull(pValue);
2391 } else { 2391 } else {
2392 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); 2392 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC());
2393 } 2393 }
2394 } 2394 }
2395 } 2395 }
2396 void CXFA_Node::Script_ExclGroup_Transient(CFXJSE_Value* pValue, 2396 void CXFA_Node::Script_ExclGroup_Transient(CFXJSE_Value* pValue,
2397 FX_BOOL bSetting, 2397 FX_BOOL bSetting,
2398 XFA_ATTRIBUTE eAttribute) {} 2398 XFA_ATTRIBUTE eAttribute) {}
2399 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { 2399 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) {
2400 int32_t argc = pArguments->GetLength(); 2400 int32_t argc = pArguments->GetLength();
2401 if (argc == 1) { 2401 if (argc == 1) {
2402 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2402 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2403 execSingleEventByName( 2403 execSingleEventByName(
2404 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2404 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2405 XFA_ELEMENT_ExclGroup); 2405 XFA_ELEMENT_ExclGroup);
2406 } else { 2406 } else {
2407 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2407 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2408 } 2408 }
2409 } 2409 }
2410
2410 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { 2411 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) {
2411 int32_t argc = pArguments->GetLength(); 2412 int32_t argc = pArguments->GetLength();
2412 if ((argc == 0) || (argc == 1)) { 2413 if (argc < 0 || argc > 1) {
2413 CXFA_WidgetData* pWidgetData = GetWidgetData();
2414 if (!pWidgetData) {
2415 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2416 } else {
2417 CXFA_Node* pReturnNode = NULL;
2418 if (argc == 0) {
2419 pReturnNode = pWidgetData->GetSelectedMember();
2420 } else {
2421 CFX_ByteString szName;
2422 szName = pArguments->GetUTF8String(0);
2423 pReturnNode = pWidgetData->SetSelectedMember(
2424 CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC());
2425 }
2426 if (pReturnNode) {
2427 FXJSE_Value_Set(
2428 pArguments->GetReturnValue(),
2429 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode));
2430 } else {
2431 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2432 }
2433 }
2434 } else {
2435 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2414 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
2436 L"selectedMember"); 2415 L"selectedMember");
2416 return;
2437 } 2417 }
2418
2419 CXFA_WidgetData* pWidgetData = GetWidgetData();
2420 if (!pWidgetData) {
2421 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2422 return;
2423 }
2424
2425 CXFA_Node* pReturnNode = nullptr;
2426 if (argc == 0) {
2427 pReturnNode = pWidgetData->GetSelectedMember();
2428 } else {
2429 CFX_ByteString szName;
2430 szName = pArguments->GetUTF8String(0);
2431 pReturnNode = pWidgetData->SetSelectedMember(
2432 CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC(), true);
2433 }
2434 if (!pReturnNode) {
2435 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2436 return;
2437 }
2438 FXJSE_Value_Set(
2439 pArguments->GetReturnValue(),
2440 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode));
2438 } 2441 }
2442
2439 void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { 2443 void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) {
2440 int32_t argc = pArguments->GetLength(); 2444 int32_t argc = pArguments->GetLength();
2441 if (argc == 0) { 2445 if (argc == 0) {
2442 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2446 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2443 if (!pNotify) { 2447 if (!pNotify) {
2444 return; 2448 return;
2445 } 2449 }
2446 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize); 2450 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize);
2447 } else { 2451 } else {
2448 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2452 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
(...skipping 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after
5362 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5366 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5363 } 5367 }
5364 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5368 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5365 return m_pAttachNode->RemoveChild(pNode); 5369 return m_pAttachNode->RemoveChild(pNode);
5366 } 5370 }
5367 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5371 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5368 return m_pAttachNode->GetChild( 5372 return m_pAttachNode->GetChild(
5369 iIndex, XFA_ELEMENT_UNKNOWN, 5373 iIndex, XFA_ELEMENT_UNKNOWN,
5370 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5374 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5371 } 5375 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_document_datamerger_imp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698