From cf2e4c3ecc2a66f0a01e6a1d8c20dcb73e4b8024 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 11 Jun 2015 14:00:52 -0700 Subject: Remove trailing whitespaces in fpdfsdk. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1173343004. --- fpdfsdk/src/javascript/Consts.cpp | 4 +- fpdfsdk/src/javascript/Document.cpp | 2 +- fpdfsdk/src/javascript/Field.cpp | 190 ++++++++++++++--------------- fpdfsdk/src/javascript/Icon.cpp | 4 +- fpdfsdk/src/javascript/JS_Context.cpp | 16 +-- fpdfsdk/src/javascript/JS_EventHandler.cpp | 92 +++++++------- fpdfsdk/src/javascript/JS_GlobalData.cpp | 14 +-- fpdfsdk/src/javascript/JS_Object.cpp | 6 +- fpdfsdk/src/javascript/JS_Runtime.cpp | 22 ++-- fpdfsdk/src/javascript/JS_Value.cpp | 34 +++--- fpdfsdk/src/javascript/color.cpp | 6 +- fpdfsdk/src/javascript/console.cpp | 2 +- fpdfsdk/src/javascript/event.cpp | 14 +-- fpdfsdk/src/javascript/global.cpp | 22 ++-- fpdfsdk/src/javascript/util.cpp | 16 +-- 15 files changed, 222 insertions(+), 222 deletions(-) (limited to 'fpdfsdk/src/javascript') diff --git a/fpdfsdk/src/javascript/Consts.cpp b/fpdfsdk/src/javascript/Consts.cpp index cea9f9a4c9..9edb6f443b 100644 --- a/fpdfsdk/src/javascript/Consts.cpp +++ b/fpdfsdk/src/javascript/Consts.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -168,7 +168,7 @@ int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_COMMA_SEP"; const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*,?\\d*"}; - + DEFINE_GLOBAL_ARRAY(pRuntime); } diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 230a4ce49c..7c77e82e06 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -1981,7 +1981,7 @@ void Document::DoAnnotDelay() } } -CJS_Document* Document::GetCJSDoc() const +CJS_Document* Document::GetCJSDoc() const { return static_cast(m_pJSObject); } diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 576e12c021..8393d9d5ff 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -165,7 +165,7 @@ void Field::ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring & } } - strFieldName = strFieldNameParsed.substr(0,iStart); + strFieldName = strFieldNameParsed.substr(0,iStart); } FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldName) @@ -176,8 +176,8 @@ FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldNam m_pDocument = pDocument->GetReaderDoc(); ASSERT(m_pDocument != NULL); - m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || - m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || + m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || + m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pDocument->GetPermissions(FPDFPERM_MODIFY); CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); @@ -195,7 +195,7 @@ FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldNam int iControlNo = -1; ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo); if (iControlNo == -1) return FALSE; - + m_FieldName = strFieldName.c_str(); m_nFormControlIndex = iControlNo; return TRUE; @@ -233,7 +233,7 @@ void Field::GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& Field Field::GetFormFields(m_pDocument, csFieldName, FieldArray); } -void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, +void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh) { ASSERT(pDocument != NULL); @@ -281,20 +281,20 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormFi { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt(i); ASSERT(pWidget != NULL); - + CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm(); CPDFSDK_Document* pDoc = pInterForm->GetDocument(); // CReader_Page* pPage = pWidget->GetPage(); ASSERT(pDoc != NULL); pDoc->UpdateAllViews(NULL, pWidget); } - } - + } + if (bChangeMark) pDocument->SetChangeMark(); } -void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl, +void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl, FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh) { ASSERT(pDocument != NULL); @@ -304,7 +304,7 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFo ASSERT(pInterForm != NULL); CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); - + if (pWidget) { if (bResetAP) @@ -430,14 +430,14 @@ FX_BOOL Field::alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s return TRUE; } -void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, +void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string) { //Not supported. } FX_BOOL Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) -{ +{ ASSERT(m_pDocument != NULL); if (vp.IsSetting()) @@ -496,7 +496,7 @@ FX_BOOL Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& return TRUE; } -void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, +void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string) { ASSERT(pDocument != NULL); @@ -578,7 +578,7 @@ FX_BOOL Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString } } else - { + { CFX_PtrArray FieldArray; GetFormFields(m_FieldName,FieldArray); if (FieldArray.GetSize() <= 0) return FALSE; @@ -695,7 +695,7 @@ FX_BOOL Field::buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr if (!pFormControl)return FALSE; CPDF_IconFit IconFit = pFormControl->GetIconFit(); - vp << IconFit.GetFittingBounds(); + vp << IconFit.GetFittingBounds(); } return TRUE; @@ -868,7 +868,7 @@ FX_BOOL Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ASSERT(m_pDocument != NULL); if (vp.IsSetting()) - { + { if (!m_bCanSet) return FALSE; int nVP; @@ -975,7 +975,7 @@ FX_BOOL Field::comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError } } else - { + { CFX_PtrArray FieldArray; GetFormFields(m_FieldName,FieldArray); if (FieldArray.GetSize() <= 0) return FALSE; @@ -1075,7 +1075,7 @@ FX_BOOL Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid array.Add(iSelecting); } } - + if (m_bDelay) { AddDelay_WordArray(FP_CURRENTVALUEINDICES, array); @@ -1115,7 +1115,7 @@ FX_BOOL Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid return TRUE; } -void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, +void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array) { ASSERT(pDocument != NULL); @@ -1160,7 +1160,7 @@ FX_BOOL Field::defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString { if (!m_bCanSet) return FALSE; - ; + ; } else { @@ -1183,7 +1183,7 @@ FX_BOOL Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString if (!m_bCanSet) return FALSE; CFX_WideString WideStr; - vp >> WideStr; + vp >> WideStr; if (m_bDelay) { @@ -1203,7 +1203,7 @@ FX_BOOL Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || + if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) return FALSE; @@ -1284,7 +1284,7 @@ FX_BOOL Field::doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD && + if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD && pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) return FALSE; @@ -1313,7 +1313,7 @@ FX_BOOL Field::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; - + bool bVP; vp >> bVP; @@ -1335,7 +1335,7 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr if (!m_bCanSet) return FALSE; int nVP; - vp >> nVP; + vp >> nVP; if (m_bDelay) { @@ -1363,11 +1363,11 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr FX_DWORD dwFlag = pWidget->GetFlags(); - if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) + if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) { vp << (int32_t)1; } - else + else { if (ANNOTFLAG_PRINT & dwFlag) { @@ -1383,7 +1383,7 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr else { vp << (int32_t)2; - } + } } } @@ -1422,7 +1422,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel dwFlag &= (~ANNOTFLAG_INVISIBLE); dwFlag &= (~ANNOTFLAG_HIDDEN); dwFlag &= (~ANNOTFLAG_NOVIEW); - dwFlag |= ANNOTFLAG_PRINT; + dwFlag |= ANNOTFLAG_PRINT; break; case 1: dwFlag &= (~ANNOTFLAG_INVISIBLE); @@ -1440,7 +1440,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel dwFlag |= ANNOTFLAG_PRINT; dwFlag &= (~ANNOTFLAG_HIDDEN); break; - } + } if (dwFlag != pWidget->GetFlags()) { @@ -1448,8 +1448,8 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel bSet = TRUE; } } - } - + } + if (bSet) UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); } else @@ -1467,7 +1467,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel dwFlag &= (~ANNOTFLAG_INVISIBLE); dwFlag &= (~ANNOTFLAG_HIDDEN); dwFlag &= (~ANNOTFLAG_NOVIEW); - dwFlag |= ANNOTFLAG_PRINT; + dwFlag |= ANNOTFLAG_PRINT; break; case 1: dwFlag &= (~ANNOTFLAG_INVISIBLE); @@ -1485,7 +1485,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel dwFlag |= ANNOTFLAG_PRINT; dwFlag &= (~ANNOTFLAG_HIDDEN); break; - } + } if (dwFlag != pWidget->GetFlags()) { pWidget->SetFlags(dwFlag); @@ -1548,12 +1548,12 @@ FX_BOOL Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && + if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) return FALSE; if (vp.IsSetting()) - { + { if (!m_bCanSet) return FALSE; if (!vp.IsArrayObject())return FALSE; } @@ -1734,11 +1734,11 @@ FX_BOOL Field::hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr FX_DWORD dwFlags = pWidget->GetFlags(); - if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) + if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) { vp << true; } - else + else vp << false; } @@ -1766,9 +1766,9 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField for (int j=0,jsz = pFormField->CountControls(); jGetWidget(pFormField->GetControl(j))) - { + { FX_DWORD dwFlags = pWidget->GetFlags(); - + if (b) { dwFlags &= (~ANNOTFLAG_INVISIBLE); @@ -1780,19 +1780,19 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField dwFlags &= (~ANNOTFLAG_INVISIBLE); dwFlags &= (~ANNOTFLAG_HIDDEN); dwFlags &= (~ANNOTFLAG_NOVIEW); - dwFlags |= ANNOTFLAG_PRINT; + dwFlags |= ANNOTFLAG_PRINT; } if (dwFlags != pWidget->GetFlags()) { - pWidget->SetFlags(dwFlags); + pWidget->SetFlags(dwFlags); bSet = TRUE; } } } if (bSet) - UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); + UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); } else { @@ -1802,7 +1802,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { FX_DWORD dwFlags = pWidget->GetFlags(); - + if (b) { dwFlags &= (~ANNOTFLAG_INVISIBLE); @@ -1814,13 +1814,13 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField dwFlags &= (~ANNOTFLAG_INVISIBLE); dwFlags &= (~ANNOTFLAG_HIDDEN); dwFlags &= (~ANNOTFLAG_NOVIEW); - dwFlags |= ANNOTFLAG_PRINT; + dwFlags |= ANNOTFLAG_PRINT; } if (dwFlags != pWidget->GetFlags()) { - pWidget->SetFlags(dwFlags); - UpdateFormControl(pDocument, pFormControl, TRUE, FALSE, TRUE); + pWidget->SetFlags(dwFlags); + UpdateFormControl(pDocument, pFormControl, TRUE, FALSE, TRUE); } } } @@ -1960,7 +1960,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFi { CPDF_FormControl* pFormControl = pFormField->GetControl(j); ASSERT(pFormControl != NULL); - + if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { if (number != pWidget->GetBorderWidth()) @@ -2096,7 +2096,7 @@ FX_BOOL Field::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError } FX_BOOL Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) -{ +{ CFX_PtrArray FieldArray; GetFormFields(m_FieldName, FieldArray); if (FieldArray.GetSize() <= 0) return FALSE; @@ -2178,7 +2178,7 @@ FX_BOOL Field::password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE else { Field::SetPassword(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); - } + } } else { @@ -2280,7 +2280,7 @@ FX_BOOL Field::print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro { CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - + CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField)); if (!pWidget) return FALSE; @@ -2388,7 +2388,7 @@ FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError else { Field::SetRect(m_pDocument, m_FieldName, m_nFormControlIndex, crRect); - } + } } else { @@ -2418,7 +2418,7 @@ FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError rcArray.SetElement(2,Lower_Rightx); rcArray.SetElement(3,Lower_Righty); - vp << rcArray; + vp << rcArray; } return TRUE; @@ -2484,7 +2484,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { CPDF_Rect crRect = rect; - + CPDF_Page* pPDFPage = pWidget->GetPDFPage(); ASSERT(pPDFPage != NULL); @@ -2563,7 +2563,7 @@ FX_BOOL Field::richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE else { Field::SetRichText(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); - } + } } else { @@ -2629,7 +2629,7 @@ FX_BOOL Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE else { Field::SetRotation(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); - } + } } else { @@ -2677,7 +2677,7 @@ FX_BOOL Field::strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& else { Field::SetStrokeColor(m_pDocument, m_FieldName, m_nFormControlIndex, color); - } + } } else { @@ -2751,7 +2751,7 @@ FX_BOOL Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro else { Field::SetStyle(m_pDocument, m_FieldName, m_nFormControlIndex, csBCaption); - } + } } else { @@ -2762,7 +2762,7 @@ FX_BOOL Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && + if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) return FALSE; @@ -2799,7 +2799,7 @@ FX_BOOL Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro return TRUE; } -void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, +void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string) { //Not supported. @@ -2832,7 +2832,7 @@ FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s else { Field::SetTextColor(m_pDocument, m_FieldName, m_nFormControlIndex, color); - } + } } else { @@ -2845,7 +2845,7 @@ FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl)return FALSE; - + int iColorType; FX_ARGB color; CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance(); @@ -2862,7 +2862,7 @@ FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s CJS_Array crArray(m_isolate); color::ConvertPWLColorToArray(crRet, crArray); - vp << crArray; + vp << crArray; } return TRUE; @@ -2892,7 +2892,7 @@ FX_BOOL Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE else { Field::SetTextFont(m_pDocument, m_FieldName, m_nFormControlIndex, csFontName); - } + } } else { @@ -2908,8 +2908,8 @@ FX_BOOL Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE int nFieldType = pFormField->GetFieldType(); - if (nFieldType == FIELDTYPE_PUSHBUTTON || - nFieldType == FIELDTYPE_COMBOBOX || + if (nFieldType == FIELDTYPE_PUSHBUTTON || + nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX || nFieldType == FIELDTYPE_TEXTFIELD) { @@ -2948,7 +2948,7 @@ FX_BOOL Field::textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE else { Field::SetTextSize(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); - } + } } else { @@ -3044,7 +3044,7 @@ FX_BOOL Field::userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE else { Field::SetUserName(m_pDocument, m_FieldName, m_nFormControlIndex, swName); - } + } } else { @@ -3071,7 +3071,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro ASSERT(m_pDocument != NULL); if (vp.IsSetting()) - { + { if (!m_bCanSet) return FALSE; CJS_WideStringArray strArray; @@ -3157,7 +3157,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro else { CFX_WideString swValue = pFormField->GetValue(); - + double dRet; FX_BOOL bDot; if (CJS_PublicMethods::ConvertStringToNumber(swValue.c_str(), dRet, bDot)) @@ -3168,7 +3168,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro vp << dRet; } else - vp << swValue; + vp << swValue; } } break; @@ -3200,7 +3200,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro continue; } if (!bFind) - vp << L"Off"; + vp << L"Off"; } break; default: @@ -3212,7 +3212,7 @@ FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro return TRUE; } -void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, +void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray) { ASSERT(pDocument != NULL); @@ -3237,7 +3237,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN if (pFormField->GetValue() != strArray.GetAt(0)) { CFX_WideString WideString = strArray.GetAt(0); - pFormField->SetValue(strArray.GetAt(0), TRUE); + pFormField->SetValue(strArray.GetAt(0), TRUE); UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); } break; @@ -3246,7 +3246,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN { if (pFormField->GetValue() != strArray.GetAt(0)) { - pFormField->SetValue(strArray.GetAt(0), TRUE); + pFormField->SetValue(strArray.GetAt(0), TRUE); UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE); } } @@ -3279,7 +3279,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN } } break; - default: + default: break; } } @@ -3349,9 +3349,9 @@ FX_BOOL Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& pa CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); ASSERT(pApp != NULL); - if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && + if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) - { + { CFX_WideString wsFileName = pApp->JS_fieldBrowse(); if(!wsFileName.IsEmpty()) { @@ -3359,7 +3359,7 @@ FX_BOOL Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& pa UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); } } - else + else return FALSE; return TRUE; @@ -3381,13 +3381,13 @@ FX_BOOL Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - + if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) return FALSE; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl)return FALSE; - + if (nface == 0) vRet = pFormControl->GetNormalCaption().c_str(); else if (nface == 1) @@ -3410,14 +3410,14 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ int iSize = params.size(); if (iSize >= 1) nface = params[0].ToInt(); - + CFX_PtrArray FieldArray; GetFormFields(m_FieldName,FieldArray); if (FieldArray.GetSize() <= 0) return FALSE; CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - + if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) return FALSE; @@ -3429,10 +3429,10 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ CJS_Runtime* pRuntime = pContext->GetJSRuntime(); ASSERT(pRuntime != NULL); - + JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Icon")); ASSERT(pObj.IsEmpty() == FALSE); - + CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); ASSERT(pJS_Icon != NULL); @@ -3459,7 +3459,7 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { -#if 0 +#if 0 ASSERT(m_pDocument != NULL); CFX_PtrArray FieldArray; @@ -3473,7 +3473,7 @@ FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, ASSERT(pEnv); CFX_WideString sIconFileName = pEnv->JS_fieldBrowse(); - if (sIconFileName.IsEmpty()) + if (sIconFileName.IsEmpty()) { vRet = 1; return TRUE; @@ -3483,7 +3483,7 @@ FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, ASSERT(pInterForm != NULL); CPDF_Stream* pStream = pInterForm->LoadImageFromFile(sIconFileName); - if (!pStream) + if (!pStream) { vRet = -1; return TRUE; @@ -3617,7 +3617,7 @@ FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ASSERT(pFormField != NULL); swSort.Add(new CFX_WideString(pFormField->GetFullName())); - + } swSort.Sort(JS_COMPARESTRING); @@ -3637,11 +3637,11 @@ FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pObj); ASSERT(pJSField != NULL); - Field* pField = (Field*)pJSField->GetEmbedObject(); + Field* pField = (Field*)pJSField->GetEmbedObject(); ASSERT(pField != NULL); pField->AttachField(m_pJSDoc, *pStr); - + CJS_Value FormFieldValue(m_isolate); FormFieldValue = pJSField; FormFieldArray.SetElement(j, FormFieldValue); @@ -3653,7 +3653,7 @@ FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val swSort.RemoveAll(); return TRUE; } - + FX_BOOL Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { ASSERT(m_pDocument != NULL); @@ -3800,7 +3800,7 @@ FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val CPDFSDK_Widget* pWidget = NULL; if (nCount == 1) - { + { pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); } else @@ -3815,7 +3815,7 @@ FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val for (int32_t i=0; iGetWidget(pFormField->GetControl(i))) - { + { if (pTempWidget->GetPDFPage() == pCurPageView->GetPDFPage()) { pWidget = pTempWidget; diff --git a/fpdfsdk/src/javascript/Icon.cpp b/fpdfsdk/src/javascript/Icon.cpp index 8c05116643..6b3e02e1ec 100644 --- a/fpdfsdk/src/javascript/Icon.cpp +++ b/fpdfsdk/src/javascript/Icon.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -20,7 +20,7 @@ BEGIN_JS_STATIC_PROP(CJS_Icon) JS_STATIC_PROP_ENTRY(name) END_JS_STATIC_PROP() -BEGIN_JS_STATIC_METHOD(CJS_Icon) +BEGIN_JS_STATIC_METHOD(CJS_Icon) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Icon,Icon) diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp index 362844509f..924ab1ee19 100644 --- a/fpdfsdk/src/javascript/JS_Context.cpp +++ b/fpdfsdk/src/javascript/JS_Context.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -14,7 +14,7 @@ /* -------------------------- CJS_Context -------------------------- */ -CJS_Context::CJS_Context(CJS_Runtime* pRuntime) : +CJS_Context::CJS_Context(CJS_Runtime* pRuntime) : m_pRuntime(pRuntime), m_bBusy(FALSE), m_bMsgBoxEnable(TRUE) @@ -41,17 +41,17 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() CPDFDoc_Environment* CJS_Context::GetReaderApp() { ASSERT(m_pRuntime != NULL); - + return m_pRuntime->GetReaderApp(); } FX_BOOL CJS_Context::DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info) { if (m_bBusy) - { + { info = JSGetStringFromID(this, IDS_STRING_JSBUSY); return FALSE; - } + } m_bBusy = TRUE; @@ -66,7 +66,7 @@ FX_BOOL CJS_Context::DoJob(int nMode, const CFX_WideString& script, CFX_WideStri } FXJSErr error ={NULL,NULL, 0}; - int nRet = 0; + int nRet = 0; if (script.GetLength() > 0) { @@ -99,7 +99,7 @@ FX_BOOL CJS_Context::DoJob(int nMode, const CFX_WideString& script, CFX_WideStri m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(), m_pEventHandler->EventType()); m_pEventHandler->Destroy(); - m_bBusy = FALSE; + m_bBusy = FALSE; return nRet >= 0; } @@ -342,7 +342,7 @@ void CJS_Context::OnExternal_Exec() void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { - ASSERT(m_pEventHandler != NULL); + ASSERT(m_pEventHandler != NULL); m_pEventHandler->OnBatchExec(pTarget); } diff --git a/fpdfsdk/src/javascript/JS_EventHandler.cpp b/fpdfsdk/src/javascript/JS_EventHandler.cpp index 1fab82f74e..7d27c66f6b 100644 --- a/fpdfsdk/src/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/src/javascript/JS_EventHandler.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -57,41 +57,41 @@ void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& Initial(JET_DOC_OPEN); m_pTargetDoc = pDoc; - m_strTargetName = strTargetName; + m_strTargetName = strTargetName; } void CJS_EventHandler::OnDoc_WillPrint(CPDFSDK_Document* pDoc) { Initial(JET_DOC_WILLPRINT); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnDoc_DidPrint(CPDFSDK_Document* pDoc) { Initial(JET_DOC_DIDPRINT); - - m_pTargetDoc = pDoc; + + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnDoc_WillSave(CPDFSDK_Document* pDoc) { Initial(JET_DOC_WILLSAVE); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnDoc_DidSave(CPDFSDK_Document* pDoc) { - Initial(JET_DOC_DIDSAVE); - - m_pTargetDoc = pDoc; + Initial(JET_DOC_DIDSAVE); + + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnDoc_WillClose(CPDFSDK_Document* pDoc) { Initial(JET_DOC_WILLCLOSE); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnPage_Open(CPDFSDK_Document* pDoc) @@ -104,21 +104,21 @@ void CJS_EventHandler::OnPage_Open(CPDFSDK_Document* pDoc) void CJS_EventHandler::OnPage_Close(CPDFSDK_Document* pDoc) { Initial(JET_PAGE_CLOSE); - + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnPage_InView(CPDFSDK_Document* pDoc) { Initial(JET_PAGE_INVIEW); - + m_pTargetDoc = pDoc; } void CJS_EventHandler::OnPage_OutView(CPDFSDK_Document* pDoc) { Initial(JET_PAGE_OUTVIEW); - + m_pTargetDoc = pDoc; } @@ -140,16 +140,16 @@ void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF m_bModifier = bModifier; m_bShift = bShift; ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); + m_strTargetName = pTarget->GetFullName(); } void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) { Initial(JET_FIELD_MOUSEDOWN); m_eEventType = JET_FIELD_MOUSEDOWN; - + m_bModifier = bModifier; - m_bShift = bShift; + m_bShift = bShift; ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -164,13 +164,13 @@ void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_F m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, +void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) { Initial(JET_FIELD_FOCUS); m_bModifier = bModifier; - m_bShift = bShift; + m_bShift = bShift; ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = (CFX_WideString*)&Value; @@ -185,7 +185,7 @@ void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_Form m_bShift = bShift; ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); - m_pValue = (CFX_WideString*)&Value; + m_pValue = (CFX_WideString*)&Value; } void CJS_EventHandler::OnField_Keystroke(CFX_WideString &strChange, @@ -196,7 +196,7 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString &strChange, FX_BOOL bFieldFull, FX_BOOL& bRc) { Initial(JET_FIELD_KEYSTROKE); - + m_nCommitKey = 0; m_pWideStrChange = &strChange; m_WideStrChangeEx = strChangeEx; @@ -204,11 +204,11 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString &strChange, m_bModifier = bModifier; m_pISelEnd = &nSelEnd; m_pISelStart = &nSelStart; - m_bShift = bShift; + m_bShift = bShift; ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; - m_bWillCommit = bWillCommit; + m_bWillCommit = bWillCommit; m_pbRc = &bRc; m_bFieldFull = bFieldFull; } @@ -218,19 +218,19 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, const CFX_Wid CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) { Initial(JET_FIELD_VALIDATE); - + m_pWideStrChange = &strChange; - m_WideStrChangeEx = strChangeEx; + m_WideStrChangeEx = strChangeEx; m_bKeyDown = bKeyDown; m_bModifier = bModifier; m_bShift = bShift; ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); - m_pValue = &Value; - m_pbRc = &bRc; + m_pValue = &Value; + m_pbRc = &bRc; } -void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, +void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) { Initial(JET_FIELD_CALCULATE); @@ -248,7 +248,7 @@ void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, FX_BOOL bWillCommit) { Initial(JET_FIELD_FORMAT); - + m_nCommitKey = 0; ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); @@ -349,15 +349,15 @@ void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFS void CJS_EventHandler::OnLink_MouseUp(CPDFSDK_Document* pTarget) { Initial(JET_LINK_MOUSEUP); - - m_pTargetDoc = pTarget; + + m_pTargetDoc = pTarget; } void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) { Initial(JET_BOOKMARK_MOUSEUP); - m_pTargetBookMark = pBookMark; + m_pTargetBookMark = pBookMark; } void CJS_EventHandler::OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName) @@ -377,7 +377,7 @@ void CJS_EventHandler::OnBatchExec(CPDFSDK_Document* pTarget) { Initial(JET_BATCH_EXEC); - m_pTargetDoc = pTarget; + m_pTargetDoc = pTarget; } void CJS_EventHandler::OnConsole_Exec() @@ -477,13 +477,13 @@ const FX_WCHAR* CJS_EventHandler::Name() case JET_DOC_WILLPRINT: return L"WillPrint"; case JET_DOC_WILLSAVE: return L"WillSave"; case JET_EXTERNAL_EXEC: return L"Exec"; - case JET_FIELD_FOCUS: + case JET_FIELD_FOCUS: case JET_SCREEN_FOCUS: return L"Focus"; - case JET_FIELD_BLUR: + case JET_FIELD_BLUR: case JET_SCREEN_BLUR: return L"Blur"; case JET_FIELD_MOUSEDOWN: case JET_SCREEN_MOUSEDOWN: return L"Mouse Down"; - case JET_FIELD_MOUSEUP: + case JET_FIELD_MOUSEUP: case JET_SCREEN_MOUSEUP: return L"Mouse Up"; case JET_FIELD_MOUSEENTER: case JET_SCREEN_MOUSEENTER: return L"Mouse Enter"; @@ -495,11 +495,11 @@ const FX_WCHAR* CJS_EventHandler::Name() case JET_FIELD_VALIDATE: return L"Validate"; case JET_LINK_MOUSEUP: return L"Mouse Up"; case JET_MENU_EXEC: return L"Exec"; - case JET_PAGE_OPEN: + case JET_PAGE_OPEN: case JET_SCREEN_OPEN: return L"Open"; case JET_PAGE_CLOSE: case JET_SCREEN_CLOSE: return L"Close"; - case JET_SCREEN_INVIEW: + case JET_SCREEN_INVIEW: case JET_PAGE_INVIEW: return L"InView"; case JET_PAGE_OUTVIEW: case JET_SCREEN_OUTVIEW: return L"OutView"; @@ -516,7 +516,7 @@ const FX_WCHAR* CJS_EventHandler::Type() { case JET_APP_INIT: return L"App"; case JET_BATCH_EXEC: return L"Batch"; - case JET_BOOKMARK_MOUSEUP: return L"BookMark"; + case JET_BOOKMARK_MOUSEUP: return L"BookMark"; case JET_CONSOLE_EXEC: return L"Console"; case JET_DOC_DIDPRINT: case JET_DOC_DIDSAVE: @@ -545,7 +545,7 @@ const FX_WCHAR* CJS_EventHandler::Type() case JET_SCREEN_MOUSEEXIT: case JET_SCREEN_INVIEW: case JET_SCREEN_OUTVIEW: return L"Screen"; - case JET_LINK_MOUSEUP: return L"Link"; + case JET_LINK_MOUSEUP: return L"Link"; case JET_MENU_EXEC: return L"Menu"; case JET_PAGE_OPEN: case JET_PAGE_CLOSE: @@ -563,7 +563,7 @@ FX_BOOL& CJS_EventHandler::Rc() if (m_pbRc != NULL) return *m_pbRc; else - { + { return m_bRcDu; } } @@ -614,7 +614,7 @@ Field* CJS_EventHandler::Source() pDocument->AttachDoc(m_pTargetDoc); else pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); - + //if (m_pSourceField == NULL) // return NULL; //CRAO_Widget *pWidget = IBCL_Widget::GetWidget(m_pSourceField); @@ -623,10 +623,10 @@ Field* CJS_EventHandler::Source() //CFX_WideString csFieldName = pFormField->GetFullName(); CJS_Field * pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); ASSERT(pJSField != NULL); - Field * pField = (Field *)pJSField->GetEmbedObject(); + Field * pField = (Field *)pJSField->GetEmbedObject(); ASSERT(pField != NULL); pField->AttachField(pDocument, m_strSourceName); - return pField; + return pField; } Field* CJS_EventHandler::Target_Field() @@ -648,15 +648,15 @@ Field* CJS_EventHandler::Target_Field() pDocument->AttachDoc(m_pTargetDoc); else pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); - + CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); ASSERT(pJSField != NULL); - Field* pField = (Field *)pJSField->GetEmbedObject(); + Field* pField = (Field *)pJSField->GetEmbedObject(); ASSERT(pField != NULL); pField->AttachField(pDocument, m_strTargetName); - return pField; + return pField; } CFX_WideString& CJS_EventHandler::Value() diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp index 74707fab10..2947a63344 100644 --- a/fpdfsdk/src/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -121,7 +121,7 @@ CJS_GlobalData::CJS_GlobalData(CPDFDoc_Environment* pApp) { // IBaseAnnot* pBaseAnnot = IBaseAnnot::GetBaseAnnot(m_pApp); // ASSERT(pBaseAnnot != NULL); -// +// // m_sFilePath = pBaseAnnot->GetUserPath(); m_sFilePath += SDK_JS_GLOBALDATA_FILENAME; @@ -268,7 +268,7 @@ void CJS_GlobalData::SetGlobalVariableObject(const FX_CHAR* propname, const CJS_ pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GLOBALDATA_TYPE_OBJECT; pNewData->data.objData.Copy(array); - + m_arrayGlobalData.Add(pNewData); } } @@ -277,12 +277,12 @@ void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) { ASSERT(propname != NULL); CFX_ByteString sPropName = propname; - + sPropName.TrimLeft(); sPropName.TrimRight(); - + if (sPropName.GetLength() == 0) return; - + if (CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName)) { pData->data.nType = JS_GLOBALDATA_TYPE_NULL; @@ -292,7 +292,7 @@ void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) CJS_GlobalData_Element* pNewData = new CJS_GlobalData_Element; pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GLOBALDATA_TYPE_NULL; - + m_arrayGlobalData.Add(pNewData); } } diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp index f40f142fba..bd40fc05c0 100644 --- a/fpdfsdk/src/javascript/JS_Object.cpp +++ b/fpdfsdk/src/javascript/JS_Object.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -46,7 +46,7 @@ CPDFSDK_PageView* FXJS_GetPageView(IFXJS_Context* cc) /* --------------------------------- CJS_EmbedObj --------------------------------- */ -CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : +CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) { } @@ -76,7 +76,7 @@ CJS_Timer* CJS_EmbedObj::BeginTimer(CPDFDoc_Environment * pApp,FX_UINT nElapse) { CJS_Timer* pTimer = new CJS_Timer(this,pApp); pTimer->SetJSTimer(nElapse); - + return pTimer; } diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index 31d61e37c8..c2c1a51400 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -46,7 +46,7 @@ void CJS_RuntimeFactory::AddRef() m_nRef++; } void CJS_RuntimeFactory::Release() -{ +{ if(m_bInit) { //to do.Should be implemented as atom manipulation. @@ -83,7 +83,7 @@ CJS_GlobalData* CJS_RuntimeFactory::NewGlobalData(CPDFDoc_Environment* pApp) void CJS_RuntimeFactory::ReleaseGlobalData() { m_nGlobalDataCount--; - + if (m_nGlobalDataCount <= 0) { delete m_pGlobalData; @@ -105,7 +105,7 @@ void CJS_ArrayBufferAllocator::Free(void* data, size_t length) { /* ------------------------------ CJS_Runtime ------------------------------ */ -CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) : +CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) : m_pApp(pApp), m_pDocument(NULL), m_bBlocking(FALSE), @@ -159,21 +159,21 @@ FX_BOOL CJS_Runtime::InitJSObjects() if (CJS_Position::Init(*this, JS_STATIC) < 0) return FALSE; if (CJS_ScaleHow::Init(*this, JS_STATIC) < 0) return FALSE; if (CJS_ScaleWhen::Init(*this, JS_STATIC) < 0) return FALSE; - if (CJS_Style::Init(*this, JS_STATIC) < 0) return FALSE; - if (CJS_Zoomtype::Init(*this, JS_STATIC) < 0) return FALSE; + if (CJS_Style::Init(*this, JS_STATIC) < 0) return FALSE; + if (CJS_Zoomtype::Init(*this, JS_STATIC) < 0) return FALSE; //9 - 11 if (CJS_App::Init(*this, JS_STATIC) < 0) return FALSE; - if (CJS_Color::Init(*this, JS_STATIC) < 0) return FALSE; + if (CJS_Color::Init(*this, JS_STATIC) < 0) return FALSE; if (CJS_Console::Init(*this, JS_STATIC) < 0) return FALSE; //12 - 14 - if (CJS_Document::Init(*this, JS_DYNAMIC) < 0) return FALSE; - if (CJS_Event::Init(*this, JS_STATIC) < 0) return FALSE; - if (CJS_Field::Init(*this, JS_DYNAMIC) < 0) return FALSE; + if (CJS_Document::Init(*this, JS_DYNAMIC) < 0) return FALSE; + if (CJS_Event::Init(*this, JS_STATIC) < 0) return FALSE; + if (CJS_Field::Init(*this, JS_DYNAMIC) < 0) return FALSE; //15 - 17 - if (CJS_Global::Init(*this, JS_STATIC) < 0) return FALSE; + if (CJS_Global::Init(*this, JS_STATIC) < 0) return FALSE; if (CJS_Icon::Init(*this, JS_DYNAMIC) < 0) return FALSE; if (CJS_Util::Init(*this, JS_STATIC) < 0) return FALSE; diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp index 5bca831710..058f2eaf45 100644 --- a/fpdfsdk/src/javascript/JS_Value.cpp +++ b/fpdfsdk/src/javascript/JS_Value.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -35,39 +35,39 @@ CJS_Value::CJS_Value(v8::Isolate* isolate, const float &fValue):m_isolate(isolat operator =(fValue); } -CJS_Value::CJS_Value(v8::Isolate* isolate, const double &dValue):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, const double &dValue):m_isolate(isolate) { operator =(dValue); } -CJS_Value::CJS_Value(v8::Isolate* isolate, JSFXObject pJsObj):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, JSFXObject pJsObj):m_isolate(isolate) { operator =(pJsObj); } -CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Object* pJsObj):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Object* pJsObj):m_isolate(isolate) { operator =(pJsObj); } -CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc):m_isolate(isolate) { m_eType = VT_object; if (pJsDoc) m_pValue = (JSFXObject)*pJsDoc; } -CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr):m_isolate(isolate) { operator =(pWstr); } -CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr):m_isolate(isolate) { operator = (pStr); } -CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Array& array):m_isolate(isolate) +CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Array& array):m_isolate(isolate) { operator = (array); } @@ -215,7 +215,7 @@ void CJS_Value::SetNull() } void CJS_Value::operator = (const FX_CHAR* pStr) -{ +{ operator = (CFX_WideString::FromLocal(pStr).c_str()); } @@ -256,7 +256,7 @@ FXJSVALUETYPE CJS_Value::GetType() const return VT_unknown; } -FX_BOOL CJS_Value::IsArrayObject() const +FX_BOOL CJS_Value::IsArrayObject() const { if(m_pValue.IsEmpty()) return FALSE; return m_pValue->IsArray(); @@ -294,12 +294,12 @@ FX_BOOL CJS_Value::ConvertToDate(CJS_Date &date) const return TRUE; } - return FALSE; + return FALSE; } /* ---------------------------- CJS_PropValue ---------------------------- */ -CJS_PropValue::CJS_PropValue(const CJS_Value &value) : +CJS_PropValue::CJS_PropValue(const CJS_Value &value) : CJS_Value(value), m_bIsSetting(0) { @@ -472,7 +472,7 @@ CJS_Array::CJS_Array(v8::Isolate* isolate):m_isolate(isolate) } CJS_Array::~CJS_Array() -{ +{ } void CJS_Array::Attach(v8::Local pArray) @@ -522,16 +522,16 @@ CJS_Date::CJS_Date(v8::Isolate* isolate) :m_isolate(isolate) { } -CJS_Date::CJS_Date(v8::Isolate* isolate,double dMsec_time) +CJS_Date::CJS_Date(v8::Isolate* isolate,double dMsec_time) { m_isolate = isolate; - m_pDate = JS_NewDate(isolate,dMsec_time); + m_pDate = JS_NewDate(isolate,dMsec_time); } -CJS_Date::CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec) +CJS_Date::CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec) { m_isolate = isolate; - m_pDate = JS_NewDate(isolate,MakeDate(year,mon,day,hour,min,sec,0)); + m_pDate = JS_NewDate(isolate,MakeDate(year,mon,day,hour,min,sec,0)); } double CJS_Date::MakeDate(int year, int mon, int day,int hour, int min, int sec,int ms) diff --git a/fpdfsdk/src/javascript/color.cpp b/fpdfsdk/src/javascript/color.cpp index 7f36be0920..a2bbadcd51 100644 --- a/fpdfsdk/src/javascript/color.cpp +++ b/fpdfsdk/src/javascript/color.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -32,13 +32,13 @@ END_JS_STATIC_CONST() BEGIN_JS_STATIC_PROP(CJS_Color) JS_STATIC_PROP_ENTRY(black) JS_STATIC_PROP_ENTRY(blue) - JS_STATIC_PROP_ENTRY(cyan) + JS_STATIC_PROP_ENTRY(cyan) JS_STATIC_PROP_ENTRY(dkGray) JS_STATIC_PROP_ENTRY(gray) JS_STATIC_PROP_ENTRY(green) JS_STATIC_PROP_ENTRY(ltGray) JS_STATIC_PROP_ENTRY(magenta) - JS_STATIC_PROP_ENTRY(red) + JS_STATIC_PROP_ENTRY(red) JS_STATIC_PROP_ENTRY(transparent) JS_STATIC_PROP_ENTRY(white) JS_STATIC_PROP_ENTRY(yellow) diff --git a/fpdfsdk/src/javascript/console.cpp b/fpdfsdk/src/javascript/console.cpp index f13017022b..ed9b1fbc56 100644 --- a/fpdfsdk/src/javascript/console.cpp +++ b/fpdfsdk/src/javascript/console.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" diff --git a/fpdfsdk/src/javascript/event.cpp b/fpdfsdk/src/javascript/event.cpp index fb57e741ee..f57b1fb607 100644 --- a/fpdfsdk/src/javascript/event.cpp +++ b/fpdfsdk/src/javascript/event.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/JavaScript.h" @@ -43,12 +43,12 @@ BEGIN_JS_STATIC_PROP(CJS_Event) JS_STATIC_PROP_ENTRY(willCommit) END_JS_STATIC_PROP() -BEGIN_JS_STATIC_METHOD(CJS_Event) +BEGIN_JS_STATIC_METHOD(CJS_Event) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Event,event) -event::event(CJS_Object * pJsObject) : CJS_EmbedObj(pJsObject) +event::event(CJS_Object * pJsObject) : CJS_EmbedObj(pJsObject) { } @@ -86,7 +86,7 @@ FX_BOOL event::changeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE ASSERT(pEvent != NULL); vp << pEvent->ChangeEx(); - return TRUE; + return TRUE; } FX_BOOL event::commitKey(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) @@ -103,7 +103,7 @@ FX_BOOL event::commitKey(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s } FX_BOOL event::fieldFull(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) -{ +{ CJS_Context* pContext = (CJS_Context*)cc; ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); @@ -248,7 +248,7 @@ FX_BOOL event::selEnd(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr } FX_BOOL event::selStart(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) -{ +{ CJS_Context* pContext = (CJS_Context*)cc; ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); @@ -288,7 +288,7 @@ FX_BOOL event::shift(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro FX_BOOL event::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - if (!vp.IsGetting())return FALSE; + if (!vp.IsGetting())return FALSE; CJS_Context* pContext = (CJS_Context*)cc; ASSERT(pContext != NULL); diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index c3a337020d..cddc919f75 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/javascript/IJavaScript.h" @@ -103,9 +103,9 @@ FX_BOOL CJS_Global::InitInstance(IFXJS_Context* cc) global_alternate* pGlobal = (global_alternate*)GetEmbedObject(); ASSERT(pGlobal != NULL); - + pGlobal->Initial(pContext->GetReaderApp()); - + return TRUE; }; @@ -127,7 +127,7 @@ global_alternate::~global_alternate(void) pFactory->ReleaseGlobalData(); } - + void global_alternate::Initial(CPDFDoc_Environment* pApp) { m_pApp = pApp; @@ -339,10 +339,10 @@ void global_alternate::CommitGlobalPersisitentVariables() FX_POSITION pos = m_mapGlobal.GetStartPosition(); while (pos) { - CFX_ByteString name; + CFX_ByteString name; js_global_data* pData = NULL; m_mapGlobal.GetNextAssoc(pos, name, (void*&)pData); - + if (pData) { if (pData->bDeleted) @@ -394,7 +394,7 @@ void global_alternate::ObjectToArray(v8::Local pObj, CJS_GlobalVaria for (int i=0; i