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

Side by Side Diff: fpdfsdk/src/javascript/PublicMethods.cpp

Issue 1248153004: Merge to XFA: FX_BOOL combo patch. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: CTTFontDesc::ReleaseFace() mismatch Created 5 years, 4 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/src/fpdf_transformpage.cpp ('k') | public/fpdf_sysfontinfo.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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 1060
1061 ////////////////////////////////////////////////////// 1061 //////////////////////////////////////////////////////
1062 //for processing decimal places 1062 //for processing decimal places
1063 strValue.Replace(",", "."); 1063 strValue.Replace(",", ".");
1064 double dValue = atof(strValue); 1064 double dValue = atof(strValue);
1065 if (iDec > 0) 1065 if (iDec > 0)
1066 dValue += DOUBLE_CORRECT;// 1066 dValue += DOUBLE_CORRECT;//
1067 1067
1068 int iDec2; 1068 int iDec2;
1069 » FX_BOOL bNagative = FALSE; 1069 » int iNegative = 0;
1070 1070
1071 » strValue = fcvt(dValue,iDec,&iDec2,&bNagative); 1071 » strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
1072 if (strValue.IsEmpty()) 1072 if (strValue.IsEmpty())
1073 { 1073 {
1074 dValue = 0; 1074 dValue = 0;
1075 » » strValue = fcvt(dValue,iDec,&iDec2,&bNagative); 1075 » » strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
1076 if (strValue.IsEmpty()) 1076 if (strValue.IsEmpty())
1077 { 1077 {
1078 strValue = "0"; 1078 strValue = "0";
1079 iDec2 = 1; 1079 iDec2 = 1;
1080 } 1080 }
1081 1081
1082 } 1082 }
1083 1083
1084 if (iDec2 < 0) 1084 if (iDec2 < 0)
1085 { 1085 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 strValue.Insert(iDec2, '0'); 1118 strValue.Insert(iDec2, '0');
1119 } 1119 }
1120 if (iSepStyle == 0 || iSepStyle == 2) 1120 if (iSepStyle == 0 || iSepStyle == 2)
1121 { 1121 {
1122 char cSeperator; 1122 char cSeperator;
1123 if (iSepStyle == 0) 1123 if (iSepStyle == 0)
1124 cSeperator = ','; 1124 cSeperator = ',';
1125 else 1125 else
1126 cSeperator = '.'; 1126 cSeperator = '.';
1127 1127
1128 » » int iDecPositive,iDecNagative; 1128 » » int iDecPositive,iDecNegative;
1129 iDecPositive = iDec2; 1129 iDecPositive = iDec2;
1130 » » iDecNagative = iDec2; 1130 » » iDecNegative = iDec2;
1131 1131
1132 for (iDecPositive = iDec2 -3; iDecPositive > 0;iDecPositive -= 3 ) 1132 for (iDecPositive = iDec2 -3; iDecPositive > 0;iDecPositive -= 3 )
1133 { 1133 {
1134 strValue.Insert(iDecPositive, cSeperator); 1134 strValue.Insert(iDecPositive, cSeperator);
1135 iMax++; 1135 iMax++;
1136 } 1136 }
1137 } 1137 }
1138 1138
1139 ////////////////////////////////////////////////////////////////////// 1139 //////////////////////////////////////////////////////////////////////
1140 //for processing currency string 1140 //for processing currency string
1141 1141
1142 Value = CFX_WideString::FromLocal(strValue); 1142 Value = CFX_WideString::FromLocal(strValue);
1143 std::wstring strValue2 = Value.c_str(); 1143 std::wstring strValue2 = Value.c_str();
1144 1144
1145 if (bCurrencyPrepend) 1145 if (bCurrencyPrepend)
1146 strValue2 = wstrCurrency + strValue2; 1146 strValue2 = wstrCurrency + strValue2;
1147 else 1147 else
1148 strValue2 = strValue2 + wstrCurrency; 1148 strValue2 = strValue2 + wstrCurrency;
1149 1149
1150 1150
1151 1151
1152 //////////////////////////////////////////////////////////////////////// / 1152 //////////////////////////////////////////////////////////////////////// /
1153 //for processing negative style 1153 //for processing negative style
1154 » if (bNagative) 1154 » if (iNegative)
1155 { 1155 {
1156 if (iNegStyle == 0) 1156 if (iNegStyle == 0)
1157 { 1157 {
1158 strValue2.insert(0,L"-"); 1158 strValue2.insert(0,L"-");
1159 } 1159 }
1160 if (iNegStyle == 2 || iNegStyle == 3) 1160 if (iNegStyle == 2 || iNegStyle == 3)
1161 { 1161 {
1162 strValue2.insert(0,L"("); 1162 strValue2.insert(0,L"(");
1163 strValue2.insert(strValue2.length(),L")"); 1163 strValue2.insert(strValue2.length(),L")");
1164 } 1164 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 iSepStyle = 0; 1387 iSepStyle = 0;
1388 1388
1389 ////////////////////////////////////////////////////// 1389 //////////////////////////////////////////////////////
1390 //for processing decimal places 1390 //for processing decimal places
1391 double dValue = atof(strValue); 1391 double dValue = atof(strValue);
1392 dValue *= 100; 1392 dValue *= 100;
1393 if (iDec > 0) 1393 if (iDec > 0)
1394 dValue += DOUBLE_CORRECT;//УÕý 1394 dValue += DOUBLE_CORRECT;//УÕý
1395 1395
1396 int iDec2; 1396 int iDec2;
1397 » FX_BOOL bNagative = FALSE; 1397 » int iNegative = 0;
1398 » strValue = fcvt(dValue,iDec,&iDec2,&bNagative); 1398 » strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
1399 if (strValue.IsEmpty()) 1399 if (strValue.IsEmpty())
1400 { 1400 {
1401 dValue = 0; 1401 dValue = 0;
1402 » » strValue = fcvt(dValue,iDec,&iDec2,&bNagative); 1402 » » strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
1403 } 1403 }
1404 1404
1405 if (iDec2 < 0) 1405 if (iDec2 < 0)
1406 { 1406 {
1407 for (int iNum = 0; iNum < abs(iDec2); iNum++) 1407 for (int iNum = 0; iNum < abs(iDec2); iNum++)
1408 { 1408 {
1409 strValue = "0" + strValue; 1409 strValue = "0" + strValue;
1410 } 1410 }
1411 iDec2 = 0; 1411 iDec2 = 0;
1412 1412
(...skipping 26 matching lines...) Expand all
1439 strValue.Insert(iDec2, '0'); 1439 strValue.Insert(iDec2, '0');
1440 } 1440 }
1441 if (iSepStyle == 0 || iSepStyle == 2) 1441 if (iSepStyle == 0 || iSepStyle == 2)
1442 { 1442 {
1443 char cSeperator; 1443 char cSeperator;
1444 if (iSepStyle == 0) 1444 if (iSepStyle == 0)
1445 cSeperator = ','; 1445 cSeperator = ',';
1446 else 1446 else
1447 cSeperator = '.'; 1447 cSeperator = '.';
1448 1448
1449 » » int iDecPositive,iDecNagative; 1449 » » int iDecPositive,iDecNegative;
1450 iDecPositive = iDec2; 1450 iDecPositive = iDec2;
1451 » » iDecNagative = iDec2; 1451 » » iDecNegative = iDec2;
1452 1452
1453 for (iDecPositive = iDec2 -3; iDecPositive > 0; iDecPositive -= 3) 1453 for (iDecPositive = iDec2 -3; iDecPositive > 0; iDecPositive -= 3)
1454 { 1454 {
1455 strValue.Insert(iDecPositive,cSeperator); 1455 strValue.Insert(iDecPositive,cSeperator);
1456 iMax++; 1456 iMax++;
1457 } 1457 }
1458 } 1458 }
1459 //////////////////////////////////////////////////////////////////// 1459 ////////////////////////////////////////////////////////////////////
1460 » //nagative mark 1460 » //negative mark
1461 » if(bNagative) 1461 » if (iNegative)
1462 strValue = "-" + strValue; 1462 strValue = "-" + strValue;
1463 strValue += "%"; 1463 strValue += "%";
1464 Value = CFX_WideString::FromLocal(strValue); 1464 Value = CFX_WideString::FromLocal(strValue);
1465 #endif 1465 #endif
1466 return TRUE; 1466 return TRUE;
1467 } 1467 }
1468 //AFPercent_Keystroke(nDec, sepStyle) 1468 //AFPercent_Keystroke(nDec, sepStyle)
1469 FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(IFXJS_Context* cc, const CJS_Para meters& params, CJS_Value& vRet, CFX_WideString& sError) 1469 FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(IFXJS_Context* cc, const CJS_Para meters& params, CJS_Value& vRet, CFX_WideString& sError)
1470 { 1470 {
1471 return AFNumber_Keystroke(cc,params,vRet,sError); 1471 return AFNumber_Keystroke(cc,params,vRet,sError);
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str())); 2266 nums.SetElement(nIndex,CJS_Value(isolate,sPart.c_str()));
2267 } 2267 }
2268 2268
2269 if (nums.GetLength() > 0) 2269 if (nums.GetLength() > 0)
2270 vRet = nums; 2270 vRet = nums;
2271 else 2271 else
2272 vRet.SetNull(); 2272 vRet.SetNull();
2273 2273
2274 return TRUE; 2274 return TRUE;
2275 } 2275 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | public/fpdf_sysfontinfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698