diff options
Diffstat (limited to 'fpdfsdk/src')
59 files changed, 1342 insertions, 1342 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index ff1eebfc5b..24095c843f 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.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/formfiller/FormFiller.h" @@ -22,7 +22,7 @@ CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandle m_pAnnotDict = pAnnot->GetPDFAnnot()->GetAnnotDict(); } -CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, +CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler) : CPWL_FontMap(pSystemHandler), m_pDocument(pDocument), @@ -49,7 +49,7 @@ void CBA_FontMap::Initial(const FX_CHAR* fontname) if (!m_pDefaultFont) { - m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName); + m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName); if (m_pDefaultFont) { if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) @@ -118,7 +118,7 @@ CPDF_Document* CBA_FontMap::GetDocument() return m_pDocument; } -CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias, +CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias, int32_t nCharset) { if (!pResDict) return NULL; @@ -208,10 +208,10 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAl pStreamDict->SetAt("Resources", pStreamResList); } - if (pStreamResList) + if (pStreamResList) { CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); - if (!pStreamResFontList) + if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList); @@ -237,7 +237,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) if (CPDF_Dictionary * pRootDict = m_pDocument->GetRoot()) pAcroFormDict = pRootDict->GetDict("AcroForm"); } - + CFX_ByteString sDA; CPDF_Object* pObj; if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA"))) @@ -251,8 +251,8 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) sDA = pObj ? pObj->GetString() : CFX_ByteString(); } } - - CPDF_Dictionary * pFontDict = NULL; + + CPDF_Dictionary * pFontDict = NULL; if (!sDA.IsEmpty()) { @@ -273,7 +273,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) pFontDict = pResFontDict->GetDict(sAlias); if (bWidget) - { + { if (!pFontDict) { if (pAcroFormDict) diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp index dad485cac3..55d2d45bc2 100644 --- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_CheckBox.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/formfiller/FormFiller.h" @@ -27,7 +27,7 @@ CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); - + return pWnd; } @@ -46,7 +46,7 @@ FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla { switch (nChar) { - case FWL_VKEY_Return: + case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); @@ -115,9 +115,9 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { - + FX_BOOL bNewChecked = pWnd->IsChecked(); - + if (bNewChecked) { diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index e10c981d1a..ed38144429 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.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/formfiller/FormFiller.h" @@ -37,9 +37,9 @@ PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() ASSERT(m_pWidget != NULL); int nFlags = m_pWidget->GetFieldFlags(); - + if (nFlags & FIELDFLAG_EDIT) - { + { cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; } @@ -111,7 +111,7 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) return nCurSel != m_pWidget->GetSelectedIndex(0); } } - + return FALSE; } @@ -143,7 +143,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) bSetValue = FALSE; CFX_WideString sOldValue; - + if (bSetValue) { @@ -161,7 +161,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) SetChangeMark(); m_pWidget->GetPDFPage(); - + } } @@ -175,7 +175,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) { - fa.bFieldFull = pEdit->IsTextFull(); + fa.bFieldFull = pEdit->IsTextFull(); int nSelStart = 0; int nSelEnd = 0; pEdit->GetSel(nSelStart, nSelEnd); @@ -213,7 +213,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) -void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { switch (type) @@ -233,7 +233,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc } } -FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, +FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew) { switch (type) @@ -287,11 +287,11 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe { if (bRestoreValue) SaveState(pPageView); - + DestroyPDFWindow(pPageView); - + CPWL_Wnd* pRet = NULL; - + if (bRestoreValue) { RestoreState(pPageView); @@ -299,18 +299,18 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe } else pRet = GetPDFWindow(pPageView, TRUE); - + m_pWidget->UpdateField(); - + return pRet; } void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) { ASSERT(m_pWidget != NULL); - + int nFlags = m_pWidget->GetFieldFlags(); - + if (nFlags & FIELDFLAG_COMMITONSELCHANGE) { if (m_bValid) @@ -399,14 +399,14 @@ void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) CFX_WideString CFFL_ComboBox::GetSelectExportText() { CFX_WideString swRet; - + int nExport = -1; CPDFSDK_PageView *pPageView = GetCurPageView(); if (CPWL_ComboBox * pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { nExport = pComboBox->GetSelect(); } - + if (nExport >= 0) { if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) @@ -416,6 +416,6 @@ CFX_WideString CFFL_ComboBox::GetSelectExportText() swRet = pFormField->GetOptionLabel(nExport); } } - + return swRet; } diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index d9a9848ec5..7f5ee2ffec 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.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 @@ -22,7 +22,7 @@ CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnno m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0,0) -{ +{ m_pWidget = (CPDFSDK_Widget*) pAnnot; } @@ -89,7 +89,7 @@ FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* return rect.GetOutterRect(); } -void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { @@ -109,14 +109,14 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_A } } -void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { ASSERT(pAnnot != NULL); - + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); } @@ -146,7 +146,7 @@ void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pA FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) - { + { m_bValid = TRUE; FX_RECT rect = GetViewBBox(pPageView,pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); @@ -163,7 +163,7 @@ FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); pWnd->OnLButtonUp(WndtoPWL(pPageView, point),nFlags); @@ -176,7 +176,7 @@ FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -192,7 +192,7 @@ FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* } if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -205,7 +205,7 @@ FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot if (!IsValid()) return FALSE; if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) - { + { return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFlags); } @@ -215,7 +215,7 @@ FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) - { + { pWnd->OnRButtonDown(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -226,7 +226,7 @@ FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnRButtonUp(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -237,7 +237,7 @@ FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* FX_BOOL CFFL_FormFiller::OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnRButtonDblClk(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -253,7 +253,7 @@ FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_U ASSERT(pPageView != NULL); if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { return pWnd->OnKeyDown(nKeyCode,nFlags); } } @@ -269,7 +269,7 @@ FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF ASSERT(pPageView != NULL); if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { return pWnd->OnChar(nChar,nFlags); } } @@ -296,23 +296,23 @@ FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); ASSERT(pPageView != NULL); - + CPWL_Wnd * pWnd = NULL; if ( (pWnd = GetPDFWindow(pPageView, TRUE))) - { + { pWnd->SetFocus(); } m_bValid = TRUE; - - - + + + m_bValid = TRUE; FX_RECT rcRect = GetViewBBox(pPageView,pAnnot); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); - + return TRUE; } @@ -326,10 +326,10 @@ FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) CommitData(pPageView, nFlag); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->KillFocus(); } - + switch (m_pWidget->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: @@ -357,10 +357,10 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() PWL_CREATEPARAM cp; - cp.pParentWnd = NULL; + cp.pParentWnd = NULL; cp.pProvider = this; cp.rcRectWnd = GetPDFWindowRect(); - + FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; ASSERT(m_pWidget != NULL); @@ -369,7 +369,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); if (dwFieldFlag & FIELDFLAG_READONLY) - { + { dwCreateFlags |= PWS_READONLY; } @@ -393,7 +393,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() cp.fFontSize = m_pWidget->GetFontSize(); cp.dwBorderWidth = m_pWidget->GetBorderWidth(); - + int nBorderStyle = m_pWidget->GetBorderStyle(); switch (nBorderStyle) @@ -403,7 +403,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() break; case BBS_DASH: cp.nBorderStyle = PBS_DASH; - cp.sDash = CPWL_Dash(3,3,0); + cp.sDash = CPWL_Dash(3,3,0); break; case BBS_BEVELED: cp.nBorderStyle = PBS_BEVELED; @@ -500,7 +500,7 @@ CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) pPrivateData->pPageView->GetCurrentMatrix(mtPageView); CPDF_Matrix mt = GetCurMatrix(); mt.Concat(mtPageView); - + return mt; } } @@ -520,7 +520,7 @@ CPDF_Matrix CFFL_FormFiller::GetCurMatrix() switch (m_pWidget->GetRotate()) { default: - case 0: + case 0: mt = CPDF_Matrix(1,0,0,1,0,0); break; case 90: @@ -578,7 +578,7 @@ CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); ASSERT(pPageView); CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); @@ -594,7 +594,7 @@ CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) { CPDF_Matrix mt; mt.SetReverse(GetCurMatrix()); - + CPDF_Rect temp = rect; mt.TransformRect(temp); @@ -604,7 +604,7 @@ CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) { CPDF_Matrix mt = GetCurMatrix(); - + CPDF_Rect temp = rect; mt.TransformRect(temp); @@ -635,10 +635,10 @@ CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point) CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt) { // ASSERT(pPageView != NULL); -// +// // CPDF_Point point(0.0f, 0.0f); // pPageView->WindowToDoc(pt.x, pt.y, point.x, point.y); -// +// return FFLtoPWL(pt); // return CPDF_Point(0, 0); } @@ -646,10 +646,10 @@ CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Poi CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect & rect) { // FX_RECT rcRet(0,0,0,0); -// -// ASSERT(pPageView != NULL); +// +// ASSERT(pPageView != NULL); // pPageView->DocToWindow(rect, rcRet); -// +// return rect; } @@ -723,12 +723,12 @@ void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A fa.sValue = m_pWidget->GetValue(); } -void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { } -FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, +FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew) { return FALSE; @@ -744,7 +744,7 @@ void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue) { - return GetPDFWindow(pPageView, FALSE); + return GetPDFWindow(pPageView, FALSE); } void CFFL_FormFiller::TimerProc() @@ -765,7 +765,7 @@ void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow) { m_bValid = FALSE; - + FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); @@ -857,7 +857,7 @@ FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn m_bMouseDown = FALSE; m_pWidget->GetPDFPage(); - + FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); @@ -871,7 +871,7 @@ FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn return TRUE; } -void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { @@ -911,7 +911,7 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot } -void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow, */FX_DWORD dwFlags) { diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 0066b7e9c6..9969c18b63 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.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/formfiller/FFL_FormFiller.h" @@ -20,7 +20,7 @@ /* ----------------------------- CFFL_IFormFiller ----------------------------- */ -CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : +CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_bNotifying(FALSE) { @@ -73,7 +73,7 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot } } -void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { @@ -87,9 +87,9 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ if (pFormFiller->IsValid()) { pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); - + pAnnot->GetPDFPage(); - + CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); ASSERT(pDocument != NULL); @@ -100,23 +100,23 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ if (!rcFocus.IsEmpty()) { CFX_PathData path; - + path.SetPointCount(5); path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); - + CFX_GraphStateData gsd; - gsd.SetDashCount(1); + gsd.SetDashCount(1); gsd.m_DashArray[0] = 1.0f; - gsd.m_DashPhase = 0; - + gsd.m_DashPhase = 0; + gsd.m_LineWidth = 1.0f; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); - // ::DrawFocusRect(hDC, &rcFocus); + // ::DrawFocusRect(hDC, &rcFocus); } } @@ -133,7 +133,7 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ { pWidget->DrawShadow(pDevice, pPageView); } - + } } @@ -167,30 +167,30 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + if (!m_bNotifying) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { m_bNotifying = TRUE; - + int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - + ASSERT(pPageView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView ); m_bNotifying = FALSE; - + //if ( !IsValidAnnot(pPageView, pAnnot) ) return; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -200,7 +200,7 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { pFormFiller->OnMouseEnter(pPageView, pAnnot); @@ -211,7 +211,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + if (!m_bNotifying) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; @@ -221,20 +221,20 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - + ASSERT(pPageView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); - + pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); m_bNotifying = FALSE; - + //if (!IsValidAnnot(pPageView, pAnnot)) return; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -244,7 +244,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { pFormFiller->OnMouseExit(pPageView, pAnnot); @@ -255,7 +255,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + if (!m_bNotifying) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; @@ -265,19 +265,19 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - + ASSERT(pPageView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); m_bNotifying = FALSE; - + if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -287,12 +287,12 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); } - + return FALSE; } @@ -300,13 +300,13 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; // CReader_Page* pPage = pAnnot->GetPage(); // ASSERT(pPage != NULL); CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); - ASSERT(pDocument != NULL); - + ASSERT(pDocument != NULL); + switch (pWidget->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: @@ -321,9 +321,9 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot pDocument->SetFocusAnnot(pAnnot); break; } - + FX_BOOL bRet = FALSE; - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); @@ -342,7 +342,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) { ASSERT(pWidget != NULL); - + if (!m_bNotifying) { if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) @@ -350,33 +350,33 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa m_bNotifying = TRUE; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); - + ASSERT(pPageView != NULL); // CReader_DocView* pDocView = pPageView->GetDocView(); // ASSERT(pDocView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); m_bNotifying = FALSE; - + if (!IsValidAnnot(pPageView, pWidget)) { bExit = TRUE; return; } - + if (nAge != pWidget->GetAppearanceAge()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - + bReset = TRUE; } } @@ -469,7 +469,7 @@ FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { - return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); + return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); } return FALSE; @@ -526,25 +526,25 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - - + + CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView != NULL); - + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); - + CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); if(!pFormFiller) return FALSE; pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); - + pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); m_bNotifying = FALSE; - + // if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pAnnot)) return FALSE; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -554,7 +554,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { if (pFormFiller->OnSetFocus(pAnnot, nFlag)) @@ -584,19 +584,19 @@ FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) { m_bNotifying = TRUE; pWidget->ClearAppModified(); - + CPDFSDK_PageView* pPageView = pWidget->GetPageView(); ASSERT(pPageView != NULL); - + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); - + pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); - + pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); m_bNotifying = FALSE; - + } } } @@ -631,16 +631,16 @@ FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { CPDF_Page* pPage = pWidget->GetPDFPage(); ASSERT(pPage != NULL); - + CPDF_Document* pDocument = pPage->m_pDocument; ASSERT(pDocument != NULL); - + FX_DWORD dwPermissions = pDocument->GetUserPermissions(); - return (dwPermissions&FPDFPERM_FILL_FORM) || - (dwPermissions&FPDFPERM_ANNOT_FORM) || + return (dwPermissions&FPDFPERM_FILL_FORM) || + (dwPermissions&FPDFPERM_ANNOT_FORM) || (dwPermissions&FPDFPERM_MODIFY); } - return TRUE; + return TRUE; } CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister) @@ -656,7 +656,7 @@ CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL if (bRegister) { - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; int nFieldType = pWidget->GetFieldType(); switch(nFieldType) @@ -725,7 +725,7 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; - + CPDF_Rect rcPageView(0,0,0,0); @@ -834,8 +834,8 @@ void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW } } -void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString& strChange, - const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, +void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString& strChange, + const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit) { ASSERT(pPrivateData != NULL); @@ -861,8 +861,8 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi ASSERT(pPageView != NULL); // CReader_DocView* pDocView = pPageView->GetDocView(); // ASSERT(pDocView != NULL); - - + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -901,8 +901,8 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa ASSERT(pPageView != NULL); // CReader_DocView* pDocView = pPageView->GetDocView(); // ASSERT(pDocView != NULL); - - + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -1041,17 +1041,17 @@ void CFFL_IFormFiller::DoPaste(CPDFSDK_Document* pDocument) } void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, - CFX_WideString & strChange, const CFX_WideString& strChangeEx, + CFX_WideString & strChange, const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) { ASSERT(pPrivateData != NULL); CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData->pWidget != NULL); - + CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); ASSERT(pFormFiller != NULL); - + if (!m_bNotifying) { if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) @@ -1062,7 +1062,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData ASSERT(pData->pPageView != NULL); CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); - + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); @@ -1077,7 +1077,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); pFormFiller->SaveState(pData->pPageView); - + if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pData->pPageView)) { if (!IsValidAnnot(pData->pPageView, pData->pWidget)) @@ -1086,14 +1086,14 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData m_bNotifying = FALSE; return; } - + if (nAge != pData->pWidget->GetAppearanceAge()) { CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow(pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); bExit = TRUE; } - + if (fa.bRC) { pFormFiller->SetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); @@ -1104,7 +1104,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData pFormFiller->RestoreState(pData->pPageView); bRC = FALSE; } - + if (pDocument->GetFocusAnnot() != pData->pWidget) { pFormFiller->CommitData(pData->pPageView,nFlag); @@ -1112,7 +1112,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData } } else - { + { if (!IsValidAnnot(pData->pPageView, pData->pWidget)) { bExit = TRUE; @@ -1120,21 +1120,21 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData return; } } - + m_bNotifying = FALSE; } } } -void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit,FX_DWORD nFlag) +void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit,FX_DWORD nFlag) { ASSERT(pPrivateData != NULL); CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData->pWidget != NULL); - + CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); ASSERT(pFormFiller != NULL); - + if (!bEditOrList) pFormFiller->OnKeyStroke(bExit); } diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index 6ee608a5bb..4622d4fcef 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.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/formfiller/FormFiller.h" @@ -39,9 +39,9 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() ASSERT(m_pWidget != NULL); FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); - + if (dwFieldFlag & FIELDFLAG_MULTISELECT) - { + { cp.dwFlags |= PLBS_MULTIPLESEL; } @@ -76,7 +76,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { m_OriginSelections.RemoveAll(); - + FX_BOOL bSetCaret = FALSE; for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++) { @@ -103,9 +103,9 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView } } } - + pWnd->SetTopVisibleIndex(m_pWidget->GetTopVisibleIndex()); - + return pWnd; } @@ -143,7 +143,7 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0); } } - + return FALSE; } @@ -165,10 +165,10 @@ void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) } } - + int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); - m_pWidget->ClearSelection(FALSE); + m_pWidget->ClearSelection(FALSE); if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { @@ -235,7 +235,7 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAct } -void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { } @@ -269,11 +269,11 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRes { if (bRestoreValue) SaveState(pPageView); - + DestroyPDFWindow(pPageView); - + CPWL_Wnd* pRet = NULL; - + if (bRestoreValue) { RestoreState(pPageView); @@ -281,9 +281,9 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRes } else pRet = GetPDFWindow(pPageView, TRUE); - + m_pWidget->UpdateField(); - + return pRet; } @@ -292,7 +292,7 @@ void CFFL_ListBox::OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) ASSERT(m_pWidget != NULL); int nFlags = m_pWidget->GetFieldFlags(); - + if (nFlags & FIELDFLAG_COMMITONSELCHANGE) { if (m_bValid) diff --git a/fpdfsdk/src/formfiller/FFL_Notify.cpp b/fpdfsdk/src/formfiller/FFL_Notify.cpp index 4fd2bd84ea..58a2202b61 100644 --- a/fpdfsdk/src/formfiller/FFL_Notify.cpp +++ b/fpdfsdk/src/formfiller/FFL_Notify.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/formfiller/FormFiller.h" @@ -14,7 +14,7 @@ //#pragma warning(disable: 4800) -CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : +CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : m_bDoActioning(FALSE), m_nNotifyFlag(0) { @@ -94,15 +94,15 @@ FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) return TRUE; } -FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange, +FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, - FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull, + FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull, int& nSelStart, int& nSelEnd, FX_BOOL& bRC) { return TRUE; } -FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange, +FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, FX_BOOL bShift, FX_BOOL & bRC) { diff --git a/fpdfsdk/src/formfiller/FFL_PushButton.cpp b/fpdfsdk/src/formfiller/FFL_PushButton.cpp index b8a07fb548..a5df48840c 100644 --- a/fpdfsdk/src/formfiller/FFL_PushButton.cpp +++ b/fpdfsdk/src/formfiller/FFL_PushButton.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/formfiller/FormFiller.h" @@ -23,7 +23,7 @@ CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageV { CPWL_PushButton* pWnd = new CPWL_PushButton(); pWnd->Create(cp); - + return pWnd; } @@ -33,7 +33,7 @@ FX_BOOL CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } -void CFFL_PushButton::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, +void CFFL_PushButton::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) { diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp index 708d6df090..1f73e8ccaa 100644 --- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp +++ b/fpdfsdk/src/formfiller/FFL_RadioButton.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/formfiller/FormFiller.h" @@ -27,7 +27,7 @@ CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_Page ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); - + return pWnd; } @@ -47,7 +47,7 @@ FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n { switch (nChar) { - case FWL_VKEY_Return: + case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); @@ -109,7 +109,7 @@ void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { - + FX_BOOL bNewChecked = pWnd->IsChecked(); if (bNewChecked) diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 33fb751ff1..ff3bcafbd1 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.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/formfiller/FFL_TextField.h" @@ -36,16 +36,16 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() if (nFlags & FIELDFLAG_PASSWORD) - { + { cp.dwFlags |= PES_PASSWORD; } if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) - { + { } if (nFlags & FIELDFLAG_MULTILINE) - { + { cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; if (!(nFlags & FIELDFLAG_DONOTSCROLL)) @@ -64,17 +64,17 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() } if (nFlags & FIELDFLAG_COMB) - { + { cp.dwFlags |= PES_CHARARRAY; } if (nFlags & FIELDFLAG_RICHTEXT) - { + { cp.dwFlags |= PES_RICH; } cp.dwFlags |= PES_UNDO; - + switch (m_pWidget->GetAlignment()) { default: @@ -115,7 +115,7 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi ASSERT(m_pWidget != NULL); int32_t nMaxLen = m_pWidget->GetMaxLen(); CFX_WideString swValue = m_pWidget->GetValue(); - + if (nMaxLen > 0) { if (pWnd->HasFlag(PES_CHARARRAY)) @@ -146,7 +146,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl m_bValid = !m_bValid; CPDF_Rect rcAnnot = pAnnot->GetRect(); m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom); - + if (m_bValid) { if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) @@ -197,7 +197,7 @@ void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); - m_pWidget->SetValue(sNewValue, FALSE); + m_pWidget->SetValue(sNewValue, FALSE); m_pWidget->ResetFieldAppearance(TRUE); m_pWidget->UpdateField(); SetChangeMark(); @@ -212,10 +212,10 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA case CPDF_AAction::KeyStroke: if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { - fa.bFieldFull = pWnd->IsTextFull(); + fa.bFieldFull = pWnd->IsTextFull(); fa.sValue = pWnd->GetText(); - + if (fa.bFieldFull) { fa.sChange = L""; @@ -239,7 +239,7 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA } } -void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { switch (type) @@ -258,7 +258,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA } -FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, +FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew) { switch (type) @@ -313,29 +313,29 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR pRet = GetPDFWindow(pPageView, TRUE); m_pWidget->UpdateField(); - + return pRet; } void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { ASSERT(m_pApp != NULL); - + ASSERT(pWnd != NULL); - + if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; pEdit->SetCharSet(134); pEdit->SetCodePage(936); - + pEdit->SetReadyToInput(); CFX_WideString wsText = pEdit->GetText(); int nCharacters = wsText.GetLength(); CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE); - + pEdit->SetEditNotify(this); //pUndo->BeginEdit(pDocument); } diff --git a/fpdfsdk/src/formfiller/FFL_Utils.cpp b/fpdfsdk/src/formfiller/FFL_Utils.cpp index 2f988b2f0b..8d2d76d73c 100644 --- a/fpdfsdk/src/formfiller/FFL_Utils.cpp +++ b/fpdfsdk/src/formfiller/FFL_Utils.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 <algorithm> @@ -53,7 +53,7 @@ FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj) CPDF_Array* pArray = (CPDF_Array*)pObj; for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { - CPDF_Object* pElement = pArray->GetElementValue(i); + CPDF_Object* pElement = pArray->GetElementValue(i); TraceObject(pElement); } } diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp index 88b00dead7..b6363a8827 100644 --- a/fpdfsdk/src/fpdf_dataavail.cpp +++ b/fpdfsdk/src/fpdf_dataavail.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 "../../public/fpdf_dataavail.h" @@ -28,7 +28,7 @@ public: private: FX_FILEAVAIL* m_pfileAvail; -}; +}; class CFPDF_FileAccessWrap : public IFX_FileRead { @@ -45,7 +45,7 @@ public: virtual FX_FILESIZE GetSize() { - return m_pFileAccess->m_FileLen; + return m_pFileAccess->m_FileLen; } virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) @@ -69,15 +69,15 @@ public: m_pDownloadHints = pDownloadHints; } public: - virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) + virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) { m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); - } + } private: FX_DOWNLOADHINTS* m_pDownloadHints; }; -class CFPDF_DataAvail +class CFPDF_DataAvail { public: CFPDF_DataAvail() diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp index 0168375a1d..1e68c6bd70 100644 --- a/fpdfsdk/src/fpdf_ext.cpp +++ b/fpdfsdk/src/fpdf_ext.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 "../../public/fpdf_ext.h" @@ -42,7 +42,7 @@ FX_BOOL FPDF_UnSupportError(int nError) return FALSE; pAdapter->ReportError(nError); return TRUE; -} +} DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { @@ -94,22 +94,22 @@ void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot) if(pAnnotDict->KeyExist("FT")) { cbString = pAnnotDict->GetString("FT"); - } + } if(cbString.Compare("Sig") == 0) { FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); } } - + } FX_BOOL CheckSharedForm(CXML_Element * pElement, CFX_ByteString cbName) { int count = pElement->CountAttrs(); int i=0; - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) { - CFX_ByteString space, name; + CFX_ByteString space, name; CFX_WideString value; pElement->GetAttrByIndex(i, space, name, value); if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") @@ -159,7 +159,7 @@ void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code) if(!pDoc) return ; - // Portfolios and Packages + // Portfolios and Packages CPDF_Dictionary * pRootDict = pDoc->GetRoot(); if(pRootDict) { diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index e9ab80ecca..d3aa8c5ec1 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.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 "../../public/fpdf_flatten.h" @@ -15,16 +15,16 @@ enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM }; FX_BOOL IsValiableRect(CPDF_Rect rect, CPDF_Rect rcPage) { - if ( rect.left - rect.right > 0.000001f || + if ( rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f) return FALSE; - + if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f && rect.bottom == 0.0f) return FALSE; - + if (!rcPage.IsEmpty()) { if (rect.left - rcPage.left < -10.000001f || @@ -33,7 +33,7 @@ FX_BOOL IsValiableRect(CPDF_Rect rect, CPDF_Rect rcPage) rect.bottom - rcPage.bottom < -10.000001f) return FALSE; } - + return TRUE; } @@ -45,24 +45,24 @@ FX_BOOL GetContentsRect( CPDF_Document * pDoc, CPDF_Dictionary* pDict, CPDF_Rect pPDFPage->ParseContent(); FX_POSITION pos = pPDFPage->GetFirstObjectPosition(); - + while (pos) { CPDF_PageObject* pPageObject = pPDFPage->GetNextObject(pos); if (!pPageObject)continue; - + CPDF_Rect rc; rc.left = pPageObject->m_Left; rc.right = pPageObject->m_Right; rc.bottom = pPageObject->m_Bottom; rc.top = pPageObject->m_Top; - + if (IsValiableRect(rc, pDict->GetRect("MediaBox"))) { pRectArray->Add(rc); } } - + delete pPDFPage; return TRUE; } @@ -76,10 +76,10 @@ void ParserStream( CPDF_Dictionary * pPageDic, CPDF_Dictionary* pStream, CPDF_Re rect = pStream->GetRect("Rect"); else if (pStream->KeyExist("BBox")) rect = pStream->GetRect("BBox"); - + if (IsValiableRect(rect, pPageDic->GetRect("MediaBox"))) pRectArray->Add(rect); - + pObjectArray->Add(pStream); } @@ -131,9 +131,9 @@ FX_FLOAT GetMinMaxValue( CPDF_RectArray& array, FPDF_TYPE type, FPDF_VALUE value { int nRects = array.GetSize(); FX_FLOAT fRet = 0.0f; - + if (nRects <= 0)return 0.0f; - + FX_FLOAT* pArray = new FX_FLOAT[nRects]; switch(value) { @@ -141,28 +141,28 @@ FX_FLOAT GetMinMaxValue( CPDF_RectArray& array, FPDF_TYPE type, FPDF_VALUE value { for (int i = 0; i < nRects; i++) pArray[i] = CPDF_Rect(array.GetAt(i)).left; - + break; } case TOP: { for (int i = 0; i < nRects; i++) pArray[i] = CPDF_Rect(array.GetAt(i)).top; - + break; } case RIGHT: { for (int i = 0; i < nRects; i++) pArray[i] = CPDF_Rect(array.GetAt(i)).right; - + break; } case BOTTOM: { for (int i = 0; i < nRects; i++) pArray[i] = CPDF_Rect(array.GetAt(i)).bottom; - + break; } default: @@ -189,12 +189,12 @@ CPDF_Rect CalculateRect( CPDF_RectArray * pRectArray ) { CPDF_Rect rcRet; - + rcRet.left = GetMinMaxValue(*pRectArray, MIN, LEFT); rcRet.top = GetMinMaxValue(*pRectArray, MAX, TOP); rcRet.right = GetMinMaxValue(*pRectArray, MAX, RIGHT); rcRet.bottom = GetMinMaxValue(*pRectArray, MIN, BOTTOM); - + return rcRet; } @@ -206,7 +206,7 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* { pContentsObj = pPage->GetArray("Contents"); } - + if (!pContentsObj) { //Create a new contents dictionary @@ -224,7 +224,7 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* int iType = pContentsObj->GetType(); CPDF_Array* pContentsArray = NULL; - + switch(iType) { case PDFOBJ_STREAM: @@ -241,7 +241,7 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* pContentsArray->AddReference(pDocument, dwObjNum); break; } - + case PDFOBJ_ARRAY: { pContentsArray = (CPDF_Array*)pContentsObj; @@ -249,13 +249,13 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* } default: break; - } - + } + if (!pContentsArray)return; - + FX_DWORD dwObjNum = pDocument->AddIndirectObject(pContentsArray); pPage->SetAtReference("Contents", pDocument, dwObjNum); - + if (!key.IsEmpty()) { CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary); @@ -267,18 +267,18 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* pNewContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, FALSE); } } - + CFX_AffineMatrix GetMatrix(CPDF_Rect rcAnnot, CPDF_Rect rcStream, CFX_AffineMatrix matrix) { if(rcStream.IsEmpty()) return CFX_AffineMatrix(); - + matrix.TransformRect(rcStream); rcStream.Normalize(); - + FX_FLOAT a = rcAnnot.Width()/rcStream.Width(); FX_FLOAT d = rcAnnot.Height()/rcStream.Height(); - + FX_FLOAT e = rcAnnot.left - rcStream.left * a; FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d; return CFX_AffineMatrix(a, 0, 0, d, e, f); @@ -290,7 +290,7 @@ void GetOffset(FX_FLOAT& fa, FX_FLOAT& fd, FX_FLOAT& fe, FX_FLOAT& ff, CPDF_Rect FX_FLOAT fStreamHeight = 0.0f; - + if (matrix.a != 0 && matrix.d != 0) { fStreamWidth = rcStream.right - rcStream.left; @@ -301,7 +301,7 @@ void GetOffset(FX_FLOAT& fa, FX_FLOAT& fd, FX_FLOAT& fe, FX_FLOAT& ff, CPDF_Rect fStreamWidth = rcStream.top - rcStream.bottom; fStreamHeight = rcStream.right - rcStream.left; } - + FX_FLOAT x1 = matrix.a * rcStream.left + matrix.c * rcStream.bottom + matrix.e; FX_FLOAT y1 = matrix.b * rcStream.left + matrix.d * rcStream.bottom + matrix.f; FX_FLOAT x2 = matrix.a * rcStream.left + matrix.c * rcStream.top + matrix.e; @@ -310,10 +310,10 @@ void GetOffset(FX_FLOAT& fa, FX_FLOAT& fd, FX_FLOAT& fe, FX_FLOAT& ff, CPDF_Rect FX_FLOAT y3 = matrix.b * rcStream.right + matrix.d * rcStream.bottom + matrix.f; FX_FLOAT x4 = matrix.a * rcStream.right + matrix.c * rcStream.top + matrix.e; FX_FLOAT y4 = matrix.b * rcStream.right + matrix.d * rcStream.top + matrix.f; - + FX_FLOAT left = FX_MIN(FX_MIN(x1, x2), FX_MIN(x3, x4)); FX_FLOAT bottom = FX_MIN(FX_MIN(y1, y2), FX_MIN(y3, y4)); - + fa = (rcAnnot.right - rcAnnot.left)/fStreamWidth; fd = (rcAnnot.top - rcAnnot.bottom)/fStreamHeight; fe = rcAnnot.left - left * fa; @@ -331,7 +331,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag) CPDF_Page * pPage = (CPDF_Page*)( page ); CPDF_Document * pDocument = pPage->m_pDocument; CPDF_Dictionary * pPageDict = pPage->m_pFormDict; - + if ( !pDocument || !pPageDict ) { return FLATTEN_FAIL; @@ -351,17 +351,17 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag) if (pPageDict->KeyExist("CropBox")) rcOriginalMB = pPageDict->GetRect("CropBox"); - - if (rcOriginalMB.IsEmpty()) + + if (rcOriginalMB.IsEmpty()) { rcOriginalMB = CPDF_Rect(0.0f, 0.0f, 612.0f, 792.0f); } - + rcMerger.left = rcMerger.left < rcOriginalMB.left? rcOriginalMB.left : rcMerger.left; rcMerger.right = rcMerger.right > rcOriginalMB.right? rcOriginalMB.right : rcMerger.right; rcMerger.top = rcMerger.top > rcOriginalMB.top? rcOriginalMB.top : rcMerger.top; rcMerger.bottom = rcMerger.bottom < rcOriginalMB.bottom? rcOriginalMB.bottom : rcMerger.bottom; - + if (pPageDict->KeyExist("ArtBox")) rcOriginalCB = pPageDict->GetRect("ArtBox"); else @@ -470,7 +470,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag) { if (pFirstObj->GetType() == PDFOBJ_REFERENCE) pFirstObj = pFirstObj->GetDirect(); - + if (pFirstObj->GetType() != PDFOBJ_STREAM) continue; @@ -496,7 +496,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag) CPDF_Object* pObj = pAPStream; if (pObj) - { + { CPDF_Dictionary* pObjDic = pObj->GetDict(); if (pObjDic) { diff --git a/fpdfsdk/src/fpdf_progressive.cpp b/fpdfsdk/src/fpdf_progressive.cpp index a5d6c13b91..f13ef9ac54 100644 --- a/fpdfsdk/src/fpdf_progressive.cpp +++ b/fpdfsdk/src/fpdf_progressive.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 "../../public/fpdf_progressive.h" @@ -14,7 +14,7 @@ extern void (*Func_RenderPage)( CRenderContext*, FPDF_PAGE page, int start_x, in extern void DropContext(void* data); -DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start( FPDF_BITMAP bitmap, FPDF_PAGE page, +DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start( FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags, IFSDK_PAUSE * pause ) @@ -45,7 +45,7 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start( FPDF_BITMAP bitmap, FPDF_PAGE ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); #endif IFSDK_PAUSE_Adapter IPauseAdapter(pause); - + Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,FALSE, &IPauseAdapter); if ( pContext->m_pRenderer ) @@ -64,7 +64,7 @@ DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * paus if (!pause) return FPDF_RENDER_FAILED; - + if (pause->version !=1) return FPDF_RENDER_FAILED; diff --git a/fpdfsdk/src/fpdf_searchex.cpp b/fpdfsdk/src/fpdf_searchex.cpp index 4384cdc5b3..d63f8fff46 100644 --- a/fpdfsdk/src/fpdf_searchex.cpp +++ b/fpdfsdk/src/fpdf_searchex.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 "../../public/fpdf_searchex.h" diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp index ac2b74c98a..249055d344 100644 --- a/fpdfsdk/src/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/src/fpdf_sysfontinfo.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 "../../public/fpdf_sysfontinfo.h" diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp index cb300e8bd0..dca0c23a56 100644 --- a/fpdfsdk/src/fpdf_transformpage.cpp +++ b/fpdfsdk/src/fpdf_transformpage.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 "../../public/fpdf_transformpage.h" @@ -91,7 +91,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX CFX_ByteString bsMatix; bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b,matrix->c,matrix->d,matrix->e,matrix->f); textBuf<<bsMatix; - + CPDF_Page* pPage = (CPDF_Page*)page; CPDF_Dictionary* pPageDic = pPage->m_pFormDict; @@ -100,7 +100,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX pContentObj = pPageDic ? pPageDic->GetArray("Contents") : NULL; if(!pContentObj) return FALSE; - + CPDF_Dictionary* pDic = new CPDF_Dictionary; CPDF_Stream* pStream = new CPDF_Stream(NULL,0, pDic); pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE); @@ -113,7 +113,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX CPDF_Stream* pEndStream = new CPDF_Stream(NULL,0, pDic); pEndStream->SetData((const uint8_t*)" Q", 2, FALSE, FALSE); pDoc->AddIndirectObject(pEndStream); - + CPDF_Array* pContentArray = NULL; if (pContentObj && pContentObj->GetType() == PDFOBJ_ARRAY) { @@ -121,7 +121,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); pContentArray->InsertAt(0, pRef); pContentArray->AddReference(pDoc,pEndStream); - + } else if(pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) { @@ -172,7 +172,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX } else continue; - + CFX_AffineMatrix m = pDict->GetMatrix(FX_BSTRC("Matrix")); CFX_AffineMatrix t = *(CFX_AffineMatrix*)matrix; m.Concat(t); @@ -190,7 +190,7 @@ DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object if(pPageObj == NULL) return; CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f); - + //Special treatment to shading object, because the ClipPath for shading object is already transformed. if(pPageObj->m_Type != PDFPAGE_SHADING) pPageObj->TransformClipPath(matrix); @@ -219,16 +219,16 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) { const CFX_PathData* pPathData = path; if (pPathData == NULL) return; - + FX_PATHPOINT* pPoints = pPathData->GetPoints(); - + if (path.IsRect()) { - buf << (pPoints[0].m_PointX) << " " << (pPoints[0].m_PointY) << " " - << (pPoints[2].m_PointX - pPoints[0].m_PointX) << " " + buf << (pPoints[0].m_PointX) << " " << (pPoints[0].m_PointY) << " " + << (pPoints[2].m_PointX - pPoints[0].m_PointX) << " " << (pPoints[2].m_PointY - pPoints[0].m_PointY) << " re\n"; return; } - + CFX_ByteString temp; for (int i = 0; i < pPathData->GetPointCount(); i ++) { buf << (pPoints[i].m_PointX) << " " << (pPoints[i].m_PointY); @@ -236,7 +236,7 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) if (point_type == FXPT_MOVETO) buf << " m\n"; else if (point_type == FXPT_BEZIERTO) { - buf << " " << (pPoints[i+1].m_PointX) << " " << (pPoints[i+1].m_PointY) << " " << + buf << " " << (pPoints[i+1].m_PointX) << " " << (pPoints[i+1].m_PointY) << " " << (pPoints[i+2].m_PointX) << " " << (pPoints[i+2].m_PointY); if (pPoints[i+2].m_Flag & FXPT_CLOSEFIGURE) buf << " c h\n"; @@ -288,7 +288,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clip if(!pDoc) return; pDoc->AddIndirectObject(pStream); - + CPDF_Array* pContentArray = NULL; if (pContentObj && pContentObj->GetType() == PDFOBJ_ARRAY) { diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp index b2a4267c41..ca0c30ee1b 100644 --- a/fpdfsdk/src/fpdfdoc.cpp +++ b/fpdfsdk/src/fpdfdoc.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/fsdk_define.h" @@ -221,7 +221,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FP continue; if(pDict->GetString(FX_BSTRC("Subtype")).Equal(FX_BSTRC("Link"))) { *startPos = i + 1; - *linkAnnot = (FPDF_LINK)pDict; + *linkAnnot = (FPDF_LINK)pDict; return TRUE; } } @@ -271,7 +271,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quad quadPoints->x4 = pArray->GetNumber(quadIndex*8+6); quadPoints->y4 = pArray->GetNumber(quadIndex*8+7); return TRUE; - } + } return FALSE; } diff --git a/fpdfsdk/src/fpdfeditimg.cpp b/fpdfsdk/src/fpdfeditimg.cpp index f06564e915..96cfba4194 100644 --- a/fpdfsdk/src/fpdfeditimg.cpp +++ b/fpdfsdk/src/fpdfeditimg.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 "../../public/fpdf_edit.h" @@ -28,7 +28,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCou pImgObj->m_GeneralState.GetModify(); for (int index=0;index<nCount;index++) { - CPDF_Page* pPage = (CPDF_Page*)pages[index]; + CPDF_Page* pPage = (CPDF_Page*)pages[index]; pImgObj->m_pImage->ResetCache(pPage,NULL); } pImgObj->m_pImage->SetJpegImage(pFile); @@ -63,7 +63,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,F pImgObj->m_GeneralState.GetModify(); for (int index=0;index<nCount;index++) { - CPDF_Page* pPage = (CPDF_Page*)pages[index]; + CPDF_Page* pPage = (CPDF_Page*)pages[index]; pImgObj->m_pImage->ResetCache(pPage,NULL); } pImgObj->m_pImage->SetImage(pBmp,FALSE); diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index 375062bf31..12c2cce1e2 100644 --- a/fpdfsdk/src/fpdfeditpage.cpp +++ b/fpdfsdk/src/fpdfeditpage.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 "../../public/fpdf_edit.h" @@ -34,7 +34,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() } } } - + CPDF_Dictionary* pInfoDict = NULL; pInfoDict = pDoc->GetInfo(); if (pInfoDict) @@ -50,9 +50,9 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { CPDF_Document* pDoc = (CPDF_Document*)document; - if (pDoc == NULL) + if (pDoc == NULL) return; - if (page_index < 0 || page_index >= pDoc->GetPageCount()) + if (page_index < 0 || page_index >= pDoc->GetPageCount()) return; pDoc->DeletePage(page_index); @@ -69,7 +69,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, page_index = 0; if(pDoc->GetPageCount()<page_index) page_index = pDoc->GetPageCount(); -// if (page_index < 0 || page_index >= pDoc->GetPageCount()) +// if (page_index < 0 || page_index >= pDoc->GetPageCount()) // return NULL; CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index); @@ -130,7 +130,7 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { return -1; } - + return rotate; } @@ -268,7 +268,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) } DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, - double a, double b, double c, double d, double e, double f) + double a, double b, double c, double d, double e, double f) { CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; if(pPageObj == NULL) diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index 304226f8f1..a8dfe7f7d7 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.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 "../../public/fpdf_formfill.h" @@ -35,7 +35,7 @@ DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, FPDF_ delete pInterForm; return -1; } - + int nType = pFormField->GetFieldType(); delete pInterForm; return nType; @@ -64,7 +64,7 @@ DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { if(!hHandle) - return; + return; CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetCurrentDoc(); if(pSDKDoc) { @@ -76,7 +76,7 @@ DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) } DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y) -{ +{ if (!hHandle || !page) return FALSE; // CPDF_Page * pPage = (CPDF_Page*) page; @@ -88,7 +88,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, FPDF_PAGE CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDF_Page*)page); if(!pPageView) return FALSE; - + // double page_x = 0; // double page_y = 0; // pEnv->FFI_DeviceToPage(page, point_x, point_y, &page_x, &page_y); @@ -140,8 +140,8 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE pa CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDF_Page*)page); if(!pPageView) return FALSE; - - + + return pPageView->OnKeyDown(nKeyCode, modifier); } @@ -155,8 +155,8 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDF_Page*)page); if(!pPageView) return FALSE; - - + + return pPageView->OnKeyUp(nKeyCode, modifier); } @@ -182,23 +182,23 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetCurrentDoc(); if(!pSDKDoc) return FALSE; - //Kill the current focus. + //Kill the current focus. return pSDKDoc->KillFocusAnnot(0); } -DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, +DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags) { if (!hHandle || !page) return ; CPDF_Page* pPage = (CPDF_Page*)page; - + CPDF_RenderOptions options; if (flags & FPDF_LCD_TEXT) options.m_Flags |= RENDER_CLEARTYPE; else options.m_Flags &= ~RENDER_CLEARTYPE; - + //Grayscale output if (flags & FPDF_GRAYSCALE) { @@ -211,8 +211,8 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, FPDF_BITMAP bitmap, options.m_pOCContext = new CPDF_OCContext(pPage->m_pDocument); CFX_AffineMatrix matrix; - pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); - + pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); + FX_RECT clip; clip.left = start_x; clip.right = start_x + size_x; @@ -275,7 +275,7 @@ DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, { pInterForm->SetHighlightColor(color, fieldType); } - + } } @@ -316,7 +316,7 @@ DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHan if(pPageView) { pPageView->SetValid(TRUE); - } + } } DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle) @@ -342,7 +342,7 @@ DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) pSDKDoc->InitPageView(); if(((CPDFDoc_Environment*)hHandle)->IsJSInitiated()) pSDKDoc->ProcJavascriptFun(); - } + } } DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) @@ -367,7 +367,7 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaTyp if (!pDic) return; CPDF_AAction aa = pDic->GetDict(FX_BSTRC("AA")); - + if(aa.ActionExist((CPDF_AAction::AActionType)aaType)) { CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); @@ -388,13 +388,13 @@ DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandl { CPDFDoc_Environment *pEnv = pSDKDoc->GetEnv(); ASSERT(pEnv != NULL); - + CPDFSDK_ActionHandler *pActionHandler = pEnv->GetActionHander(); ASSERT(pActionHandler != NULL); - + CPDF_Dictionary *pPageDict = pPage->m_pFormDict; ASSERT(pPageDict != NULL); - + CPDF_AAction aa = pPageDict->GetDict(FX_BSTRC("AA")); FX_BOOL bExistOAAction = FALSE; diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index a515e3e339..21ae05d89f 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.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 "../../public/fpdf_ppo.h" @@ -12,14 +12,14 @@ class CPDF_PageOrganizer public: CPDF_PageOrganizer(); ~CPDF_PageOrganizer(); - + public: FX_BOOL PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document *pSrcPDFDoc); FX_BOOL ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* nPageNum, CPDF_Document *pDestPDFDoc, int nIndex); CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary *pDict, CFX_ByteString nSrctag); FX_BOOL UpdateReference(CPDF_Object *pObj, CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPtrToPtr); int GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPtrToPtr, CPDF_Reference *pRef); - + }; @@ -37,17 +37,17 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document { if(!pDestPDFDoc || !pSrcPDFDoc) return false; - + CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot(); if(!pNewRoot) return FALSE; - + //Set the document information//////////////////////////////////////////// - + CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo(); - + if(!DInfoDict) return FALSE; - + CFX_ByteString producerstr; producerstr.Format("PDFium"); DInfoDict->SetAt("Producer", new CPDF_String(producerstr)); @@ -58,7 +58,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document { pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); } - + CPDF_Dictionary* pNewPages = (CPDF_Dictionary*)(pNewRoot->GetElement("Pages")? pNewRoot->GetElement("Pages")->GetDirect() : NULL); if(!pNewPages) { @@ -66,7 +66,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON)); } - + CFX_ByteString cbPageType = pNewPages->GetString("Type",""); if(cbPageType.Equal("")) { @@ -79,15 +79,15 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document CPDF_Array* pNewKids = new CPDF_Array; FX_DWORD Kidsobjnum = -1; Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);//, Kidsobjnum, Kidsgennum); - + pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum));//, Kidsgennum)); - pNewPages->SetAt("Count", new CPDF_Number(0)); + pNewPages->SetAt("Count", new CPDF_Number(0)); } return true; } -FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* nPageNum, +FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* nPageNum, CPDF_Document *pDestPDFDoc,int nIndex) { int curpage =nIndex; @@ -97,7 +97,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* for(int i=0; i<nPageNum->GetSize(); i++) { - + CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage); CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(nPageNum->GetAt(i)-1); if(!pSrcPageDict || !pCurPageDict) @@ -105,7 +105,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* delete pMapPtrToPtr; return FALSE; } - + // Clone the page dictionary/////////// FX_POSITION SrcPos = pSrcPageDict->GetStartPos(); while (SrcPos) @@ -119,15 +119,15 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone()); } } - + //inheritable item/////////////////////// CPDF_Object* pInheritable = NULL; //1 MediaBox //required if(!pCurPageDict->KeyExist("MediaBox")) { - + pInheritable = PageDictGetInheritableTag(pSrcPageDict, "MediaBox"); - if(!pInheritable) + if(!pInheritable) { //Search the "CropBox" from source page dictionary, if not exists,we take the letter size. pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox"); @@ -151,7 +151,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* if(!pCurPageDict->KeyExist("Resources")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources"); - if(!pInheritable) + if(!pInheritable) { delete pMapPtrToPtr; return FALSE; @@ -162,14 +162,14 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* if(!pCurPageDict->KeyExist("CropBox")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox"); - if(pInheritable) + if(pInheritable) pCurPageDict->SetAt("CropBox", pInheritable->Clone()); } //4 Rotate //Optional if(!pCurPageDict->KeyExist("Rotate")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Rotate"); - if(pInheritable) + if(pInheritable) pCurPageDict->SetAt("Rotate", pInheritable->Clone()); } @@ -177,7 +177,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* //Update the reference FX_DWORD dwOldPageObj = pSrcPageDict->GetObjNum(); FX_DWORD dwNewPageObj = pCurPageDict->GetObjNum(); - + pMapPtrToPtr->SetAt((void*)(uintptr_t)dwOldPageObj, (void*)(uintptr_t)dwNewPageObj); UpdateReference(pCurPageDict, pDestPDFDoc, pMapPtrToPtr); @@ -190,7 +190,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDict, CFX_ByteString nSrctag) { - if(!pDict || !pDict->KeyExist("Type") || nSrctag.IsEmpty()) + if(!pDict || !pDict->KeyExist("Type") || nSrctag.IsEmpty()) return NULL; CPDF_Object* pType = pDict->GetElement("Type")->GetDirect(); @@ -201,14 +201,14 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDic if(!pDict->KeyExist("Parent")) return NULL; CPDF_Object* pParent = pDict->GetElement("Parent")->GetDirect(); if(!pParent || pParent->GetType() != PDFOBJ_DICTIONARY) return NULL; - + CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent; - - if(pDict->KeyExist((const char*)nSrctag)) + + if(pDict->KeyExist((const char*)nSrctag)) return pDict->GetElement((const char*)nSrctag); while (pp) { - if(pp->KeyExist((const char*)nSrctag)) + if(pp->KeyExist((const char*)nSrctag)) return pp->GetElement((const char*)nSrctag); else if (pp->KeyExist("Parent")) { @@ -217,11 +217,11 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDic } else break; } - + return NULL; } -FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pDoc, +FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPtrToPtr) { switch (pObj->GetType()) @@ -237,7 +237,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pD case PDFOBJ_DICTIONARY: { CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj; - + FX_POSITION pos = pDict->GetStartPos(); while(pos) { @@ -298,9 +298,9 @@ int CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt if(!pRef) return 0; dwObjnum = pRef->GetRefObjNum(); - + size_t dwNewObjNum = 0; - + pMapPtrToPtr->Lookup((void*)dwObjnum, (void*&)dwNewObjNum); if(dwNewObjNum) { @@ -319,7 +319,7 @@ int CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt { return 0; } - + if(pClone->GetType() == PDFOBJ_DICTIONARY) { CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; @@ -340,7 +340,7 @@ int CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt } dwNewObjNum = pDoc->AddIndirectObject(pClone);//, onum, gnum); pMapPtrToPtr->SetAt((void*)dwObjnum, (void*)dwNewObjNum); - + if(!UpdateReference(pClone, pDoc, pMapPtrToPtr)) { pClone->Release(); @@ -375,7 +375,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_WordArray* pageAr nStringTo = nLength; } cbMidRange = rangstring.Mid(nStringFrom,nStringTo-nStringFrom); - + int nMid = cbMidRange.Find('-'); if(nMid == -1) { @@ -397,10 +397,10 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_WordArray* pageAr int nEnd = cbMidRange.GetLength()-nMid; if(nEnd ==0)return FALSE; - + // int nEndPageNum = (nEnd == 0)?nCount:atol(cbMidRange.Mid(nMid,nEnd)); int nEndPageNum = atol(cbMidRange.Mid(nMid,nEnd)); - + if(nStartPageNum < 0 ||nStartPageNum >nEndPageNum|| nEndPageNum > nCount) { return FALSE; @@ -417,7 +417,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_WordArray* pageAr return TRUE; } -DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc, +DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc, FPDF_BYTESTRING pagerange, int index) { if(dest_doc == NULL || src_doc == NULL ) @@ -437,7 +437,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMEN pageArray.Add(i); } } - + CPDF_Document* pDestDoc = (CPDF_Document*)dest_doc; CPDF_PageOrganizer pageOrg; diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 4a83345242..4b9d7acecf 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.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 "../../public/fpdf_edit.h" @@ -16,13 +16,13 @@ class CFX_IFileWrite final : public IFX_StreamWrite { - + public: CFX_IFileWrite(); FX_BOOL Init( FPDF_FILEWRITE * pFileWriteStruct ); virtual FX_BOOL WriteBlock(const void* pData, size_t size) override; virtual void Release() override {} - + protected: FPDF_FILEWRITE* m_pFileWriteStruct; }; @@ -50,7 +50,7 @@ FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) m_pFileWriteStruct->WriteBlock( m_pFileWriteStruct, pData, size ); return TRUE; } - else + else return FALSE; } @@ -58,14 +58,14 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF int fileVerion) { CPDF_Document* pDoc = (CPDF_Document*)document; - if (!pDoc) + if (!pDoc) return 0; - + if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY ) { flags = 0; } - + CPDF_Creator FileMaker(pDoc); if(bSetVersion) FileMaker.SetFileVersion(fileVerion); diff --git a/fpdfsdk/src/fpdftext.cpp b/fpdfsdk/src/fpdftext.cpp index a25b153cd4..1840247b95 100644 --- a/fpdfsdk/src/fpdftext.cpp +++ b/fpdfsdk/src/fpdftext.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 "../../public/fpdf_text.h" @@ -65,7 +65,7 @@ DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index,do { if (!text_page) return; IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; - + if (index<0 || index>=textpage->CountChars()) return ; FPDF_CHAR_INFO charinfo; textpage->GetCharInfo(index,charinfo); @@ -87,7 +87,7 @@ DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,int start,int cou { if (!text_page) return 0; IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; - + if (start>=textpage->CountChars()) return 0; CFX_WideString str=textpage->GetPageText(start,count); @@ -121,7 +121,7 @@ DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,int rect_index, *bottom=rect.bottom; } -DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double left, double top, +DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double left, double top, double right, double bottom,unsigned short* buffer,int buflen) { if (!text_page) return 0; @@ -141,7 +141,7 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double lef cbUTF16Str.ReleaseBuffer(size*sizeof(unsigned short)); return size; - + } //Search diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 96d1ff0e31..10bfc3db2c 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.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 "../../core/include/fxcrt/fx_safe_types.h" @@ -111,10 +111,10 @@ CFontMapper* g_pFontMapper = NULL; DLLEXPORT void STDCALL FPDF_InitLibrary() { g_pCodecModule = CCodec_ModuleMgr::Create(); - + CFX_GEModule::Create(); CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); - + CPDF_ModuleMgr::Create(); CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); CPDF_ModuleMgr::Get()->InitPageModule(); @@ -206,7 +206,7 @@ public: virtual void Release() {delete this;} virtual FX_FILESIZE GetSize() {return m_size;} - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) + virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { if (offset < 0) { return FALSE; @@ -356,7 +356,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded(); if (bBackgroundAlphaNeeded) { - + pBitmap = new CFX_DIBitmap; pBitmap->Create(size_x, size_y, FXDIB_Argb); pBitmap->Clear(0x00ffffff); @@ -373,12 +373,12 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL); - if (bBackgroundAlphaNeeded) + if (bBackgroundAlphaNeeded) { if (pBitmap) { CFX_WindowsDevice WinDC(dc); - + if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { CFX_DIBitmap* pDst = new CFX_DIBitmap; @@ -499,7 +499,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int } #endif -DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, +DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags) { if (bitmap == NULL || page == NULL) return; @@ -546,9 +546,9 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) { if (!document) return; - CPDF_Document* pDoc = (CPDF_Document*)document; + CPDF_Document* pDoc = (CPDF_Document*)document; CPDF_Parser* pParser = (CPDF_Parser*)pDoc->GetParser(); - if (pParser == NULL) + if (pParser == NULL) { delete pDoc; return; @@ -713,7 +713,7 @@ void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_ CFX_AffineMatrix matrix; - pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); + pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); FX_RECT clip; clip.left = start_x; @@ -817,7 +817,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_ { if (!document) return NULL; - if (!name || name[0] == 0) + if (!name || name[0] == 0) return NULL; CPDF_Document* pDoc = (CPDF_Document*)document; diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index e21bb85663..e35e537765 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.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/fsdk_define.h" @@ -10,7 +10,7 @@ //--------------------------------------------------------------------------- -// CPDFSDK_DateTime +// CPDFSDK_DateTime //--------------------------------------------------------------------------- int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) { @@ -376,7 +376,7 @@ void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) CPDFSDK_DateTime dt = *this; time_t t = (time_t)dt; struct tm* pTime = localtime(&t); - if(pTime){ + if(pTime){ st.wYear = (FX_WORD)pTime->tm_year + 1900; st.wMonth = (FX_WORD)pTime->tm_mon + 1; st.wDay = (FX_WORD)pTime->tm_mday; @@ -501,7 +501,7 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) //--------------------------------------------------------------------------- -// CPDFSDK_Annot +// CPDFSDK_Annot //--------------------------------------------------------------------------- CPDFSDK_Annot::CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) : m_pAnnot(pAnnot), @@ -525,7 +525,7 @@ CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() FX_DWORD CPDFSDK_Annot::GetFlags() { ASSERT(m_pAnnot != NULL); - + return m_pAnnot->GetFlags(); } @@ -549,7 +549,7 @@ void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) m_bSelected = bSelected; } -// Tab Order +// Tab Order int CPDFSDK_Annot::GetTabOrder() { return m_nTabOrder; @@ -563,7 +563,7 @@ void CPDFSDK_Annot::SetTabOrder(int iTabOrder) CPDF_Dictionary* CPDFSDK_Annot::GetAnnotDict() const { ASSERT(m_pAnnot != NULL); - + return m_pAnnot->GetAnnotDict(); } @@ -571,24 +571,24 @@ void CPDFSDK_Annot::SetRect(const CPDF_Rect& rect) { ASSERT(rect.right - rect.left >= GetMinWidth()); ASSERT(rect.top - rect.bottom >= GetMinHeight()); - + m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); } CPDF_Rect CPDFSDK_Annot::GetRect() const { ASSERT(m_pAnnot != NULL); - + CPDF_Rect rect; m_pAnnot->GetRect(rect); - + return rect; } CFX_ByteString CPDFSDK_Annot::GetType() const { ASSERT(m_pAnnot != NULL); - + return m_pAnnot->GetSubType(); } @@ -598,11 +598,11 @@ CFX_ByteString CPDFSDK_Annot::GetSubType() const } void CPDFSDK_Annot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device, - CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) + CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { ASSERT(m_pPageView != NULL); ASSERT(m_pAnnot != NULL); - + m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, mode, pOptions); } @@ -615,7 +615,7 @@ FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); if (pAP == NULL) return FALSE; - + // Choose the right sub-ap const FX_CHAR* ap_entry = "N"; if (mode == CPDF_Annot::Down) @@ -624,11 +624,11 @@ FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) ap_entry = "R"; if (!pAP->KeyExist(ap_entry)) ap_entry = "N"; - + // Get the AP stream or subdirectory CPDF_Object* psub = pAP->GetElementValue(ap_entry); if (psub == NULL) return FALSE; - + return TRUE; } @@ -636,14 +636,14 @@ void CPDFSDK_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUs const CPDF_RenderOptions* pOptions) { ASSERT(m_pAnnot != NULL); - m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); + m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); } void CPDFSDK_Annot::ClearCachedAP() { ASSERT(m_pAnnot != NULL); m_pAnnot->ClearCachedAP(); -} +} void CPDFSDK_Annot::SetContents(const CFX_WideString& sContents) { @@ -675,7 +675,7 @@ void CPDFSDK_Annot::SetModifiedDate(const FX_SYSTEMTIME& st) { CPDFSDK_DateTime dt(st); CFX_ByteString str = dt.ToPDFDateTimeString(); - + if (str.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveAt("M"); else @@ -684,12 +684,12 @@ void CPDFSDK_Annot::SetModifiedDate(const FX_SYSTEMTIME& st) FX_SYSTEMTIME CPDFSDK_Annot::GetModifiedDate() const { - FX_SYSTEMTIME systime; + FX_SYSTEMTIME systime; CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetString("M"); - + CPDFSDK_DateTime dt(str); dt.ToSystemTime(systime); - + return systime; } @@ -814,8 +814,8 @@ int CPDFSDK_Annot::GetBorderStyle() const CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); if (pBorder) { - if (pBorder->GetCount() >= 4) - { + if (pBorder->GetCount() >= 4) + { CPDF_Array *pDP = pBorder->GetArray(3); if (pDP && pDP->GetCount() > 0) return BBS_DASH; @@ -928,21 +928,21 @@ FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const } -void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox, +void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox, const CPDF_Matrix& matrix, const CFX_ByteString& sContents, const CFX_ByteString& sAPState) { CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); - - if (!pAPDict) + + if (!pAPDict) { pAPDict = new CPDF_Dictionary; m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); } - + CPDF_Stream* pStream = NULL; CPDF_Dictionary* pParentDict = NULL; - + if (sAPState.IsEmpty()) { pParentDict = pAPDict; @@ -956,11 +956,11 @@ void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re pAPTypeDict = new CPDF_Dictionary; pAPDict->SetAt(sAPType, pAPTypeDict); } - + pParentDict = pAPTypeDict; pStream = pAPTypeDict->GetStream(sAPState); } - + if (!pStream) { CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); @@ -978,13 +978,13 @@ void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re pStreamDict->SetAtInteger("FormType", 1); pStream->InitStream(NULL,0,pStreamDict); } - + if (pStreamDict) { - pStreamDict->SetAtMatrix("Matrix",matrix); - pStreamDict->SetAtRect("BBox", rcBBox); + pStreamDict->SetAtMatrix("Matrix",matrix); + pStreamDict->SetAtRect("BBox", rcBBox); } - + pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE); } @@ -1043,7 +1043,7 @@ CPDF_AAction CPDFSDK_Annot::GetAAction() const void CPDFSDK_Annot::SetAAction(const CPDF_AAction& aa) { ASSERT(aa != NULL); - + if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); } @@ -1068,7 +1068,7 @@ CPDF_Action CPDFSDK_Annot::GetAAction(CPDF_AAction::AActionType eAAT) void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, CPDF_RenderOptions* pOptions) { - + m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, CPDF_Annot::Normal, NULL); diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index f18180bf71..59431ec13d 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.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 "../../third_party/base/nonstd_unique_ptr.h" @@ -15,7 +15,7 @@ #include "../include/javascript/IJavaScript.h" //------------------------------------------------------------------------------------ -//* CPDFSDK_Widget +//* CPDFSDK_Widget //------------------------------------------------------------------------------------ #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) @@ -41,7 +41,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode { CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); if (pAP == NULL) return FALSE; - + // Choose the right sub-ap const FX_CHAR* ap_entry = "N"; if (mode == CPDF_Annot::Down) @@ -50,11 +50,11 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode ap_entry = "R"; if (!pAP->KeyExist(ap_entry)) ap_entry = "N"; - + // Get the AP stream or subdirectory CPDF_Object* psub = pAP->GetElementValue(ap_entry); if (psub == NULL) return FALSE; - + int nFieldType = GetFieldType(); switch (nFieldType) { @@ -66,17 +66,17 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode return psub->GetType() == PDFOBJ_STREAM; case FIELDTYPE_CHECKBOX: case FIELDTYPE_RADIOBUTTON: - if (psub->GetType() == PDFOBJ_DICTIONARY) + if (psub->GetType() == PDFOBJ_DICTIONARY) { CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub; - + return pSubDict->GetStream(GetAppState()) != NULL; } else return FALSE; break; } - + return TRUE; } @@ -84,7 +84,7 @@ int CPDFSDK_Widget::GetFieldType() const { CPDF_FormField* pField = GetFormField(); ASSERT(pField != NULL); - + return pField->GetFieldType(); } @@ -101,7 +101,7 @@ int CPDFSDK_Widget::GetFieldFlags() const CFX_ByteString CPDFSDK_Widget::GetSubType() const { int nType = GetFieldType(); - + if (nType == FIELDTYPE_SIGNATURE) return BFFT_SIGNATURE; return CPDFSDK_Annot::GetSubType(); @@ -110,20 +110,20 @@ CFX_ByteString CPDFSDK_Widget::GetSubType() const CPDF_FormField* CPDFSDK_Widget::GetFormField() const { ASSERT(m_pInterForm != NULL); - - CPDF_FormControl* pCtrl = GetFormControl(); + + CPDF_FormControl* pCtrl = GetFormControl(); ASSERT(pCtrl != NULL); - + return pCtrl->GetField(); } CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const { ASSERT(m_pInterForm != NULL); - + CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); ASSERT(pPDFInterForm != NULL); - + return pPDFInterForm->GetControlByDict(GetAnnotDict()); } static CPDF_Dictionary* BF_GetField(CPDF_Dictionary* pFieldDict, const FX_CHAR* name) @@ -132,11 +132,11 @@ static CPDF_Dictionary* BF_GetField(CPDF_Dictionary* pFieldDict, const FX_CHAR* // First check the dictionary itself CPDF_Object* pAttr = pFieldDict->GetElementValue(name); if (pAttr) return pFieldDict; - + // Now we need to search from parents CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); if (pParent == NULL) return NULL; - + return BF_GetField(pParent, name); } @@ -144,9 +144,9 @@ CPDF_FormControl* CPDFSDK_Widget::GetFormControl(CPDF_InterForm* pInterForm, CPD { ASSERT(pInterForm != NULL); ASSERT(pAnnotDict != NULL); - + CPDF_FormControl* pControl = pInterForm->GetControlByDict(pAnnotDict); - + return pControl; } @@ -154,7 +154,7 @@ int CPDFSDK_Widget::GetRotate() const { CPDF_FormControl* pCtrl = GetFormControl(); ASSERT(pCtrl != NULL); - + return pCtrl->GetRotation() % 360; } @@ -162,10 +162,10 @@ FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - - int iColorType = 0; + + int iColorType = 0; color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); - + return iColorType != COLORTYPE_TRANSPARENT; } @@ -173,10 +173,10 @@ FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - - int iColorType = 0; + + int iColorType = 0; color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); - + return iColorType != COLORTYPE_TRANSPARENT; } @@ -184,18 +184,18 @@ FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - + CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (da.HasColor()) { FX_ARGB argb; - int iColorType = COLORTYPE_TRANSPARENT; + int iColorType = COLORTYPE_TRANSPARENT; da.GetColor(argb, iColorType); color = FX_ARGBTOCOLORREF(argb); - + return iColorType != COLORTYPE_TRANSPARENT; } - + return FALSE; } @@ -203,12 +203,12 @@ FX_FLOAT CPDFSDK_Widget::GetFontSize() const { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - + CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); CFX_ByteString csFont = ""; FX_FLOAT fFontSize = 0.0f; pDa.GetFont(csFont, fFontSize); - + return fFontSize; } @@ -216,7 +216,7 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->GetSelectedIndex(nIndex); } @@ -224,7 +224,7 @@ CFX_WideString CPDFSDK_Widget::GetValue() const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->GetValue(); } @@ -232,7 +232,7 @@ CFX_WideString CPDFSDK_Widget::GetDefaultValue() const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->GetDefaultValue(); } @@ -240,7 +240,7 @@ CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->GetOptionLabel(nIndex); } @@ -248,7 +248,7 @@ int CPDFSDK_Widget::CountOptions() const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->CountOptions(); } @@ -256,7 +256,7 @@ FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->IsItemSelected(nIndex); } @@ -264,7 +264,7 @@ int CPDFSDK_Widget::GetTopVisibleIndex() const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->GetTopVisibleIndex(); } @@ -272,7 +272,7 @@ FX_BOOL CPDFSDK_Widget::IsChecked() const { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - + return pFormCtrl->IsChecked(); } @@ -280,7 +280,7 @@ int CPDFSDK_Widget::GetAlignment() const { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - + return pFormCtrl->GetControlAlignment(); } @@ -288,7 +288,7 @@ int CPDFSDK_Widget::GetMaxLen() const { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + return pFormField->GetMaxLen(); } @@ -296,10 +296,10 @@ void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) { CPDF_FormControl* pFormCtrl = GetFormControl(); ASSERT(pFormCtrl != NULL); - + CPDF_FormField* pFormField = pFormCtrl->GetField(); ASSERT(pFormField != NULL); - + pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, bNotify); } @@ -307,7 +307,7 @@ void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + pFormField->SetValue(sValue, bNotify); } @@ -318,7 +318,7 @@ void CPDFSDK_Widget::SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bN { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + pFormField->SetItemSelection(index, bSelected, bNotify); } @@ -326,7 +326,7 @@ void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + pFormField->ClearSelection(bNotify); } @@ -360,7 +360,7 @@ void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChang m_nValueAge++; int nFieldType = GetFieldType(); - + switch (nFieldType) { case FIELDTYPE_PUSHBUTTON: @@ -382,7 +382,7 @@ void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChang ResetAppearance_TextField(sValue); break; } - + ASSERT(m_pAnnot != NULL); m_pAnnot->ClearCachedAP(); } @@ -398,7 +398,7 @@ void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + ASSERT(m_pInterForm != NULL); m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); @@ -408,21 +408,21 @@ void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { int nFieldType = GetFieldType(); - + if ((nFieldType == FIELDTYPE_CHECKBOX || nFieldType == FIELDTYPE_RADIOBUTTON) && - mode == CPDF_Annot::Normal && + mode == CPDF_Annot::Normal && !IsWidgetAppearanceValid(CPDF_Annot::Normal)) { CFX_PathData pathData; - + CPDF_Rect rcAnnot = GetRect(); - + pathData.AppendRect(rcAnnot.left, rcAnnot.bottom, rcAnnot.right, rcAnnot.top); - + CFX_GraphStateData gsd; gsd.m_LineWidth = 0.0f; - + pDevice->DrawPath(&pathData, pUser2Device, &gsd, 0, 0xFFAAAAAA, FXFILL_ALTERNATE); } else @@ -435,7 +435,7 @@ void CPDFSDK_Widget::UpdateField() { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField != NULL); - + ASSERT(m_pInterForm != NULL); m_pInterForm->UpdateField(pFormField); } @@ -443,11 +443,11 @@ void CPDFSDK_Widget::UpdateField() void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView) { ASSERT(m_pInterForm != NULL); - + int nFieldType = GetFieldType(); if (m_pInterForm->IsNeedHighLight(nFieldType)) { - + // if (nFieldType != FIELDTYPE_PUSHBUTTON) // { CPDF_Rect rc = GetRect(); @@ -470,7 +470,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPa FX_ARGB argb = ArgbEncode((int)alpha, color); FX_RECT rcDev((int)rcDevice.left,(int)rcDevice.top,(int)rcDevice.right,(int)rcDevice.bottom); - pDevice->FillRect(&rcDev, argb); + pDevice->FillRect(&rcDev, argb); /* }*/ } } @@ -481,8 +481,8 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() ASSERT(pControl != NULL); - - CPDF_Rect rcWindow = GetRotatedRect(); + + CPDF_Rect rcWindow = GetRotatedRect(); int32_t nLayout = 0; @@ -550,12 +550,12 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() case BBS_UNDERLINE: nBorderStyle = PBS_UNDERLINED; break; - default: + default: nBorderStyle = PBS_SOLID; break; } - CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,fBorderWidth); + CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,fBorderWidth); CPWL_Color crText(COLORTYPE_GRAY,0); @@ -569,7 +569,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); } - if (da.HasFont()) + if (da.HasFont()) da.GetFont(csNameTag, fFontSize); CFX_WideString csWCaption; @@ -643,7 +643,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() FontMap.SetAPType("N"); - CFX_ByteString csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + + CFX_ByteString csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ? rcWindow : rcClient, &FontMap, pNormalIcon, iconFit, csNormalCaption, crText, fFontSize, nLayout); @@ -654,7 +654,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() CPDF_FormControl::HighlightingMode eHLM = pControl->GetHighlightingMode(); if (eHLM == CPDF_FormControl::Push || eHLM == CPDF_FormControl::Toggle) { - if (csRolloverCaption.IsEmpty() && !pRolloverIcon) + if (csRolloverCaption.IsEmpty() && !pRolloverIcon) { csRolloverCaption = csNormalCaption; pRolloverIcon = pNormalIcon; @@ -662,7 +662,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() FontMap.SetAPType("R"); - csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + + csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ? rcWindow : rcClient, &FontMap, pRolloverIcon, iconFit, csRolloverCaption, crText, fFontSize, nLayout); @@ -690,11 +690,11 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() crRightBottom = CPWL_Color(COLORTYPE_GRAY,1); break; } - + FontMap.SetAPType("D"); - csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, CPWL_Utils::SubstractColor(crBackground,0.25f)) + - CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + + csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, CPWL_Utils::SubstractColor(crBackground,0.25f)) + + CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + CPWL_Utils::GetPushButtonAppStream(iconFit.GetFittingBounds() ? rcWindow : rcClient, &FontMap, pDownIcon, iconFit, csDownCaption, crText, fFontSize, nLayout); WriteAppearance("D", GetRotatedRect(), GetMatrix(), csAP); @@ -716,7 +716,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() CPWL_Color crBackground, crBorder, crText; - + int iColorType; FX_FLOAT fc[4]; @@ -754,7 +754,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() case BBS_UNDERLINE: nBorderStyle = PBS_UNDERLINED; break; - default: + default: nBorderStyle = PBS_SOLID; break; } @@ -777,7 +777,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() switch (csWCaption[0]) { case L'l': - nStyle = PCS_CIRCLE; + nStyle = PCS_CIRCLE; break; case L'8': nStyle = PCS_CROSS; @@ -821,7 +821,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() break; } - CFX_ByteString csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Utils::SubstractColor(crBackground,0.25f)) + + CFX_ByteString csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Utils::SubstractColor(crBackground,0.25f)) + CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); CFX_ByteString csAP_D_OFF = csAP_D_ON; @@ -844,11 +844,11 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() { CPDF_FormControl* pControl = GetFormControl(); ASSERT(pControl != NULL); - + CPWL_Color crBackground, crBorder, crText; - + int iColorType; FX_FLOAT fc[4]; @@ -886,7 +886,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() case BBS_UNDERLINE: nBorderStyle = PBS_UNDERLINED; break; - default: + default: nBorderStyle = PBS_SOLID; break; } @@ -909,7 +909,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() switch (csWCaption[0]) { default: //L'l': - nStyle = PCS_CIRCLE; + nStyle = PCS_CIRCLE; break; case L'8': nStyle = PCS_CROSS; @@ -936,7 +936,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() CFX_ByteString csAP_N_ON; CPDF_Rect rcCenter = CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare(rcWindow), 1.0f); - + if (nStyle == PCS_CIRCLE) { if (nBorderStyle == PBS_BEVELED) @@ -950,12 +950,12 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() crRightBottom = CPWL_Color(COLORTYPE_GRAY,0.75f); } - csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter,crBackground) + + csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter,crBackground) + CPWL_Utils::GetCircleBorderAppStream(rcCenter,fBorderWidth,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); } else { - csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,crBackground) + + csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,crBackground) + CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); } @@ -998,8 +998,8 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() } else { - csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Utils::SubstractColor(crBackground,0.25f)) + - CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); + csAP_D_ON = CPWL_Utils::GetRectFillAppStream(rcWindow,CPWL_Utils::SubstractColor(crBackground,0.25f)) + + CPWL_Utils::GetBorderAppStream(rcWindow,fBorderWidth,crBorder,crLeftTop,crRightBottom,nBorderStyle,dsBorder); } CFX_ByteString csAP_D_OFF = csAP_D_ON; @@ -1046,7 +1046,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) CPDF_Rect rcEdit = rcClient; rcEdit.right = rcButton.left; rcEdit.Normalize(); - + pEdit->SetPlateRect(rcEdit); pEdit->SetAlignmentV(1); @@ -1055,9 +1055,9 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) pEdit->SetAutoFontSize(TRUE); else pEdit->SetFontSize(fFontSize); - + pEdit->Initialize(); - + if (sValue) pEdit->SetText(sValue); else @@ -1079,11 +1079,11 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) if (rcContent.Width() > rcEdit.Width() || rcContent.Height() > rcEdit.Height()) { - sBody << rcEdit.left << " " << rcEdit.bottom << " " + sBody << rcEdit.left << " " << rcEdit.bottom << " " << rcEdit.Width() << " " << rcEdit.Height() << " re\nW\nn\n"; } - CPWL_Color crText = GetTextPWLColor(); + CPWL_Color crText = GetTextPWLColor(); sBody << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" << "Q\nEMC\n"; } @@ -1120,15 +1120,15 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() FontMap.Initial(); pEdit->SetFontMap(&FontMap); - pEdit->SetPlateRect(CPDF_Rect(rcClient.left,0.0f,rcClient.right,0.0f)); - + pEdit->SetPlateRect(CPDF_Rect(rcClient.left,0.0f,rcClient.right,0.0f)); + FX_FLOAT fFontSize = GetFontSize(); if (IsFloatZero(fFontSize)) pEdit->SetFontSize(12.0f); else pEdit->SetFontSize(fFontSize); - + pEdit->Initialize(); CFX_ByteTextBuf sList; @@ -1140,7 +1140,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() for (int32_t i=nTop; i<nCount; i++) { - FX_BOOL bSelected = FALSE; + FX_BOOL bSelected = FALSE; for (int32_t j=0; j<nSelCount; j++) { if (pField->GetSelectedIndex(j) == i) @@ -1161,22 +1161,22 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() sList << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),TRUE) << rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n"; - sList << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY,1),TRUE) << + sList << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY,1),TRUE) << CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.0f,fy)) << "ET\n"; } else { CPWL_Color crText = GetTextPWLColor(); - sList << "BT\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << + sList << "BT\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.0f,fy)) << "ET\n"; } fy -= fItemHeight; } - + if (sList.GetSize() > 0) { - sBody << "/Tx BMC\n" << "q\n" << rcClient.left << " " << rcClient.bottom << " " + sBody << "/Tx BMC\n" << "q\n" << rcClient.left << " " << rcClient.bottom << " " << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; sBody << sList << "Q\nEMC\n"; } @@ -1197,7 +1197,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) ASSERT(pField != NULL); CFX_ByteTextBuf sBody, sLines; - + if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) { pEdit->EnableRefresh(FALSE); @@ -1213,7 +1213,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) CPDF_Rect rcClient = GetClientRect(); pEdit->SetPlateRect(rcClient); pEdit->SetAlignmentH(pControl->GetControlAlignment()); - + FX_DWORD dwFieldFlags = pField->GetFieldFlags(); FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; @@ -1236,7 +1236,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) int nMaxLen = pField->GetMaxLen(); FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1; - FX_FLOAT fFontSize = GetFontSize(); + FX_FLOAT fFontSize = GetFontSize(); if (nMaxLen > 0) { @@ -1252,7 +1252,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) else { if (sValue) - nMaxLen = wcslen((const wchar_t*)sValue); + nMaxLen = wcslen((const wchar_t*)sValue); pEdit->SetLimitChar(nMaxLen); } } @@ -1263,7 +1263,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) pEdit->SetFontSize(fFontSize); pEdit->Initialize(); - + if (sValue) pEdit->SetText(sValue); else @@ -1280,10 +1280,10 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) if (rcContent.Width() > rcClient.Width() || rcContent.Height() > rcClient.Height()) { - sBody << rcClient.left << " " << rcClient.bottom << " " + sBody << rcClient.left << " " << rcClient.bottom << " " << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; } - CPWL_Color crText = GetTextPWLColor(); + CPWL_Color crText = GetTextPWLColor(); sBody << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" << "Q\nEMC\n"; } @@ -1296,18 +1296,18 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) CFX_ByteString sColor = CPWL_Utils::GetColorAppStream(GetBorderPWLColor(),FALSE); if (sColor.GetLength() > 0) { - sLines << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(),FALSE) << " 2 J 0 j\n"; + sLines << "q\n" << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(),FALSE) << " 2 J 0 j\n"; for (int32_t i=1;i<nMaxLen;i++) { sLines << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " << rcClient.bottom << " m\n" << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " - << rcClient.top << " l S\n"; + << rcClient.top << " l S\n"; } - sLines << "Q\n"; + sLines << "Q\n"; } } break; @@ -1318,18 +1318,18 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); - sLines << "q\n" << GetBorderWidth() << " w\n" + sLines << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(),FALSE) - << "[" << dsBorder.nDash << " " - << dsBorder.nGap << "] " + << "[" << dsBorder.nDash << " " + << dsBorder.nGap << "] " << dsBorder.nPhase << " d\n"; - for (int32_t i=1;i<nMaxLen;i++) + for (int32_t i=1;i<nMaxLen;i++) { sLines << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " << rcClient.bottom << " m\n" << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " - << rcClient.top << " l S\n"; + << rcClient.top << " l S\n"; } sLines << "Q\n"; @@ -1376,7 +1376,7 @@ CPDF_Rect CPDFSDK_Widget::GetRotatedRect() const case 0: case 180: default: - rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight); + rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight); break; case 90: case 270: @@ -1428,12 +1428,12 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const case BBS_UNDERLINE: nBorderStyle = PBS_UNDERLINED; break; - default: + default: nBorderStyle = PBS_SOLID; break; } - return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftTop, + return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder); } @@ -1446,7 +1446,7 @@ CPDF_Matrix CPDFSDK_Widget::GetMatrix() const CPDF_Rect rcAnnot = GetRect(); FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; - + switch (abs(pControl->GetRotation() % 360)) @@ -1543,7 +1543,7 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St sImageAlias = pImageDict->GetString("Name"); if (sImageAlias.IsEmpty()) sImageAlias = "IMG"; - } + } CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); if (!pStreamResList) @@ -1576,13 +1576,13 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAc { CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); ASSERT(pDocument != NULL); - + CPDFDoc_Environment* pEnv = pDocument->GetEnv(); ASSERT(pEnv != NULL); CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();/*(CPDFSDK_ActionHandler*)pApp->GetActionHandler();*/ ASSERT(pActionHandler != NULL); - + return pActionHandler->DoAction_Field(action, type, pDocument, GetFormField(), data); } @@ -1651,11 +1651,11 @@ FX_BOOL CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) if(annotRect.Contains(pageX, pageY)) { if (!IsVisible()) return FALSE; - + int nFieldFlags = GetFieldFlags(); - if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) + if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FALSE; - + return TRUE; } return FALSE; @@ -1720,7 +1720,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL b CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const { if(!pControl || !m_pInterForm) return NULL; - + CPDFSDK_Widget* pWidget = NULL; m_Map.Lookup(pControl, pWidget); @@ -1743,7 +1743,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const } } - if (!pPage) + if (!pPage) { int nPageIndex = GetPageIndexByAnnotDict(pDocument, pControlDict); if (nPageIndex >= 0) @@ -1767,7 +1767,7 @@ void CPDFSDK_InterForm::GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArra CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); ASSERT(pFormField != NULL); - GetWidgets(pFormField, widgets); + GetWidgets(pFormField, widgets); } } @@ -1795,7 +1795,7 @@ int CPDFSDK_InterForm::GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Di for (int i=0,sz=pDocument->GetPageCount(); i<sz; i++) { if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) - { + { if (CPDF_Array* pAnnots = pPageDict->GetArray("Annots")) { for (int j=0,jsz=pAnnots->GetCount(); j<jsz; j++) @@ -1937,16 +1937,16 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { IFXJS_Context* pContext = pRuntime->NewContext(); ASSERT(pContext != NULL); - + CFX_WideString sOldValue = pField->GetValue(); CFX_WideString sValue = sOldValue; FX_BOOL bRC = TRUE; pContext->OnField_Calculate(pFormField, pField, sValue, bRC); - + CFX_WideString sInfo; FX_BOOL bRet = pContext->RunScript(csJS, sInfo); pRuntime->ReleaseContext(pContext); - + if (bRet) { if (bRC) @@ -1962,7 +1962,7 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) } } - + } m_bBusy = FALSE; @@ -1980,11 +1980,11 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& { bFormated = FALSE; return sValue; - } + } IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); ASSERT(pRuntime != NULL); - + pRuntime->SetReaderDocument(m_pDocument); if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) @@ -2000,11 +2000,11 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated = FALSE; CPDF_AAction aAction = pFormField->GetAdditionalAction(); - if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format)) + if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Format); if (action) - { + { CFX_WideString script = action.GetJavaScript(); if (!script.IsEmpty()) { @@ -2014,7 +2014,7 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& ASSERT(pContext != NULL); pContext->OnField_Format(pFormField, Value, TRUE); - + CFX_WideString sInfo; FX_BOOL bRet = pContext->RunScript(script, sInfo); pRuntime->ReleaseContext(pContext); @@ -2059,7 +2059,7 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { CPDFDoc_Environment * pEnv = m_pDocument->GetEnv(); CFFL_IFormFiller* pIFormFiller = pEnv->GetIFormFiller(); - + CPDF_Page * pPage = pWidget->GetPDFPage(); CPDFSDK_PageView * pPageView = m_pDocument->GetPageView(pPage,FALSE); @@ -2075,24 +2075,24 @@ void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideSt ASSERT(pFormField != NULL); CPDF_AAction aAction = pFormField->GetAdditionalAction(); - if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke)) + if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); if (action) - { + { ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv != NULL); CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); ASSERT(pActionHandler != NULL); - + PDFSDK_FieldAction fa; fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); fa.sValue = csValue; - pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::KeyStroke, + pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::KeyStroke, m_pDocument, pFormField, fa); bRC = fa.bRC; } @@ -2104,15 +2104,15 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c ASSERT(pFormField != NULL); CPDF_AAction aAction = pFormField->GetAdditionalAction(); - if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate)) + if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); if (action) - { + { ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv != NULL); - + CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); ASSERT(pActionHandler != NULL); @@ -2123,7 +2123,7 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::Validate, m_pDocument, pFormField, fa); bRC = fa.bRC; - + } } } @@ -2144,13 +2144,13 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) FX_BOOL bHide = action.GetHideStatus(); FX_BOOL bChanged = FALSE; - + for (int i=0, sz=fields.GetSize(); i<sz; i++) { CPDF_FormField* pField = (CPDF_FormField*)fields[i]; ASSERT(pField != NULL); - + for (int j=0,jsz=pField->CountControls(); j<jsz; j++) { CPDF_FormControl* pControl = pField->GetControl(j); @@ -2175,7 +2175,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) CPDFSDK_PageView* pPageView = pWidget->GetPageView(); ASSERT(pPageView != NULL); - + pPageView->UpdateView(pWidget); bChanged = TRUE; @@ -2199,12 +2199,12 @@ FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { CPDF_ActionFields af = action.GetWidgets(); FX_DWORD dwFlags = action.GetFlags(); - + CFX_PtrArray fieldObjects; af.GetAllFields(fieldObjects); CFX_PtrArray fields; GetFieldFromObjects(fieldObjects, fields); - + if (fields.GetSize() != 0) { FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); @@ -2246,7 +2246,7 @@ FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con uint8_t* pBuffer = textBuf.GetBuffer(); FX_STRSIZE nBufSize = textBuf.GetLength(); - + if (bUrlEncoded) { if(!FDFToURLEncodedData(pBuffer, nBufSize)) @@ -2254,7 +2254,7 @@ FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con } pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); - + return TRUE; } @@ -2263,18 +2263,18 @@ void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) ASSERT(m_pDocument != NULL); if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsigned char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength())) - { + { CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); if(pRootDic) { CPDF_Dictionary * pFDFDict=pRootDic->GetDict("FDF"); if(pFDFDict) - { + { CPDF_Dictionary * pJSDict = pFDFDict->GetDict("JavaScript"); if(pJSDict) { CFX_WideString csJS; - + CPDF_Object* pJS = pJSDict->GetElementValue("Before"); if (pJS != NULL) { @@ -2284,7 +2284,7 @@ void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) else if (iType == PDFOBJ_STREAM) csJS = pJS->GetUnicodeText(); } - + } } } @@ -2306,14 +2306,14 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufS { CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); if (pMainDict == NULL) return FALSE; - + // Get fields CPDF_Array* pFields = pMainDict->GetArray("Fields"); if (pFields == NULL) return FALSE; - + CFX_ByteTextBuf fdfEncodedData; - for (FX_DWORD i = 0; i < pFields->GetCount(); i ++) + for (FX_DWORD i = 0; i < pFields->GetCount(); i ++) { CPDF_Dictionary* pField = pFields->GetDict(i); if (pField == NULL) continue; @@ -2344,12 +2344,12 @@ FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,F { ASSERT(m_pDocument != NULL); ASSERT(m_pInterForm != NULL); - + CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),(CFX_PtrArray&)fields, bIncludeOrExclude); if (!pFDF) return FALSE; FX_BOOL bRet = pFDF->WriteBuf(textBuf); // = FALSE;// delete pFDF; - + return bRet; } @@ -2368,7 +2368,7 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, FX_BOO if(NULL == m_pDocument) return FALSE; CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); - + if(NULL == m_pInterForm) return FALSE; CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); if (NULL == pFDFDoc) return FALSE; @@ -2380,7 +2380,7 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, FX_BOO uint8_t* pBuffer = FdfBuffer.GetBuffer(); FX_STRSIZE nBufSize = FdfBuffer.GetLength(); - + if (bUrlEncoded) { if(!FDFToURLEncodedData(pBuffer, nBufSize)) @@ -2388,11 +2388,11 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, FX_BOO } pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); - + if (bUrlEncoded && pBuffer) { FX_Free(pBuffer); - pBuffer = NULL; + pBuffer = NULL; } return TRUE; @@ -2403,13 +2403,13 @@ FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) ASSERT(m_pInterForm != NULL); ASSERT(m_pDocument != NULL); - + CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); if (!pFDF) return FALSE; - + FX_BOOL bRet = pFDF->WriteBuf(textBuf); delete pFDF; - + return bRet; } @@ -2448,7 +2448,7 @@ void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr { CPDF_Object* pObject = (CPDF_Object*)objects[i]; if (pObject == NULL) continue; - + int iType = pObject->GetType(); if (iType == PDFOBJ_STRING) { @@ -2478,7 +2478,7 @@ int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_WideS { FX_BOOL bRC = TRUE; OnKeyStrokeCommit(pFormField, csValue, bRC); - if (bRC) + if (bRC) { OnValidate(pFormField, csValue, bRC); if (bRC) @@ -2526,7 +2526,7 @@ int CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, CFX_W { FX_BOOL bRC = TRUE; OnKeyStrokeCommit(pFormField, csValue, bRC); - if (bRC) + if (bRC) { OnValidate(pFormField, csValue, bRC); if (bRC) @@ -2628,7 +2628,7 @@ void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) break; } } - + } FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) @@ -2681,7 +2681,7 @@ CPDFSDK_Annot* CBA_AnnotIterator::GetFirstAnnot() { if (m_Annots.GetSize() > 0) return m_Annots[0]; - + return NULL; } @@ -2769,7 +2769,7 @@ void CBA_AnnotIterator::GenerateResults() CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); ASSERT(pAnnot != NULL); - if (pAnnot->GetType() == m_sType + if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType) m_Annots.Add(pAnnot); } @@ -2780,13 +2780,13 @@ void CBA_AnnotIterator::GenerateResults() CPDFSDK_SortAnnots sa; { - + for (int i=0,sz=m_pPageView->CountAnnots(); i<sz; i++) { CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); ASSERT(pAnnot != NULL); - if (pAnnot->GetType() == m_sType + if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType) sa.Add(pAnnot); } @@ -2825,7 +2825,7 @@ void CBA_AnnotIterator::GenerateResults() ASSERT(pLeftTopAnnot != NULL); CPDF_Rect rcLeftTop = GetAnnotRect(pLeftTopAnnot); - + m_Annots.Add(pLeftTopAnnot); sa.RemoveAt(nLeftTopIndex); @@ -2876,7 +2876,7 @@ void CBA_AnnotIterator::GenerateResults() CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); ASSERT(pAnnot != NULL); - if (pAnnot->GetType() == m_sType + if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType) sa.Add(pAnnot); } @@ -2920,7 +2920,7 @@ void CBA_AnnotIterator::GenerateResults() ASSERT(pLeftTopAnnot != NULL); CPDF_Rect rcLeftTop = GetAnnotRect(pLeftTopAnnot); - + m_Annots.Add(pLeftTopAnnot); sa.RemoveAt(nLeftTopIndex); diff --git a/fpdfsdk/src/fsdk_rendercontext.cpp b/fpdfsdk/src/fsdk_rendercontext.cpp index 89c6179254..70c4a17248 100644 --- a/fpdfsdk/src/fsdk_rendercontext.cpp +++ b/fpdfsdk/src/fsdk_rendercontext.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/fsdk_rendercontext.h" diff --git a/fpdfsdk/src/fxedit/fxet_ap.cpp b/fpdfsdk/src/fxedit/fxet_ap.cpp index 10a76a7157..309a98f41e 100644 --- a/fpdfsdk/src/fxedit/fxet_ap.cpp +++ b/fpdfsdk/src/fxedit/fxet_ap.cpp @@ -1,14 +1,14 @@ // 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/fxedit/fxet_stub.h" #include "../../include/fxedit/fx_edit.h" #include "../../include/fxedit/fxet_edit.h" -CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) +CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { ASSERT (pFontMap != NULL); @@ -18,7 +18,7 @@ CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, { if (SubWord > 0) { - Word = SubWord; + Word = SubWord; } else { @@ -65,7 +65,7 @@ static CFX_ByteString GetFontSetString(IFX_Edit_FontMap * pFontMap, int32_t nFon return sRet.GetByteString(); } -CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, +CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange /* = NULL*/, FX_BOOL bContinuous/* = TRUE*/, FX_WORD SubWord/* = 0*/) { CFX_ByteTextBuf sEditStream, sWords; @@ -88,7 +88,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - if (bContinuous) + if (bContinuous) { if (place.LineCmp(oldplace) != 0) { @@ -120,7 +120,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi CPVT_Word word; if (pIterator->GetWord(word)) - { + { if (word.nFontIndex != nCurFontIndex) { if (sWords.GetSize() > 0) @@ -148,7 +148,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi { sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y << " Td\n"; ptOld = ptNew; - } + } if (word.nFontIndex != nCurFontIndex) { @@ -184,12 +184,12 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi } sAppStream << sEditStream; - } + } return sAppStream.GetByteString(); } -CFX_ByteString IFX_Edit::GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, +CFX_ByteString IFX_Edit::GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange /*= NULL*/) { CFX_ByteTextBuf sRet; @@ -199,22 +199,22 @@ CFX_ByteString IFX_Edit::GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_P if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { pIterator->SetAt(pRange->BeginPos); - + while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place.WordCmp(pRange->EndPos) > 0) break; + if (pRange && place.WordCmp(pRange->EndPos) > 0) break; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word) && pIterator->GetLine(line)) - { + { //CPDF_Rect rcWordSel = CPDF_Rect(word.ptWord.x,line.ptLine.y + line.fLineDescent, // word.ptWord.x+word.fWidth,line.ptLine.y + line.fLineAscent); sRet << word.ptWord.x + ptOffset.x << " " << line.ptLine.y + line.fLineDescent - << " " << word.fWidth << " " << line.fLineAscent - line.fLineDescent << " re\nf\n"; + << " " << word.fWidth << " " << line.fLineAscent - line.fLineDescent << " re\nf\n"; } } } diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index 19c05d20ae..70d7b77553 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.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/fxedit/fxet_stub.h" @@ -11,7 +11,7 @@ /* ---------------------------- CFX_Edit_Iterator ---------------------------- */ -CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : +CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : m_pEdit(pEdit), m_pVTIterator(pVTIterator) { @@ -24,7 +24,7 @@ CFX_Edit_Iterator::~CFX_Edit_Iterator() FX_BOOL CFX_Edit_Iterator::NextWord() { ASSERT(m_pVTIterator != NULL); - + return m_pVTIterator->NextWord(); } @@ -45,7 +45,7 @@ FX_BOOL CFX_Edit_Iterator::NextSection() FX_BOOL CFX_Edit_Iterator::PrevWord() { ASSERT(m_pVTIterator != NULL); - + return m_pVTIterator->PrevWord(); } @@ -83,7 +83,7 @@ FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const ASSERT(m_pVTIterator != NULL); if (m_pVTIterator->GetLine(line)) - { + { line.ptLine = m_pEdit->VTToEdit(line.ptLine); return TRUE; } @@ -153,12 +153,12 @@ int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_ { FX_DWORD charcode = word; - if (pPDFFont->IsUnicodeCompatible()) - charcode = pPDFFont->CharCodeFromUnicode(word); + if (pPDFFont->IsUnicodeCompatible()) + charcode = pPDFFont->CharCodeFromUnicode(word); else charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, word); - if (charcode != -1) + if (charcode != -1) return pPDFFont->GetCharWidthF(charcode); } @@ -272,14 +272,14 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) { rcResult = pOldRect->m_rcLine; rcResult.Union(pNewRect->m_rcLine); - m_RefreshRects.Add(rcResult); + m_RefreshRects.Add(rcResult); } else { - if (!pNewRect->IsSameLeft(*pOldRect)) + if (!pNewRect->IsSameLeft(*pOldRect)) { rcResult = pOldRect->m_rcLine; - rcResult.Union(pNewRect->m_rcLine); + rcResult.Union(pNewRect->m_rcLine); } else { @@ -374,9 +374,9 @@ void CFX_Edit_Undo::Undo() ASSERT(pItem != NULL); pItem->Undo(); - + m_nCurUndoPos--; - m_bModified = (m_nCurUndoPos != 0); + m_bModified = (m_nCurUndoPos != 0); } m_bWorking = FALSE; @@ -401,7 +401,7 @@ void CFX_Edit_Undo::Redo() pItem->Redo(); m_nCurUndoPos++; - m_bModified = (m_nCurUndoPos != 0); + m_bModified = (m_nCurUndoPos != 0); } m_bWorking = FALSE; @@ -417,17 +417,17 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) ASSERT(!m_bWorking); ASSERT(pItem != NULL); ASSERT(m_nBufSize > 1); - + if (m_nCurUndoPos < m_UndoItemStack.GetSize()) RemoveTails(); if (m_UndoItemStack.GetSize() >= m_nBufSize) { - RemoveHeads(); + RemoveHeads(); m_bVirgin = FALSE; } - m_UndoItemStack.Add(pItem); + m_UndoItemStack.Add(pItem); m_nCurUndoPos = m_UndoItemStack.GetSize(); m_bModified = (m_nCurUndoPos != 0); @@ -549,7 +549,7 @@ CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() /* ------------------------------------- CFX_Edit_UndoItem derived classes ------------------------------------- */ CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) + FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word), m_nCharset(charset), m_WordProps() { if (pWordProps) @@ -565,7 +565,7 @@ void CFXEU_InsertWord::Redo() if (m_pEdit) { m_pEdit->SelectNone(); - m_pEdit->SetCaret(m_wpOld); + m_pEdit->SetCaret(m_wpOld); m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); } } @@ -588,7 +588,7 @@ CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_SecProps(), - m_WordProps() + m_WordProps() { if (pSecProps) m_SecProps = *pSecProps; @@ -632,7 +632,7 @@ CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP m_Word(word), m_nCharset(charset), m_SecProps(SecProps), - m_WordProps(WordProps) + m_WordProps(WordProps) { } @@ -763,7 +763,7 @@ CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP m_Word(word), m_nCharset(charset), m_SecProps(SecProps), - m_WordProps(WordProps) + m_WordProps(WordProps) { } @@ -815,7 +815,7 @@ CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl m_swText(swText), m_nCharset(charset), m_SecProps(), - m_WordProps() + m_WordProps() { if (pSecProps) m_SecProps = *pSecProps; @@ -849,8 +849,8 @@ void CFXEU_InsertText::Undo() /* -------------------------------------------------------------------------- */ -CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, - const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, +CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, + const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range) : m_pEdit(pEdit), m_wpPlace(place), @@ -897,7 +897,7 @@ void CFXEU_SetSecProps::Undo() /* -------------------------------------------------------------------------- */ -CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, +CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range) : m_pEdit(pEdit), m_wpPlace(place), @@ -965,7 +965,7 @@ CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : m_bNotify(TRUE), m_bOprNotify(FALSE), m_pGroupUndoItem(NULL) -{ +{ ASSERT(pVT != NULL); } @@ -997,7 +997,7 @@ void CFX_Edit::Initialize() void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap) { - if (m_pVTProvide) + if (m_pVTProvide) delete m_pVTProvide; m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); @@ -1040,9 +1040,9 @@ IFX_Edit_FontMap* CFX_Edit::GetFontMap() } void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) -{ +{ m_pVT->SetPlateRect(rect); - m_ptScrollPos = CPDF_Point(rect.left,rect.top); + m_ptScrollPos = CPDF_Point(rect.left,rect.top); if (bPaint) Paint(); } @@ -1139,11 +1139,11 @@ void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) SelectAll(); } else if (nStartChar < 0) - { + { SelectNone(); } else - { + { if (nStartChar < nEndChar) { SetSel(m_pVT->WordIndexToWordPlace(nStartChar),m_pVT->WordIndexToWordPlace(nEndChar)); @@ -1152,7 +1152,7 @@ void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) { SetSel(m_pVT->WordIndexToWordPlace(nEndChar),m_pVT->WordIndexToWordPlace(nStartChar)); } - } + } } } @@ -1174,7 +1174,7 @@ void CFX_Edit::SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) SetCaretInfo(); } else - { + { ScrollToCaret(); SetCaretInfo(); } @@ -1234,7 +1234,7 @@ CFX_WideString CFX_Edit::GetText() const pIterator->SetAt(0); - CPVT_Word wordinfo; + CPVT_Word wordinfo; CPVT_WordPlace oldplace = pIterator->GetAt(); while (pIterator->NextWord()) { @@ -1249,7 +1249,7 @@ CFX_WideString CFX_Edit::GetText() const else { swRet += wordinfo.Word; - } + } } if (oldplace.SecCmp(place) != 0) @@ -1257,7 +1257,7 @@ CFX_WideString CFX_Edit::GetText() const swRet += 0x0D; swRet += 0x0A; } - + oldplace = place; } } @@ -1275,13 +1275,13 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const FX_BOOL bRich = m_pVT->IsRichText(); if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { CPVT_WordRange wrTemp = range; m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; + CPVT_Word wordinfo; CPVT_WordPlace oldplace = wrTemp.BeginPos; while (pIterator->NextWord()) { @@ -1297,7 +1297,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const else { swRet += wordinfo.Word; - } + } } if (oldplace.SecCmp(place) != 0) @@ -1305,7 +1305,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const swRet += 0x0D; swRet += 0x0A; } - + oldplace = place; } } @@ -1383,28 +1383,28 @@ FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) { CPVT_WordProps WordProps; WordProps.nFontIndex = nFontIndex; - return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); + return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) -{ +{ CPVT_WordProps WordProps; WordProps.fFontSize = fFontSize; - return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); + return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { CPVT_WordProps WordProps; WordProps.dwWordColor = dwColor; - return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); + return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) { CPVT_WordProps WordProps; WordProps.nScriptType = nScriptType; - return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); + return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) @@ -1443,21 +1443,21 @@ FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) { CPVT_WordProps WordProps; WordProps.fCharSpace = fCharSpace; - return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); + return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) { CPVT_WordProps WordProps; WordProps.nHorzScale = nHorzScale; - return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); + return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) { CPVT_SecProps SecProps; SecProps.fLineLeading = fLineLeading; - return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); + return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); } FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) @@ -1483,7 +1483,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); - + m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); @@ -1498,7 +1498,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS if (place.WordCmp(wrTemp.EndPos) > 0) break; bSet1 = SetSecProps(eProps,place,pSecProps,pWordProps,wrTemp,TRUE); bSet2 = SetWordProps(eProps,place,pWordProps,wrTemp,TRUE); - + if (!bSet) bSet = (bSet1 || bSet2); } @@ -1510,7 +1510,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS PaintSetProps(eProps,wrTemp); } } - } + } return bSet; } @@ -1526,8 +1526,8 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) ScrollToCaret(); Refresh(RP_ANALYSE); SetCaretOrigin(); - SetCaretInfo(); - break; + SetCaretInfo(); + break; case EP_WORDCOLOR: case EP_UNDERLINE: case EP_CROSSOUT: @@ -1535,7 +1535,7 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) break; case EP_FONTINDEX: case EP_FONTSIZE: - case EP_SCRIPTTYPE: + case EP_SCRIPTTYPE: case EP_CHARSPACE: case EP_HORZSCALE: case EP_BOLD: @@ -1548,13 +1548,13 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) Refresh(RP_ANALYSE,&wrRefresh); SetCaretOrigin(); - SetCaretInfo(); + SetCaretInfo(); break; - } + } } -FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, - const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, +FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, + const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) { if (m_pVT->IsValid() && m_pVT->IsRichText()) @@ -1578,10 +1578,10 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, switch(eProps) { - case EP_LINELEADING: + case EP_LINELEADING: if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLeading,pSecProps->fLineLeading)) { - secinfo.SecProps.fLineLeading = pSecProps->fLineLeading; + secinfo.SecProps.fLineLeading = pSecProps->fLineLeading; bSet = TRUE; } break; @@ -1616,7 +1616,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, switch(eProps) { - case EP_FONTINDEX: + case EP_FONTINDEX: if (secinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { secinfo.WordProps.nFontIndex = pWordProps->nFontIndex; @@ -1637,21 +1637,21 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, bSet = TRUE; } break; - case EP_SCRIPTTYPE: + case EP_SCRIPTTYPE: if (secinfo.WordProps.nScriptType != pWordProps->nScriptType) { secinfo.WordProps.nScriptType = pWordProps->nScriptType; bSet = TRUE; } break; - case EP_CHARSPACE: + case EP_CHARSPACE: if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpace,pWordProps->fCharSpace)) { secinfo.WordProps.fCharSpace = pWordProps->fCharSpace; bSet = TRUE; } break; - case EP_HORZSCALE: + case EP_HORZSCALE: if (secinfo.WordProps.nHorzScale != pWordProps->nHorzScale) { secinfo.WordProps.nHorzScale = pWordProps->nHorzScale; @@ -1663,7 +1663,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; bSet = TRUE; } } @@ -1681,7 +1681,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; bSet = TRUE; } } @@ -1699,7 +1699,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; bSet = TRUE; } } @@ -1717,7 +1717,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; bSet = TRUE; } } @@ -1753,11 +1753,11 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, return bSet; } } - + return FALSE; } -FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, +FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) { if (m_pVT->IsValid() && m_pVT->IsRichText()) @@ -1779,7 +1779,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place switch(eProps) { - case EP_FONTINDEX: + case EP_FONTINDEX: if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { if (IFX_Edit_FontMap* pFontMap = GetFontMap()) @@ -1847,7 +1847,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; bSet = TRUE; } } @@ -1865,7 +1865,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; bSet = TRUE; } } @@ -1883,7 +1883,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; bSet = TRUE; } } @@ -1900,7 +1900,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place break; } } - } + } if (bSet) { @@ -1912,7 +1912,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place (this,place,eProps,OldWordinfo.WordProps,wordinfo.WordProps,wr)); } } - + pIterator->SetAt(oldplace); return bSet; } @@ -2089,9 +2089,9 @@ void CFX_Edit::SelectAll() { if (m_pVT->IsValid()) { - m_SelState = GetWholeWordRange(); - SetCaret(m_SelState.EndPos); - + m_SelState = GetWholeWordRange(); + SetCaret(m_SelState.EndPos); + ScrollToCaret(); CPVT_WordRange wrVisible = GetVisibleWordRange(); Refresh(RP_OPTIONAL,&wrVisible); @@ -2109,7 +2109,7 @@ void CFX_Edit::SelectNone() m_SelState.Default(); Refresh(RP_OPTIONAL,&wrTemp); } - } + } } FX_BOOL CFX_Edit::IsSelected() const @@ -2136,7 +2136,7 @@ CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const fPadding = rcPlate.Height() - rcContent.Height(); break; } - + return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } @@ -2191,10 +2191,10 @@ void CFX_Edit::SetScrollInfo() if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; - m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, + m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, rcContent.left, rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); - - m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, + + m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPlate.Height()); m_bNotifyFlag = FALSE; } @@ -2209,7 +2209,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) { - m_ptScrollPos.x = fx; + m_ptScrollPos.x = fx; Refresh(RP_NOANALYSE); if (m_bNotify && m_pNotify) @@ -2232,7 +2232,7 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) if (m_pVT->IsValid()) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) - { + { m_ptScrollPos.y = fy; Refresh(RP_NOANALYSE); @@ -2277,7 +2277,7 @@ void CFX_Edit::SetScrollLimit() { if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.x, rcContent.left)) { - SetScrollPosX(rcContent.left); + SetScrollPosX(rcContent.left); } else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.x, rcContent.right - rcPlate.Width())) { @@ -2289,7 +2289,7 @@ void CFX_Edit::SetScrollLimit() { SetScrollPosY(rcPlate.top); } - else + else { if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.y, rcContent.bottom + rcPlate.Height())) { @@ -2326,7 +2326,7 @@ void CFX_Edit::ScrollToCaret() ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; @@ -2380,7 +2380,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const m_Refresh.BeginRefresh(); RefreshPushLineRects(GetVisibleWordRange()); -// if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || +// if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || // !FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.y,m_ptScrollPos.y)) // { m_Refresh.NoAnalyse(); @@ -2392,7 +2392,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const // { // case RP_ANALYSE: // m_Refresh.Analyse(m_pVT->GetAlignment()); -// +// // if (pRange1) RefreshPushRandomRects(*pRange1); // if (pRange2) RefreshPushRandomRects(*pRange2); // break; @@ -2402,9 +2402,9 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const // case RP_OPTIONAL: // if (pRange1) RefreshPushRandomRects(*pRange1); // if (pRange2) RefreshPushRandomRects(*pRange2); -// break; +// break; // } -// } +// } if (m_bNotify && m_pNotify) { @@ -2436,7 +2436,7 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) m_pVT->UpdateWordPlace(wpEnd); pIterator->SetAt(wpBegin); - CPVT_Line lineinfo; + CPVT_Line lineinfo; do { if (!pIterator->GetLine(lineinfo))break; @@ -2466,15 +2466,15 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; - CPVT_Line lineinfo; + CPVT_Word wordinfo; + CPVT_Line lineinfo; CPVT_WordPlace place; while (pIterator->NextWord()) { place = pIterator->GetAt(); if (place.WordCmp(wrTemp.EndPos) > 0) break; - + pIterator->GetWord(wordinfo); pIterator->GetLine(lineinfo); @@ -2488,7 +2488,7 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) m_Refresh.AddRefresh(VTToEdit(rcWord)); } else - { + { CPDF_Rect rcLine(lineinfo.ptLine.x, lineinfo.ptLine.y + lineinfo.fLineDescent, lineinfo.ptLine.x + lineinfo.fLineWidth, @@ -2513,15 +2513,15 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; - CPVT_Line lineinfo; + CPVT_Word wordinfo; + CPVT_Line lineinfo; CPVT_WordPlace place; while (pIterator->NextWord()) { place = pIterator->GetAt(); if (place.WordCmp(wrTemp.EndPos) > 0) break; - + pIterator->GetWord(wordinfo); pIterator->GetLine(lineinfo); @@ -2544,7 +2544,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) } } else - { + { CPDF_Rect rcLine(lineinfo.ptLine.x, lineinfo.ptLine.y + lineinfo.fLineDescent, lineinfo.ptLine.x + lineinfo.fLineWidth, @@ -2569,8 +2569,8 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) void CFX_Edit::SetCaret(const CPVT_WordPlace & place) { - m_wpOldCaret = m_wpCaret; - m_wpCaret = place; + m_wpOldCaret = m_wpCaret; + m_wpCaret = place; } void CFX_Edit::SetCaretInfo() @@ -2594,13 +2594,13 @@ void CFX_Edit::SetCaretInfo() ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; ptFoot.y = line.ptLine.y + line.fLineDescent; } - } + } m_bNotifyFlag = TRUE; m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(ptHead),VTToEdit(ptFoot), m_wpCaret); @@ -2631,27 +2631,27 @@ void CFX_Edit::SetCaretChange() SecProps = section.SecProps; WordProps = section.WordProps; } - + if (pIterator->GetWord(word)) - { - WordProps = word.WordProps; + { + WordProps = word.WordProps; } - } - + } + if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; m_pNotify->IOnCaretChange(SecProps,WordProps); m_bNotifyFlag = FALSE; } - } + } } void CFX_Edit::SetCaret(int32_t nPos) { if (m_pVT->IsValid()) { - SelectNone(); + SelectNone(); SetCaret(m_pVT->WordIndexToWordPlace(nPos)); m_SelState.Set(m_wpCaret,m_wpCaret); @@ -2665,7 +2665,7 @@ void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl { if (m_pVT->IsValid()) { - SelectNone(); + SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); m_SelState.Set(m_wpCaret,m_wpCaret); @@ -2683,7 +2683,7 @@ void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl if (m_wpCaret != m_wpOldCaret) { - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); @@ -2695,7 +2695,7 @@ void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl } void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) -{ +{ if (m_pVT->IsValid()) { SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); @@ -2717,9 +2717,9 @@ void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) } else { - SelectNone(); - - ScrollToCaret(); + SelectNone(); + + ScrollToCaret(); SetCaretInfo(); } } @@ -2750,7 +2750,7 @@ void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) { SelectNone(); - ScrollToCaret(); + ScrollToCaret(); SetCaretInfo(); } } @@ -2764,12 +2764,12 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) - SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else m_SelState.Set(m_wpOldCaret, m_wpCaret); @@ -2798,7 +2798,7 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) - SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); @@ -2823,12 +2823,12 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else - m_SelState.Set(m_wpOldCaret,m_wpCaret); + m_SelState.Set(m_wpOldCaret,m_wpCaret); if (m_wpOldCaret != m_wpCaret) - { + { ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); Refresh(RP_OPTIONAL,&wr); @@ -2854,7 +2854,7 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) - SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); ScrollToCaret(); SetCaretOrigin(); @@ -2876,7 +2876,7 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else m_SelState.Set(m_wpOldCaret,m_wpCaret); @@ -2903,8 +2903,8 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) if (bCtrl) SetCaret(m_pVT->GetBeginWordPlace()); else - SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); - + SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); + ScrollToCaret(); SetCaretOrigin(); SetCaretInfo(); @@ -2953,8 +2953,8 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetEndWordPlace()); else SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); - - ScrollToCaret(); + + ScrollToCaret(); SetCaretOrigin(); SetCaretInfo(); } @@ -3000,11 +3000,11 @@ FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps return TRUE; } } - + return FALSE; } -FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, +FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) { if (IsTextOverflow()) return FALSE; @@ -3027,9 +3027,9 @@ FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); - Refresh(RP_ANALYSE, &wr); + Refresh(RP_ANALYSE, &wr); SetCaretOrigin(); - SetCaretInfo(); + SetCaretInfo(); } if (m_bOprNotify && m_pOprNotify) @@ -3054,7 +3054,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo) { if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { pIterator->SetAt(m_wpCaret); pIterator->GetSection(section); pIterator->GetWord(word); @@ -3069,7 +3069,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (bAddUndo && m_bEnableUndo) { - if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) + if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) AddEditUndoItem(new CFXEU_Backspace(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,section.WordProps)); else @@ -3084,7 +3084,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) CPVT_WordRange wr; if (m_wpCaret.SecCmp(m_wpOldCaret) !=0) - wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVisibleWordRange().EndPos); + wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVisibleWordRange().EndPos); else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); else @@ -3118,7 +3118,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo) { if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); pIterator->GetSection(section); pIterator->GetWord(word); @@ -3133,14 +3133,14 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo && m_bEnableUndo) { - if (bSecEnd) + if (bSecEnd) AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,section.WordProps,bSecEnd)); else AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,word.WordProps,bSecEnd)); } - + if (bPaint) { RearrangePart(CPVT_WordRange(m_wpOldCaret,m_wpCaret)); @@ -3152,10 +3152,10 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); else - wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); + wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); Refresh(RP_ANALYSE, &wr); - + SetCaretOrigin(); SetCaretInfo(); } @@ -3200,14 +3200,14 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { pIterator->SetAt(range.EndPos); - CPVT_Word wordinfo; - CPVT_Section secinfo; + CPVT_Word wordinfo; + CPVT_Section secinfo; do - { + { CPVT_WordPlace place = pIterator->GetAt(); if (place.WordCmp(range.BeginPos) <= 0)break; - CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); + CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); if (oldplace.SecCmp(place) != 0) { @@ -3220,7 +3220,7 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) else { if (pIterator->GetWord(wordinfo)) - { + { oldplace = m_pVT->AjustLineHeader(oldplace,TRUE); place = m_pVT->AjustLineHeader(place,TRUE); @@ -3233,23 +3233,23 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) EndGroupUndo(); } else - { - AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); + { + AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); } } - SelectNone(); - SetCaret(m_pVT->DeleteWords(range)); + SelectNone(); + SetCaret(m_pVT->DeleteWords(range)); m_SelState.Set(m_wpCaret,m_wpCaret); if (bPaint) { - RearrangePart(range); + RearrangePart(range); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); Refresh(RP_ANALYSE, &wr); - + SetCaretOrigin(); SetCaretInfo(); } @@ -3297,12 +3297,12 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac { RearrangePart(CPVT_WordRange(wpOld,wpNew)); ScrollToCaret(); - + CPVT_WordRange wr; if (m_wpCaret.LineCmp(wpOld) !=0) - wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectionEndPlace(wpNew)); + wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectionEndPlace(wpNew)); else - wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); + wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); Refresh(RP_ANALYSE, &wr); SetCaretOrigin(); SetCaretInfo(); @@ -3352,12 +3352,12 @@ void CFX_Edit::SetCaretOrigin() m_ptCaret.y = word.ptWord.y; } else if (pIterator->GetLine(line)) - { + { m_ptCaret.x = line.ptLine.x; m_ptCaret.y = line.ptLine.y; } - } - } + } + } } int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const @@ -3510,7 +3510,7 @@ FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const return 0.0f; } -CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, +CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { CPVT_WordPlace wp = place; @@ -3529,7 +3529,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHA if (sText[i+1] == 0x0A) i++; break; - case 0x0A: + case 0x0A: wp = m_pVT->InsertSection(wp,pSecProps,pWordProps); if (sText[i+1] == 0x0D) i++; diff --git a/fpdfsdk/src/fxedit/fxet_module.cpp b/fpdfsdk/src/fxedit/fxet_module.cpp index 9ca7f2eb32..d1421641bc 100644 --- a/fpdfsdk/src/fxedit/fxet_module.cpp +++ b/fpdfsdk/src/fxedit/fxet_module.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/fxedit/fxet_stub.h" diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp index 6b597cabb9..1c0269b682 100644 --- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/src/fxedit/fxet_pageobjs.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/fxedit/fxet_stub.h" @@ -108,7 +108,7 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - CPVT_Word word; + CPVT_Word word; if (pIterator->GetWord(word)) { CFX_PathData pathUnderline; @@ -121,17 +121,17 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0, FXFILL_WINDING); } - } + } } } - + pDevice->RestoreState(); } -void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, +void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData) { - + FX_BOOL bContinuous = pEdit->GetCharArray() == 0; if (pEdit->GetCharSpace() > 0.0f) bContinuous = FALSE; @@ -175,7 +175,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { @@ -186,26 +186,26 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF { bSelect = place.WordCmp(wrSelect.BeginPos) > 0 && place.WordCmp(wrSelect.EndPos) <= 0; if (bSelect) - { - crCurFill = crWhite; + { + crCurFill = crWhite; } else { crCurFill = crTextFill; } } - if(pSystemHandler && pSystemHandler->IsSelectionImplemented()) + if(pSystemHandler && pSystemHandler->IsSelectionImplemented()) { crCurFill = crTextFill; crOldFill = crCurFill; } - CPVT_Word word; + CPVT_Word word; if (pIterator->GetWord(word)) { if (bSelect) { - + CPVT_Line line; pIterator->GetLine(line); @@ -219,22 +219,22 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF pSystemHandler->OutputSelectedRect(pFFLData,rc); } else - { + { CFX_PathData pathSelBK; pathSelBK.AppendRect(word.ptWord.x,line.ptLine.y + line.fLineDescent, word.ptWord.x+word.fWidth,line.ptLine.y + line.fLineAscent); - - pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); + + pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); } } if (bContinuous) { - if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || + if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); @@ -245,7 +245,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF crOldFill = crCurFill; } - sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord); + sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord); } else { @@ -260,17 +260,17 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IF } if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); - } + } } } - + pDevice->RestoreState(); } -void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, +void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange) { //FX_FLOAT fFontSize = pEdit->GetFontSize(); @@ -309,14 +309,14 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { word.WordProps.fFontSize = word.fFontSize; @@ -327,7 +327,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device { bSelect = place.WordCmp(wrSelect.BeginPos) > 0 && place.WordCmp(wrSelect.EndPos) <= 0; if (bSelect) - { + { crCurText = crWhite; } } @@ -343,15 +343,15 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device word.ptWord.x+word.fWidth + ptOffset.x, line.ptLine.y + line.fLineAscent + ptOffset.y); - pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); + pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); } - if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || - FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || + if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || + FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || crOld != crCurText) { if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); @@ -362,15 +362,15 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device crOld = crCurText; } - sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); - + sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); + if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { CFX_PathData pathUnderline; CPDF_Rect rcUnderline = GetUnderLineRect(word); pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, rcUnderline.right, rcUnderline.top); - pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); + pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); } if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) @@ -382,18 +382,18 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); } - oldplace = place; + oldplace = place; } } if (sTextBuf.GetLength() > 0) - { + { DrawTextString(pDevice, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); } } } - + pDevice->RestoreState(); } @@ -401,8 +401,8 @@ static void AddRectToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crFill { CPDF_PathObject* pPathObj = new CPDF_PathObject; CPDF_PathData* pPathData = pPathObj->m_Path.GetModify(); - pPathData->AppendRect(rcFill.left,rcFill.bottom,rcFill.right,rcFill.top); - + pPathData->AppendRect(rcFill.left,rcFill.bottom,rcFill.right,rcFill.top); + FX_FLOAT rgb[3]; rgb[0] = FXARGB_R(crFill) / 255.0f ; rgb[1] = FXARGB_G(crFill) / 255.0f; @@ -415,12 +415,12 @@ static void AddRectToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crFill pPageObjs->InsertObject(pPageObjs->GetLastObjectPosition(),pPathObj); } -static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crText, - CPDF_Font* pFont, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, int32_t nHorzScale, +static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_COLORREF crText, + CPDF_Font* pFont, FX_FLOAT fFontSize, FX_FLOAT fCharSpace, int32_t nHorzScale, const CPDF_Point& point, const CFX_ByteString& text) { CPDF_TextObject* pTxtObj = new CPDF_TextObject; - + CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetModify(); pTextStateData->m_pFont = pFont; pTextStateData->m_FontSize = fFontSize; @@ -440,7 +440,7 @@ static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjects* pPageObjs, FX_ pTxtObj->m_ColorState.SetStrokeColor(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB),rgb, 3); pTxtObj->SetPosition(point.x,point.y); - pTxtObj->SetText(text); + pTxtObj->SetText(text); pPageObjs->InsertObject(pPageObjs->GetLastObjectPosition(),pTxtObj); @@ -468,14 +468,14 @@ void IFX_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEd else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { if (place.LineCmp(oldplace) != 0 || nOldFontIndex != word.nFontIndex) @@ -493,12 +493,12 @@ void IFX_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEd } sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0); - oldplace = place; + oldplace = place; } } if (sTextBuf.GetLength() > 0) - { + { ObjArray.Add(AddTextObjToPageObjects(pPageObjects, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), sTextBuf.GetByteString())); } @@ -530,22 +530,22 @@ void IFX_Edit::GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { word.WordProps.fFontSize = word.fFontSize; crCurText = ArgbEncode(255,word.WordProps.dwWordColor); - if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || - FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || + if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || + FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || crOld != crCurText) { if (sTextBuf.GetLength() > 0) @@ -559,24 +559,24 @@ void IFX_Edit::GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* wp = word.WordProps; ptBT = word.ptWord; crOld = crCurText; - + } - sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); - + sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); + if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {/* - AddLineToPageObjects(pPageObjects, crCurText, + AddLineToPageObjects(pPageObjects, crCurText, CPDF_Point(word.ptWord.x, word.ptWord.y + word.fDescent * 0.4f), - CPDF_Point(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent * 0.4f)); + CPDF_Point(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent * 0.4f)); */ CPDF_Rect rcUnderline = GetUnderLineRect(word); rcUnderline.left += ptOffset.x; rcUnderline.right += ptOffset.x; rcUnderline.top += ptOffset.y; rcUnderline.bottom += ptOffset.y; - - AddRectToPageObjects(pPageObjects, crCurText, rcUnderline); + + AddRectToPageObjects(pPageObjects, crCurText, rcUnderline); } if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) @@ -587,15 +587,15 @@ void IFX_Edit::GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* rcCrossout.top += ptOffset.y; rcCrossout.bottom += ptOffset.y; - AddRectToPageObjects(pPageObjects, crCurText, rcCrossout); + AddRectToPageObjects(pPageObjects, crCurText, rcCrossout); } - oldplace = place; + oldplace = place; } } if (sTextBuf.GetLength() > 0) - { + { ObjArray.Add(AddTextObjToPageObjects(pPageObjects, crOld, pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, wp.fCharSpace, wp.nHorzScale, CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), sTextBuf.GetByteString())); } @@ -617,14 +617,14 @@ void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - - CPVT_Word word; + + CPVT_Word word; if (pIterator->GetWord(word)) { CPDF_Rect rcUnderline = GetUnderLineRect(word); 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<CJS_Document*>(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(); j<jsz; j++) { if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(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; i<nCount; i++) { if (CPDFSDK_Widget* pTempWidget = pInterForm->GetWidget(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<v8::Array> 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<v8::Object> pObj, CJS_GlobalVaria for (int i=0; i<nObjElements; i++) { - + CFX_WideString ws = JS_ToString(isolate, JS_GetArrayElement(isolate, pKeyList, i)); CFX_ByteString sKey = ws.UTF8Encode(); @@ -493,7 +493,7 @@ void global_alternate::DestroyGlobalPersisitentVariables() 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); delete pData; @@ -503,7 +503,7 @@ void global_alternate::DestroyGlobalPersisitentVariables() } -FX_BOOL global_alternate::SetGlobalVariables(const FX_CHAR* propname, int nType, +FX_BOOL global_alternate::SetGlobalVariables(const FX_CHAR* propname, int nType, double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent) { if (propname == NULL) return FALSE; @@ -549,7 +549,7 @@ FX_BOOL global_alternate::SetGlobalVariables(const FX_CHAR* propname, int nType, break; default: return FALSE; - } + } return TRUE; } @@ -599,7 +599,7 @@ FX_BOOL global_alternate::SetGlobalVariables(const FX_CHAR* propname, int nType, break; default: return FALSE; - } + } m_mapGlobal.SetAt(propname, (void*)pNewData); diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index 97bddec5c1..22e1c6dd99 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.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" @@ -152,7 +152,7 @@ FX_BOOL util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& iOffend = c_ConvChar.find(L"%",iOffset+1); std::wstring strSub; if (iOffend == -1) - strSub = c_ConvChar.substr(iOffset); + strSub = c_ConvChar.substr(iOffset); else strSub = c_ConvChar.substr(iOffset ,iOffend - iOffset); c_strConvers.push_back(strSub); @@ -235,7 +235,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& switch (nFormat) { case 0: - swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", + swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(), jsDate.GetMonth() + 1, jsDate.GetDay(), @@ -244,7 +244,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& jsDate.GetSeconds()); break; case 1: - swResult.Format(L"%04d.%02d.%02d %02d:%02d:%02d", + swResult.Format(L"%04d.%02d.%02d %02d:%02d:%02d", jsDate.GetYear(), jsDate.GetMonth() + 1, jsDate.GetDay(), @@ -253,7 +253,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& jsDate.GetSeconds()); break; case 2: - swResult.Format(L"%04d/%02d/%02d %02d:%02d:%02d", + swResult.Format(L"%04d/%02d/%02d %02d:%02d:%02d", jsDate.GetYear(), jsDate.GetMonth() + 1, jsDate.GetDay(), @@ -373,7 +373,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& void util::printd(const std::wstring &cFormat2, CJS_Date jsDate, bool bXFAPicture, std::wstring &cPurpose) { std::wstring cFormat = cFormat2; - + if (bXFAPicture) { return ; //currently, it doesn't support XFAPicture. @@ -588,8 +588,8 @@ FX_BOOL util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& { FX_BOOL bWrongFormat = FALSE; dDate = CJS_PublicMethods::MakeRegularDate(sDate,sFormat,bWrongFormat); - } - + } + if (!JS_PortIsNan(dDate)) { CJS_Date date(isolate,dDate); diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index 5ffbc9d86b..7adfc2696d 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -1,11 +1,11 @@ // 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 "../../../core/include/fxcrt/fx_basic.h" -#include "../../../core/include/fxcrt/fx_ext.h" +#include "../../../core/include/fxcrt/fx_ext.h" #include "../../include/jsapi/fxjs_v8.h" #include "../../include/fsdk_define.h" #include "time.h" @@ -309,7 +309,7 @@ void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Global<v8::Context>& v8Persi isolate->SetData(0,NULL); } -void JS_Initial() +void JS_Initial() { } void JS_Release() @@ -625,7 +625,7 @@ v8::Local<v8::Array> JS_NewArray(IJS_Runtime* pJSRuntime) } unsigned JS_PutArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index,v8::Local<v8::Value> pValue,FXJSVALUETYPE eType) -{ +{ if(pArray.IsEmpty()) return 0; if (pArray->Set(pJSRuntime->GetCurrentContext(), index, pValue).IsNothing()) return 0; return 1; @@ -802,7 +802,7 @@ int _getDaylightSavingTA(double d) } double _Mod(double x, double y) -{ +{ double r = fmod(x, y); if (r < 0) r += y; return r; @@ -912,29 +912,29 @@ int _DateFromTime(double t) int month = _MonthFromTime(t); switch (month) { - case 0: + case 0: return day+1; - case 1: + case 1: return day-30; - case 2: + case 2: return day-58-leap; - case 3: + case 3: return day-89-leap; - case 4: + case 4: return day-119-leap; - case 5: + case 5: return day-150-leap; - case 6: + case 6: return day-180-leap; - case 7: + case 7: return day-211-leap; - case 8: + case 8: return day-242-leap; - case 9: + case 9: return day-272-leap; - case 10: + case 10: return day-303-leap; - case 11: + case 11: return day-333-leap; default: return 0; @@ -991,7 +991,7 @@ double JS_DateParse(const wchar_t* string) v8::HandleScope scope(pIsolate); v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); - + //Use the built-in object method. v8::Local<v8::Value> v = context->Global()->Get(context, v8::String::NewFromUtf8(pIsolate, "Date", v8::NewStringType::kNormal).ToLocalChecked()).ToLocalChecked(); if(v->IsObject()) diff --git a/fpdfsdk/src/pdfwindow/PWL_Button.cpp b/fpdfsdk/src/pdfwindow/PWL_Button.cpp index f95469aa93..84962285c4 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Button.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/pdfwindow/PDFWindow.h" @@ -37,7 +37,7 @@ FX_BOOL CPWL_Button::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) m_bMouseDown = TRUE; SetCapture(); - + return TRUE; } diff --git a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp index e050f3400e..84a8b3d186 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Caret.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/pdfwindow/PDFWindow.h" @@ -48,7 +48,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse CFX_PathData path; path.SetPointCount(2); - + FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f; FX_FLOAT fCaretTop = rcRect.top; FX_FLOAT fCaretBottom = rcRect.bottom; @@ -84,7 +84,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset) { if (IsVisible() && m_bFlash) - { + { CFX_ByteTextBuf sCaret; CPDF_Rect rcRect = GetCaretRect(); @@ -96,14 +96,14 @@ void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptO sCaret << "q\n"; if (!rcClip.IsEmpty()) { - sCaret << rcClip.left << " " << rcClip.bottom + 2.5f << " " + sCaret << rcClip.left << " " << rcClip.bottom + 2.5f << " " << rcClip.right - rcClip.left << " " << rcClip.top - rcClip.bottom - 4.5f << " re W n\n"; } sCaret << m_fWidth << " w\n0 G\n"; sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.bottom << " m\n"; - sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.top << " l S\nQ\n"; + sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.top << " l S\nQ\n"; - sAppStream << sCaret; + sAppStream << sCaret; } } @@ -118,7 +118,7 @@ void CPWL_Caret::TimerProc() { if (m_nDelay > 0) { - m_nDelay--; + m_nDelay--; } else { @@ -138,10 +138,10 @@ CPDF_Rect CPWL_Caret::GetCaretRect() const void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot) { if (bVisible) - { + { if (IsVisible()) { - if (m_ptHead.x != ptHead.x || m_ptHead.y != ptHead.y || + if (m_ptHead.x != ptHead.x || m_ptHead.y != ptHead.y || m_ptFoot.x != ptFoot.x || m_ptFoot.y != ptFoot.y) { m_ptHead = ptHead; @@ -159,13 +159,13 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD EndTimer(); BeginTimer(PWL_CARET_FLASHINTERVAL); - + CPWL_Wnd::SetVisible(TRUE); m_bFlash = TRUE; - //Move(GetCaretRect(),FALSE,TRUE); + //Move(GetCaretRect(),FALSE,TRUE); Move(m_rcInvalid, FALSE, TRUE); - } + } } else { @@ -177,7 +177,7 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD { EndTimer(); CPWL_Wnd::SetVisible(FALSE); - } + } } } @@ -187,8 +187,8 @@ void CPWL_Caret::InvalidateRect(CPDF_Rect * pRect) { CPDF_Rect rcRefresh = CPWL_Utils::InflateRect(*pRect,0.5f); rcRefresh.top += 1; - rcRefresh.bottom -= 1; - + rcRefresh.bottom -= 1; + CPWL_Wnd::InvalidateRect(&rcRefresh); } else diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index bde5d2323f..bb2ef7510b 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.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/pdfwindow/PDFWindow.h" @@ -29,15 +29,15 @@ FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) if (m_bMouseDown) { ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = FALSE; if (ClientHitTest(point)) { if (CPWL_Wnd * pParent = GetParentWindow()) { - pParent->OnNotify(this,PNM_LBUTTONUP,0,PWL_MAKEDWORD(point.x,point.y)); + pParent->OnNotify(this,PNM_LBUTTONUP,0,PWL_MAKEDWORD(point.x,point.y)); } - + FX_BOOL bExit = FALSE; OnNotifySelChanged(FALSE,bExit, nFlag); if (bExit) return FALSE; @@ -61,7 +61,7 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWO case FWL_VKEY_Left: case FWL_VKEY_End: case FWL_VKEY_Right: - break; + break; } switch (nChar) @@ -114,12 +114,12 @@ FX_BOOL CPWL_CBListBox::OnCharWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { CPWL_Wnd::GetThisAppearanceStream(sAppStream); - + CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); - + if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_ByteTextBuf sButton; + CFX_ByteTextBuf sButton; CPDF_Point ptCenter = GetCenterPoint(); @@ -139,7 +139,7 @@ void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt1.x << " " << pt1.y << " l f\n"; sAppStream << "q\n" << sButton << "Q\n"; - } + } } } @@ -148,7 +148,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); - + if (IsVisible() && !rectWnd.IsEmpty()) { CPDF_Point ptCenter = GetCenterPoint(); @@ -170,8 +170,8 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,GetTransparency()), + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,GetTransparency()), 0, FXFILL_ALTERNATE); } } @@ -184,10 +184,10 @@ FX_BOOL CPWL_CBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) SetCapture(); if (CPWL_Wnd * pParent = GetParentWindow()) - { + { pParent->OnNotify(this,PNM_LBUTTONDOWN,0,PWL_MAKEDWORD(point.x,point.y)); } - + return TRUE; } @@ -334,11 +334,11 @@ void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM & cp) { if (!m_pButton) { - m_pButton = new CPWL_CBButton; + m_pButton = new CPWL_CBButton; PWL_CREATEPARAM bcp = cp; bcp.pParentWnd = this; - bcp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND; + bcp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND; bcp.sBackgroundColor = PWL_SCROLLBAR_BKCOLOR; bcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR; bcp.dwBorderWidth = 2; @@ -372,7 +372,7 @@ void CPWL_ComboBox::CreateListBox(const PWL_CREATEPARAM & cp) lcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR; if (cp.sBackgroundColor.nColorType == COLORTYPE_TRANSPARENT) - lcp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; + lcp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; m_pList->Create(lcp); } @@ -391,7 +391,7 @@ void CPWL_ComboBox::RePosChildWnd() FX_FLOAT fOldWindowHeight = m_rcOldWindow.Height(); FX_FLOAT fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2; - + switch (m_nPopupWhere) { case 0: @@ -399,7 +399,7 @@ void CPWL_ComboBox::RePosChildWnd() if (rcButton.left < rclient.left) rcButton.left = rclient.left; - + rcButton.bottom = rcButton.top - fOldClientHeight; rcEdit.right = rcButton.left - 1.0f; @@ -420,7 +420,7 @@ void CPWL_ComboBox::RePosChildWnd() if (rcButton.left < rclient.left) rcButton.left = rclient.left; - + rcButton.top = rcButton.bottom + fOldClientHeight; rcEdit.right = rcButton.left - 1.0f; @@ -436,7 +436,7 @@ void CPWL_ComboBox::RePosChildWnd() rcList.bottom += fOldWindowHeight; break; - } + } if (m_pButton) m_pButton->Move(rcButton,TRUE,FALSE); @@ -446,17 +446,17 @@ void CPWL_ComboBox::RePosChildWnd() if (m_pList) { - m_pList->SetVisible(TRUE); + m_pList->SetVisible(TRUE); m_pList->Move(rcList,TRUE,FALSE); m_pList->ScrollToListItem(m_nSelectItem); } } else - { + { CPDF_Rect rcButton = rcClient; - rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; - + rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; + if (rcButton.left < rcClient.left) rcButton.left = rcClient.left; @@ -526,7 +526,7 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) rcWindow.top += fPopupRet; break; } - + m_nPopupWhere = nWhere; Move(rcWindow, TRUE, TRUE); } @@ -555,7 +555,7 @@ FX_BOOL CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) { if (bExit) return FALSE; - SetSelectText(); + SetSelectText(); } } return TRUE; @@ -566,7 +566,7 @@ FX_BOOL CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) { if (bExit) return FALSE; - SetSelectText(); + SetSelectText(); } } return TRUE; @@ -588,7 +588,7 @@ FX_BOOL CPWL_ComboBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) { - return m_pEdit->OnChar(nChar,nFlag); + return m_pEdit->OnChar(nChar,nFlag); } else { @@ -616,7 +616,7 @@ void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp if (m_pEdit && m_pList) { if (pWnd == m_pList) - { + { SetSelectText(); SelectAll(); m_pEdit->SetFocus(); diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index 856adcf686..627e7a85d9 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.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 "../../../core/include/fxcrt/fx_safe_types.h" @@ -16,7 +16,7 @@ /* ---------------------------- CPWL_Edit ------------------------------ */ -CPWL_Edit::CPWL_Edit() : m_pFillerNotify(NULL), +CPWL_Edit::CPWL_Edit() : m_pFillerNotify(NULL), m_pSpellCheck(NULL), m_bFocus(FALSE) { @@ -42,9 +42,9 @@ void CPWL_Edit::SetText(const FX_WCHAR* csText) CFX_WideString swText = csText; if (HasFlag(PES_RICH)) - { + { CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); - + if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { int32_t nCount = pXML->CountChildren(); @@ -65,7 +65,7 @@ void CPWL_Edit::SetText(const FX_WCHAR* csText) { swSection += pSubElement->GetContent(j); } - + if (bFirst)bFirst = FALSE; else swText += FWL_VKEY_Return; @@ -76,7 +76,7 @@ void CPWL_Edit::SetText(const FX_WCHAR* csText) delete pXML; } - } + } m_pEdit->SetText(swText.c_str()); } @@ -101,7 +101,7 @@ void CPWL_Edit::RePosChildWnd() CPDF_Rect CPWL_Edit::GetClientRect() const { CPDF_Rect rcClient = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) { if (pVSB->IsVisible()) @@ -230,7 +230,7 @@ void CPWL_Edit::OnCreated() } void CPWL_Edit::SetParamByFlag() -{ +{ if (HasFlag(PES_RIGHT)) { m_pEdit->SetAlignmentH(2, FALSE); @@ -302,40 +302,40 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { case PBS_SOLID: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(),FALSE) << " 2 J 0 j\n"; + sLine << "q\n" << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(),FALSE) << " 2 J 0 j\n"; for (int32_t i=1;i<nCharArray;i++) { sLine << rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*i << " " << rcClient.bottom << " m\n" << rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*i << " " - << rcClient.top << " l S\n"; + << rcClient.top << " l S\n"; } - sLine << "Q\n"; + sLine << "Q\n"; } - break; + break; case PBS_DASH: { - sLine << "q\n" << GetBorderWidth() << " w\n" + sLine << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderColor(),FALSE) << " 2 J 0 j\n" - << "[" << GetBorderDash().nDash << " " - << GetBorderDash().nGap << "] " + << "[" << GetBorderDash().nDash << " " + << GetBorderDash().nGap << "] " << GetBorderDash().nPhase << " d\n"; - for (int32_t i=1;i<nCharArray;i++) + for (int32_t i=1;i<nCharArray;i++) { sLine << rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*i << " " << rcClient.bottom << " m\n" << rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*i << " " - << rcClient.top << " l S\n"; + << rcClient.top << " l S\n"; } sLine << "Q\n"; } break; - } + } } sAppStream << sLine; @@ -358,22 +358,22 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR) << sEditSel ; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible,wrSelBefore); - CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset, - &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); + CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset, + &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); if (sEditBefore.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditBefore << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible,wrSelect); - CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset, - &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); + CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset, + &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); if (sEditMid.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY,1)) << sEditMid << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible,wrSelAfter); - CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset, - &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); + CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset, + &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); if (sEditAfter.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditAfter<< "ET\n"; @@ -389,7 +389,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { CPDF_Rect rcClient = GetClientRect(); sAppStream << "q\n/Tx BMC\n"; - + if (!HasFlag(PES_TEXTOVERFLOW)) sAppStream << rcClient.left << " " << rcClient.bottom << " " << rcClient.right - rcClient.left << " " << rcClient.top - rcClient.bottom << " re W n\n"; @@ -432,10 +432,10 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser rcClient.top, FXPT_LINETO); } if (path.GetPointCount() > 0) - pDevice->DrawPath(&path, pUser2Device, &gsd,0, + pDevice->DrawPath(&path, pUser2Device, &gsd,0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(),255), FXFILL_ALTERNATE); } - break; + break; case PBS_DASH: { CFX_GraphStateData gsd; @@ -461,7 +461,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser CPWL_Utils::PWLColorToFXColor(GetBorderColor(),255), FXFILL_ALTERNATE); } break; - } + } } CPDF_Rect rcClip; @@ -495,7 +495,7 @@ FX_BOOL CPWL_Edit::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) if (m_bMouseDown) InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = TRUE; SetCapture(); m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); @@ -530,7 +530,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) if (m_bMouseDown) return FALSE; CPWL_Wnd::OnRButtonUp(point, nFlag); - + if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) return TRUE; IFX_SystemHandler* pSH = GetSystemHandler(); @@ -556,13 +556,13 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) CFX_ByteString sLatin = CFX_ByteString::FromUnicode(swLatin); if (!m_pSpellCheck->CheckWord(sLatin)) - { + { m_pSpellCheck->SuggestWords(sLatin,sSuggestWords); int32_t nSuggest = sSuggestWords.GetSize(); for (int32_t nWord=0; nWord<nSuggest; nWord++) - { + { pSH->AppendMenuItem(hPopup, WM_PWLEDIT_SUGGEST+nWord, sSuggestWords[nWord].UTF8Decode()); } @@ -579,7 +579,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) if (HasFlag(PES_UNDO)) { - pSH->AppendMenuItem(hPopup, WM_PWLEDIT_UNDO, + pSH->AppendMenuItem(hPopup, WM_PWLEDIT_UNDO, pProvider ? pProvider->LoadPopupMenuString(0) : L"&Undo"); pSH->AppendMenuItem(hPopup, WM_PWLEDIT_REDO, pProvider ? pProvider->LoadPopupMenuString(1) : L"&Redo"); @@ -591,13 +591,13 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) pSH->EnableMenuItem(hPopup, WM_PWLEDIT_REDO, FALSE); } - pSH->AppendMenuItem(hPopup, WM_PWLEDIT_CUT, + pSH->AppendMenuItem(hPopup, WM_PWLEDIT_CUT, pProvider ? pProvider->LoadPopupMenuString(2) : L"Cu&t"); - pSH->AppendMenuItem(hPopup, WM_PWLEDIT_COPY, + pSH->AppendMenuItem(hPopup, WM_PWLEDIT_COPY, pProvider ? pProvider->LoadPopupMenuString(3) : L"&Copy"); - pSH->AppendMenuItem(hPopup, WM_PWLEDIT_PASTE, + pSH->AppendMenuItem(hPopup, WM_PWLEDIT_PASTE, pProvider ? pProvider->LoadPopupMenuString(4) : L"&Paste"); - pSH->AppendMenuItem(hPopup, WM_PWLEDIT_DELETE, + pSH->AppendMenuItem(hPopup, WM_PWLEDIT_DELETE, pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete"); CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd()); @@ -615,7 +615,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) { pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE); pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE); - pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE); + pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE); } if (HasFlag(PES_PASSWORD)) @@ -717,10 +717,10 @@ void CPWL_Edit::OnSetFocus() void CPWL_Edit::OnKillFocus() { ShowVScrollBar(FALSE); - + m_pEdit->SelectNone(); SetCaret(FALSE, CPDF_Point(0.0f,0.0f), CPDF_Point(0.0f,0.0f)); - + SetCharSet(0); if (!IsReadOnly()) @@ -775,7 +775,7 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream(const CPDF_Point & ptOffset) c { CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit,ptOffset); - + if (sEdit.GetLength() > 0) { sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit << "ET\n"; @@ -838,7 +838,7 @@ void CPWL_Edit::SetCharArray(int32_t nCharArray) { if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { - m_pEdit->SetCharArray(nCharArray); + m_pEdit->SetCharArray(nCharArray); m_pEdit->SetTextOverflow(TRUE); if (HasFlag(PWS_AUTOFONTSIZE)) @@ -883,7 +883,7 @@ void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) pScroll->SetVisible(TRUE); CPDF_Rect rcWindow = GetWindowRect(); m_rcOldWindow = rcWindow; - rcWindow.right += PWL_SCROLLBAR_WIDTH; + rcWindow.right += PWL_SCROLLBAR_WIDTH; Move(rcWindow, TRUE, TRUE); } } @@ -893,7 +893,7 @@ void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { pScroll->SetVisible(FALSE); Move(m_rcOldWindow, TRUE, TRUE); - } + } } } } @@ -936,7 +936,7 @@ FX_BOOL CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), FWL_VKEY_Delete, strChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag); - if (!bRC) return FALSE; + if (!bRC) return FALSE; if (bExit) return FALSE; } } @@ -961,7 +961,7 @@ FX_BOOL CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) } /** -*In case of implementation swallow the OnKeyDown event. +*In case of implementation swallow the OnKeyDown event. *If the event is swallowed, implementation may do other unexpected things, which is not the control means to do. */ FX_BOOL CPWL_Edit::IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag) @@ -971,7 +971,7 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag) FX_BOOL bAlt = IsALTpressed(nFlag); if(bCtrl && !bAlt) { - //hot keys for edit control. + //hot keys for edit control. switch(nKeyCode) { case 'C': @@ -1033,7 +1033,7 @@ FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) swChange += nChar; break; } - + CFX_WideString strChangeEx; m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), nKeyCode, swChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag); } @@ -1225,10 +1225,10 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO if (IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator()) { - CPVT_Word wordinfo; - CPVT_WordPlace wpStart(place),wpEnd(place); - pIterator->SetAt(place); - + CPVT_Word wordinfo; + CPVT_WordPlace wpStart(place),wpEnd(place); + pIterator->SetAt(place); + if (bLatin) { while (pIterator->NextWord()) @@ -1238,7 +1238,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO wpEnd = pIterator->GetAt(); continue; } - else + else break; }; } @@ -1251,7 +1251,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO wpEnd = pIterator->GetAt(); continue; } - else + else break; }; } @@ -1263,7 +1263,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO do { if (pIterator->GetWord(wordinfo) && FX_EDIT_ISLATINWORD(wordinfo.Word)) - { + { continue; } else @@ -1279,7 +1279,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO do { if (pIterator->GetWord(wordinfo) && PWL_ISARABICWORD(wordinfo.Word)) - { + { continue; } else @@ -1292,7 +1292,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace & place, FX_BOO } range.Set(wpStart,wpEnd); - } + } return range; } @@ -1301,13 +1301,13 @@ void CPWL_Edit::AjustArabicWords(const CPVT_WordRange& wr) { } -void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, +void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) { IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); } -void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, +void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, const CPDF_Point& ptOffset) { CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp index f266da001c..71174dfb0a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_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/pdfwindow/PDFWindow.h" @@ -97,7 +97,7 @@ CFX_ByteString CPWL_Image::GetImageAlias() { if (m_pPDFStream) { - if (CPDF_Dictionary * pDict = m_pPDFStream->GetDict()) + if (CPDF_Dictionary * pDict = m_pPDFStream->GetDict()) { return pDict->GetString("Name"); } @@ -187,7 +187,7 @@ void CPWL_Icon::GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale) { fHScale = 1.0f; fVScale = 1.0f; - + if (m_pPDFStream) { FX_FLOAT fImageWidth,fImageHeight; diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 35af3ee91b..e1780c69a8 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.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/pdfwindow/PDFWindow.h" @@ -64,7 +64,7 @@ FX_FLOAT CPWL_Label::GetFontSize() const } void CPWL_Label::SetParamByFlag() -{ +{ if (HasFlag(PES_LEFT)) { m_pEdit->SetAlignmentH(0); @@ -158,7 +158,7 @@ CFX_ByteString CPWL_Label::GetTextAppearanceStream(const CPDF_Point & ptOffset) { CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit,ptOffset); - + if (sEdit.GetLength() > 0) { sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit << "ET\n"; diff --git a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp index 4864cabc11..76b2bd333a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Signature.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/pdfwindow/PDFWindow.h" @@ -42,7 +42,7 @@ void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Ma FX_FLOAT x, y; pUser2Device->Transform(rcClient.left, rcClient.top, x, y); - pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, + pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, (int32_t)rcClient.Width(), (int32_t)rcClient.Height()); } } @@ -61,12 +61,12 @@ void CPWL_Signature_Image::GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale) CPDF_Rect rcClient = GetClientRect(); fHScale = rcClient.Width() / fImageW; - fVScale = rcClient.Height() / fImageH; + fVScale = rcClient.Height() / fImageH; } /* --------------------------------- CPWL_Signature --------------------------------- */ -CPWL_Signature::CPWL_Signature() : +CPWL_Signature::CPWL_Signature() : m_pText(NULL), m_pDescription(NULL), m_pImage(NULL), @@ -136,7 +136,7 @@ void CPWL_Signature::RePosChildWnd() CPDF_Rect rcDescription = rcClient; FX_BOOL bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0; - + if ((bTextVisible || m_bImageExist) && m_pDescription->GetText().GetLength() > 0) { @@ -202,11 +202,11 @@ void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* path.SetPoint(1, rcClient.right, (rcClient.top + rcClient.bottom) * 0.5f, FXPT_LINETO); CFX_GraphStateData gsd; - gsd.SetDashCount(2); + gsd.SetDashCount(2); gsd.m_DashArray[0] = 6.0f; gsd.m_DashArray[1] = 6.0f; - gsd.m_DashPhase = 0; - + gsd.m_DashPhase = 0; + gsd.m_LineWidth = 10.0f; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0), FXFILL_ALTERNATE); */ diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp index 6eade26b50..90fa8f880d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.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/pdfwindow/PDFWindow.h" diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index b22846931f..b9ba7661af 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.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/pdfwindow/PDFWindow.h" @@ -145,45 +145,45 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect & crBBox) const int32_t num = 8; - CPWL_Point pts[num*3] = + CPWL_Point pts[num*3] = { //1 - CPWL_Point(0.28f, 0.52f), + CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f), CPWL_Point(0.29f, 0.40f), //2 - CPWL_Point(0.30f, 0.33f), + CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f), CPWL_Point(0.31f, 0.28f), //3 - CPWL_Point(0.39f, 0.28f), + CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f), CPWL_Point(0.77f, 0.67f), //4 - CPWL_Point(0.76f, 0.68f), + CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f), CPWL_Point(0.76f, 0.75f), //5 - CPWL_Point(0.76f, 0.75f), + CPWL_Point(0.76f, 0.75f), CPWL_Point(0.73f, 0.80f), CPWL_Point(0.68f, 0.75f), //6 - CPWL_Point(0.68f, 0.74f), + CPWL_Point(0.68f, 0.74f), CPWL_Point(0.68f, 0.74f), CPWL_Point(0.44f, 0.47f), //7 - CPWL_Point(0.43f, 0.47f), + CPWL_Point(0.43f, 0.47f), CPWL_Point(0.40f, 0.47f), CPWL_Point(0.41f, 0.58f), //8 - CPWL_Point(0.40f, 0.60f), + CPWL_Point(0.40f, 0.60f), CPWL_Point(0.28f, 0.66f), CPWL_Point(0.30f, 0.56f) }; @@ -211,7 +211,7 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect & crBBox) FX_FLOAT px2 = pts[n2].x - pts[nNext].x; FX_FLOAT py2 = pts[n2].y - pts[nNext].y; - csAP << pts[nCur].x + px1 * PWL_BEZIER << " " << pts[nCur].y + py1 * PWL_BEZIER << " " + csAP << pts[nCur].x + px1 * PWL_BEZIER << " " << pts[nCur].y + py1 * PWL_BEZIER << " " << pts[nNext].x + px2 * PWL_BEZIER << " " << pts[nNext].y + py2 * PWL_BEZIER << " " << pts[nNext].x << " " << pts[nNext].y << " c\n"; } @@ -236,28 +236,28 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CPDF_Rect & crBBox) FX_FLOAT px = pt2.x - pt1.x; FX_FLOAT py = pt2.y - pt1.y; - csAP << pt1.x << " " << pt1.y + py * PWL_BEZIER << " " + csAP << pt1.x << " " << pt1.y + py * PWL_BEZIER << " " << pt2.x - px * PWL_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y << " c\n"; px = pt3.x - pt2.x; py = pt2.y - pt3.y; - csAP << pt2.x + px * PWL_BEZIER << " " << pt2.y << " " + csAP << pt2.x + px * PWL_BEZIER << " " << pt2.y << " " << pt3.x << " " << pt3.y + py * PWL_BEZIER << " " << pt3.x << " " << pt3.y << " c\n"; px = pt3.x - pt4.x; py = pt3.y - pt4.y; - csAP << pt3.x << " " << pt3.y - py * PWL_BEZIER << " " + csAP << pt3.x << " " << pt3.y - py * PWL_BEZIER << " " << pt4.x + px * PWL_BEZIER << " " << pt4.y << " " << pt4.x << " " << pt4.y << " c\n"; px = pt4.x - pt1.x; py = pt1.y - pt4.y; - csAP << pt4.x - px * PWL_BEZIER << " " << pt4.y << " " + csAP << pt4.x - px * PWL_BEZIER << " " << pt4.y << " " << pt1.x << " " << pt1.y - py * PWL_BEZIER << " " << pt1.x << " " << pt1.y << " c\n"; @@ -287,7 +287,7 @@ CFX_ByteString CPWL_Utils::GetAP_Diamond(const CPDF_Rect & crBBox) CPDF_Point pt2(crBBox.left + fWidth / 2,crBBox.top); CPDF_Point pt3(crBBox.right,crBBox.bottom + fHeight / 2); CPDF_Point pt4(crBBox.left + fWidth / 2,crBBox.bottom); - + csAP << pt1.x << " " << pt1.y << " m\n"; csAP << pt2.x << " " << pt2.y << " l\n"; csAP << pt3.x << " " << pt3.y << " l\n"; @@ -316,7 +316,7 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CPDF_Rect & crBBox) FX_FLOAT fRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL_PI/5.0f)); CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(crBBox.top + crBBox.bottom) / 2.0f); - + FX_FLOAT px[5],py[5]; FX_FLOAT fAngel = PWL_PI/10.0f; @@ -355,7 +355,7 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fR FX_FLOAT px,py; - csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " " << cos(fRotate) << " " + csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " " << cos(fRotate) << " " << crBBox.left + fWidth / 2 << " " << crBBox.bottom + fHeight / 2 << " cm\n"; @@ -364,14 +364,14 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fR px = pt2.x - pt1.x; py = pt2.y - pt1.y; - csAP << pt1.x << " " << pt1.y + py * PWL_BEZIER << " " + csAP << pt1.x << " " << pt1.y + py * PWL_BEZIER << " " << pt2.x - px * PWL_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y << " c\n"; px = pt3.x - pt2.x; py = pt2.y - pt3.y; - csAP << pt2.x + px * PWL_BEZIER << " " << pt2.y << " " + csAP << pt2.x + px * PWL_BEZIER << " " << pt2.y << " " << pt3.x << " " << pt3.y + py * PWL_BEZIER << " " << pt3.x << " " << pt3.y << " c\n"; @@ -425,9 +425,9 @@ CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CPDF_Rect & rect,const CPW { sAppStream << "q\n" << sColor; sAppStream << rect.left << " " << rect.bottom << " " - << rect.right - rect.left << " " << rect.top - rect.bottom << " re f\nQ\n"; + << rect.right - rect.left << " " << rect.top - rect.bottom << " re f\nQ\n"; } - + return sAppStream.GetByteString(); } @@ -438,9 +438,9 @@ CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CPDF_Rect & rect,const C CFX_ByteString sColor = GetColorAppStream(color,TRUE); if (sColor.GetLength() > 0) { - sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; + sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; } - + return sAppStream.GetByteString(); } @@ -457,13 +457,13 @@ CPDF_Rect CPWL_Utils::GetCenterSquare(const CPDF_Rect & rect) return CPDF_Rect(fCenterX - fRadius,fCenterY - fRadius,fCenterX + fRadius,fCenterY + fRadius); } -CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange, +CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange, FX_BOOL bContinuous, FX_WORD SubWord) { return IFX_Edit::GetEditAppearanceStream(pEdit,ptOffset,pRange,bContinuous,SubWord); } -CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, +CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange) { return IFX_Edit::GetSelectAppearanceStream(pEdit,ptOffset,pRange); @@ -496,7 +496,7 @@ static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIter FX_FLOAT fStartX = 0.0f; FX_FLOAT fEndX = 0.0f; FX_FLOAT fY = 0.0f; - FX_FLOAT fStep = 0.0f; + FX_FLOAT fStep = 0.0f; FX_BOOL bBreak = FALSE; @@ -508,7 +508,7 @@ static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIter { CPVT_WordPlace place = pIterator->GetAt(); - CPVT_Line line; + CPVT_Line line; if (pIterator->GetLine(line)) { fY = line.ptLine.y; @@ -577,7 +577,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place.WordCmp(pRange->EndPos) > 0) break; + if (pRange && place.WordCmp(pRange->EndPos) > 0) break; CPVT_Word word; if (pIterator->GetWord(word)) @@ -587,7 +587,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellChe if (!bLatinWord) { wpWordStart = place; - bLatinWord = TRUE; + bLatinWord = TRUE; } sWord += (char)word.Word; @@ -671,12 +671,12 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, IFX_Edit_FontMap * pFontMap, CPDF_Stream * pIconStream, CPDF_IconFit & IconFit, - const CFX_WideString & sLabel, + const CFX_WideString & sLabel, const CPWL_Color & crText, FX_FLOAT fFontSize, int32_t nLayOut) { - const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; + const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) { @@ -731,14 +731,14 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, fHeight = rcLabelContent.Height(); if (rcBBox.bottom + fHeight > rcBBox.top) - { - rcIcon = CPDF_Rect(0,0,0,0); + { + rcIcon = CPDF_Rect(0,0,0,0); rcLabel = rcBBox; } else { rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcBBox.bottom + fHeight); - rcIcon = CPDF_Rect(rcBBox.left,rcLabel.top,rcBBox.right,rcBBox.top); + rcIcon = CPDF_Rect(rcBBox.left,rcLabel.top,rcBBox.right,rcBBox.top); } } } @@ -764,14 +764,14 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, fHeight = rcLabelContent.Height(); if (rcBBox.bottom + fHeight > rcBBox.top) - { - rcIcon = CPDF_Rect(0,0,0,0); + { + rcIcon = CPDF_Rect(0,0,0,0); rcLabel = rcBBox; } else { rcLabel = CPDF_Rect(rcBBox.left,rcBBox.top - fHeight,rcBBox.right,rcBBox.top); - rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcLabel.bottom); + rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcLabel.bottom); } } } @@ -793,9 +793,9 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcLabel.left,rcBBox.top); if (rcLabelContent.Width() < fWidth * fAutoFontScale) - { + { } - else + else { if (rcLabelContent.Width() < fWidth) { @@ -821,7 +821,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, else { rcLabel = CPDF_Rect(rcBBox.right - fWidth,rcBBox.bottom,rcBBox.right,rcBBox.top); - rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcLabel.left,rcBBox.top); + rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcLabel.left,rcBBox.top); } } } @@ -843,9 +843,9 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, rcIcon = CPDF_Rect(rcLabel.right,rcBBox.bottom,rcBBox.right,rcBBox.top); if (rcLabelContent.Width() < fWidth * fAutoFontScale) - { + { } - else + else { if (rcLabelContent.Width() < fWidth) { @@ -871,8 +871,8 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, else { rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.left + fWidth,rcBBox.top); - rcIcon = CPDF_Rect(rcLabel.right,rcBBox.bottom,rcBBox.right,rcBBox.top); - } + rcIcon = CPDF_Rect(rcLabel.right,rcBBox.bottom,rcBBox.right,rcBBox.top); + } } } else @@ -928,16 +928,16 @@ CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color & color,const FX_B CFX_ByteTextBuf sColorStream; switch (color.nColorType) - { + { case COLORTYPE_RGB: - sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " + sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " << (bFillOrStroke ? "rg" : "RG") << "\n"; break; case COLORTYPE_GRAY: sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n"; break; case COLORTYPE_CMYK: - sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " << color.fColor4 << " " + sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " << color.fColor4 << " " << (bFillOrStroke ? "k" : "K") << "\n"; break; } @@ -972,7 +972,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f { sAppStream << sColor; sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " << fTop - fBottom << " re\n"; - sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " + sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " << fRight - fLeft - fWidth * 2 << " " << fTop - fBottom - fWidth * 2 << " re\n"; sAppStream << "f*\n"; } @@ -1021,8 +1021,8 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f { sAppStream << sColor; sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " << fTop - fBottom << " re\n"; - sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " - << fRight - fLeft - fHalfWidth * 2 << " " << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; + sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " + << fRight - fLeft - fHalfWidth * 2 << " " << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; } break; case PBS_UNDERLINED: @@ -1036,7 +1036,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f } break; } - + sAppStream << "Q\n"; } @@ -1050,7 +1050,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F CFX_ByteTextBuf sAppStream; CFX_ByteString sColor; - + @@ -1068,7 +1068,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sColor = CPWL_Utils::GetColorAppStream(color,FALSE); if (sColor.GetLength() > 0) { - sAppStream << "q\n" << fWidth << " w\n" << sColor + sAppStream << "q\n" << fWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle(CPWL_Utils::DeflateRect(rect,fWidth / 2.0f)) << " S\nQ\n"; } @@ -1079,11 +1079,11 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sColor = CPWL_Utils::GetColorAppStream(color,FALSE); if (sColor.GetLength() > 0) { - sAppStream << "q\n" << fWidth << " w\n" - << "[" << dash.nDash << " " << dash.nGap << "] " << dash.nPhase << " d\n" + sAppStream << "q\n" << fWidth << " w\n" + << "[" << dash.nDash << " " << dash.nGap << "] " << dash.nPhase << " d\n" << sColor << CPWL_Utils::GetAP_Circle(CPWL_Utils::DeflateRect(rect,fWidth / 2.0f)) << " S\nQ\n"; - } + } } break; case PBS_BEVELED: @@ -1096,7 +1096,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; - } + } sColor = CPWL_Utils::GetColorAppStream(crLeftTop,FALSE); if (sColor.GetLength() > 0) @@ -1104,7 +1104,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f) << " S\nQ\n"; - } + } sColor = CPWL_Utils::GetColorAppStream(crRightBottom,FALSE); if (sColor.GetLength() > 0) @@ -1112,7 +1112,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f) << " S\nQ\n"; - } + } } break; case PBS_INSET: @@ -1133,7 +1133,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f) << " S\nQ\n"; - } + } sColor = CPWL_Utils::GetColorAppStream(crRightBottom,FALSE); if (sColor.GetLength() > 0) @@ -1141,11 +1141,11 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f) << " S\nQ\n"; - } + } } break; } - + sAppStream << "Q\n"; } @@ -1173,7 +1173,7 @@ CPWL_Color CPWL_Utils::SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorS sRet.fColor3 = PWL_MAX(sColor.fColor3 - fColorSub,0.0f); sRet.fColor4 = PWL_MAX(sColor.fColor4 - fColorSub,0.0f); break; - } + } return sRet; } @@ -1200,7 +1200,7 @@ CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevi sRet.fColor3 /= fColorDevide; sRet.fColor4 /= fColorDevide; break; - } + } return sRet; } @@ -1262,7 +1262,7 @@ CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect & rcBBox, case PCS_CROSS: return GetAppStream_Cross(rcCenter,crText); case PCS_DIAMOND: - return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText); + return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText); case PCS_SQUARE: return GetAppStream_Square(ScaleRect(rcCenter,2.0f/3.0f),crText); case PCS_STAR: @@ -1285,7 +1285,7 @@ CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CPDF_Rect & rcBBox, case PCS_CROSS: return GetAppStream_Cross(rcCenter,crText); case PCS_DIAMOND: - return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText); + return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText); case PCS_SQUARE: return GetAppStream_Square(ScaleRect(rcCenter,2.0f/3.0f),crText); case PCS_STAR: @@ -1300,12 +1300,12 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CPDF_Rect & rcBBox) if (!rcBBox.IsEmpty()) { sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f),TRUE); - sAppStream << rcBBox.left << " " << rcBBox.bottom << " " + sAppStream << rcBBox.left << " " << rcBBox.bottom << " " << rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom << " re f\n"; sAppStream << "Q\n"; - sAppStream << "q\n" << - CPWL_Utils::GetBorderAppStream(rcBBox,2,CPWL_Color(COLORTYPE_GRAY,0),CPWL_Color(COLORTYPE_GRAY,1),CPWL_Color(COLORTYPE_GRAY,0.5),PBS_BEVELED,CPWL_Dash(3,0,0)) + sAppStream << "q\n" << + CPWL_Utils::GetBorderAppStream(rcBBox,2,CPWL_Color(COLORTYPE_GRAY,0),CPWL_Color(COLORTYPE_GRAY,1),CPWL_Color(COLORTYPE_GRAY,0.5),PBS_BEVELED,CPWL_Dash(3,0,0)) << "Q\n"; CPDF_Point ptCenter = CPDF_Point((rcBBox.left + rcBBox.right)/2,(rcBBox.top + rcBBox.bottom)/2); @@ -1422,7 +1422,7 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi const FX_COLORREF & color) { CFX_PathData path; - CPDF_Rect rcTemp(rect); + CPDF_Rect rcTemp(rect); path.AppendRect(rcTemp.left,rcTemp.bottom,rcTemp.right,rcTemp.top); pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING); } @@ -1444,9 +1444,9 @@ void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2De const FX_COLORREF & color, FX_FLOAT fWidth) { CFX_PathData path; - CPDF_Rect rcTemp(rect); + CPDF_Rect rcTemp(rect); path.AppendRect(rcTemp.left,rcTemp.bottom,rcTemp.right,rcTemp.top); - + CFX_GraphStateData gsd; gsd.m_LineWidth = fWidth; @@ -1484,7 +1484,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device fStepGray = (nEndGray - nStartGray) / rect.Height(); for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f) - { + { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy-rect.bottom)); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_Point(rect.left, fy), CPDF_Point(rect.right, fy), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); @@ -1496,7 +1496,7 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device fStepGray = (nEndGray - nStartGray) / rect.Width(); for (FX_FLOAT fx=rect.left+0.5f; fx<=rect.right-0.5f; fx+=1.0f) - { + { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx-rect.left)); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_Point(fx, rect.bottom), CPDF_Point(fx, rect.top), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); @@ -1541,17 +1541,17 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device path.SetPoint(4, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, FXPT_LINETO); CFX_GraphStateData gsd; - gsd.SetDashCount(2); + gsd.SetDashCount(2); gsd.m_DashArray[0] = 3.0f; gsd.m_DashArray[1] = 3.0f; - gsd.m_DashPhase = 0; - + gsd.m_DashPhase = 0; + gsd.m_LineWidth = fWidth; - pDevice->DrawPath(&path, pUser2Device, &gsd, 0, PWLColorToFXColor(color,nTransparancy), FXFILL_WINDING); - } + pDevice->DrawPath(&path, pUser2Device, &gsd, 0, PWLColorToFXColor(color,nTransparancy), FXFILL_WINDING); + } break; case PBS_BEVELED: - case PBS_INSET: + case PBS_INSET: { CFX_GraphStateData gsd; gsd.m_LineWidth = fHalfWidth; @@ -1597,7 +1597,7 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device path.SetPointCount(2); path.SetPoint(0, fLeft, fBottom + fWidth / 2, FXPT_MOVETO); path.SetPoint(1, fRight, fBottom + fWidth / 2, FXPT_LINETO); - + CFX_GraphStateData gsd; gsd.m_LineWidth = fWidth; @@ -1636,7 +1636,7 @@ static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV FX_FLOAT fStartX = 0.0f; FX_FLOAT fEndX = 0.0f; FX_FLOAT fY = 0.0f; - FX_FLOAT fStep = 0.0f; + FX_FLOAT fStep = 0.0f; FX_BOOL bBreak = FALSE; @@ -1648,7 +1648,7 @@ static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV { CPVT_WordPlace place = pIterator->GetAt(); - CPVT_Line line; + CPVT_Line line; if (pIterator->GetLine(line)) { fY = line.ptLine.y; @@ -1693,8 +1693,8 @@ static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV } } -void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, - const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, +void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, + const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IPWL_SpellCheck * pSpellCheck) { const FX_COLORREF crSpell = ArgbEncode(255,255,0,0); @@ -1729,14 +1729,14 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse else pIterator->SetAt(0); - CPVT_WordPlace oldplace; + CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); - if (pRange && place.WordCmp(pRange->EndPos) > 0) break; + if (pRange && place.WordCmp(pRange->EndPos) > 0) break; - CPVT_Word word; + CPVT_Word word; if (pIterator->GetWord(word)) { if (FX_EDIT_ISLATINWORD(word.Word)) @@ -1744,7 +1744,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse if (!bLatinWord) { wpWordStart = place; - bLatinWord = TRUE; + bLatinWord = TRUE; } sLatinWord += (char)word.Word; @@ -1757,7 +1757,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse { if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord)) { - AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); + AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); pIterator->SetAt(place); } } @@ -1766,7 +1766,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse sLatinWord.Empty(); } - + oldplace = place; } else @@ -1777,7 +1777,7 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse { if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord)) { - AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); + AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); pIterator->SetAt(place); } } @@ -1788,16 +1788,16 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse } } - if (!sLatinWord.IsEmpty()) + if (!sLatinWord.IsEmpty()) { if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord)) { - AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); + AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); } } } } - + CFX_GraphStateData gsd; gsd.m_LineWidth = 0; if (pathSpell.GetPointCount() > 0) @@ -1848,7 +1848,7 @@ CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) return crRet; } -CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill, +CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill, const CPWL_Color& crStroke) { CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE); @@ -1860,7 +1860,7 @@ CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect switch (nType) { case PWL_ICONTYPE_CHECKMARK: - GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); + GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); break; case PWL_ICONTYPE_CIRCLE: GetGraphics_Circle(sPath, path, rect, PWLPT_STREAM); @@ -2005,7 +2005,7 @@ void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser return; } - pDevice->DrawPath(&path, pUser2Device, &gsd, + pDevice->DrawPath(&path, pUser2Device, &gsd, PWLColorToFXColor(crFill,nTransparancy), PWLColorToFXColor(crStroke,nTransparancy), FXFILL_ALTERNATE); } @@ -2014,10 +2014,10 @@ void CPWL_Utils::GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, crBBox.bottom + fHeight * 2 / 5.0f),PWLPT_MOVETO), - CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f + PWL_BEZIER*(fWidth / 7.0f - fWidth / 15.0f), + CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f + PWL_BEZIER*(fWidth / 7.0f - fWidth / 15.0f), crBBox.bottom + fHeight * 2 / 5.0f + PWL_BEZIER*(fHeight * 2 / 7.0f - fHeight * 2 / 5.0f)), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 4.5f + PWL_BEZIER*(fWidth / 5.0f - fWidth / 4.5f), crBBox.bottom + fHeight / 16.0f + PWL_BEZIER*(fHeight / 5.0f - fHeight / 16.0f)), PWLPT_BEZIERTO), @@ -2097,7 +2097,7 @@ void CPWL_Utils::GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& pa FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.top - fHeight/6.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.top - fHeight/6.0f + PWL_BEZIER*(fHeight/6.0f - fHeight/10.0f)), PWLPT_BEZIERTO), @@ -2144,7 +2144,7 @@ void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path //FX_FLOAT fcatercorner = (FX_FLOAT)sqrt(fWidth*fWidth + fHeight*fHeight); CPWL_Point center_point(crBBox.left + fWidth/2, crBBox.bottom + fHeight/2); - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(center_point.x, center_point.y + fHeight/10.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(center_point.x + fWidth*0.3f, center_point.y + fHeight/10.0f + fWidth*0.3f), PWLPT_LINETO), @@ -2172,7 +2172,7 @@ void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight/60.0f - fHeight/2.0f)), PWLPT_BEZIERTO), @@ -2183,14 +2183,14 @@ void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, CPWL_PathData(CPWL_Point(crBBox.right - fWidth/60.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth/60.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*fHeight*29/60.0f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*fWidth*29/60.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO), - CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO), + CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*fWidth*29/60.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*fHeight*29/60.0f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.23f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f - PWL_BEZIER*fWidth*0.23f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO), - CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO), + CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f + PWL_BEZIER*fWidth*0.23f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.27f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.23f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO), @@ -2216,14 +2216,14 @@ void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.77f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f - PWL_BEZIER*fWidth*0.13f, crBBox.bottom + fHeight*0.77f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.13f), PWLPT_BEZIERTO), - CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO), + CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f - fWidth*0.1f*0.6f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f - fWidth*0.1f*0.6f), PWLPT_BEZIERTO), - CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO), + CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.56f, crBBox.bottom + fHeight*0.13f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.56f, crBBox.bottom + fHeight*0.13f + PWL_BEZIER*fHeight*0.055f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f - PWL_BEZIER*fWidth*0.095f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO), - CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO), + CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f + PWL_BEZIER*fWidth*0.065f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.44f, crBBox.bottom + fHeight*0.13f + PWL_BEZIER*fHeight*0.055f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.44f, crBBox.bottom + fHeight*0.13f), PWLPT_BEZIERTO), @@ -2246,7 +2246,7 @@ void CPWL_Utils::GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10, crBBox.bottom + fHeight/10), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2, crBBox.top - fHeight*2/15), PWLPT_LINETO), @@ -2272,7 +2272,7 @@ void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, CicleCenter.x = crBBox.left + fWidth*0.15f; CicleCenter.y = k*(CicleCenter.x - crBBox.right) + crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(tail.x + fWidth/30.0f, -fWidth/30.0f/k + tail.y), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(tail.x + fWidth/30.0f - fWidth*0.18f, -k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO), @@ -2302,7 +2302,7 @@ void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, CPWL_PathData(CPWL_Point(tail.x - fWidth/30 - fWidth*0.45f - fWidth*0.18f, fWidth*0.05f/k - k*fWidth*0.45f + fWidth/30/k + tail.y - fHeight*0.05f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(tail.x - fWidth/30.0f - fWidth*0.45f, -k*fWidth*0.45f + fWidth/30.0f/k + tail.y), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(tail.x - fWidth/30.0f, fWidth/30.0f/k + tail.y), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(tail.x + fWidth/30, -fWidth/30/k + tail.y), PWLPT_LINETO), + CPWL_PathData(CPWL_Point(tail.x + fWidth/30, -fWidth/30/k + tail.y), PWLPT_LINETO), CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.08f, k*fWidth*0.08f + CicleCenter.y), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.08f + fWidth*0.1f, -fWidth*0.1f/k + k*fWidth*0.08f + CicleCenter.y), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.22f + fWidth*0.1f, k*fWidth*0.22f + CicleCenter.y - fWidth*0.1f/k), PWLPT_BEZIERTO), @@ -2323,7 +2323,7 @@ void CPWL_Utils::GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathDat FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/20.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10.0f, crBBox.top - fHeight/2.0f), PWLPT_LINETO), @@ -2366,7 +2366,7 @@ void CPWL_Utils::GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& p FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/10.0f, crBBox.bottom + fHeight/15.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*7/10.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO), @@ -2425,7 +2425,7 @@ void CPWL_Utils::GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.top - fHeight/2.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + fWidth/8.0f, crBBox.bottom + fHeight/5.0f), PWLPT_LINETO), @@ -2450,7 +2450,7 @@ void CPWL_Utils::GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathDat FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30.0f, crBBox.top - fHeight/2.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/30.0f, crBBox.bottom + fHeight/6.0f), PWLPT_LINETO), @@ -2471,7 +2471,7 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, fLongRadius = fLongRadius * 0.7f; FX_FLOAT fShortRadius = fLongRadius * 0.55f; CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(crBBox.top + crBBox.bottom) / 2.0f); - + FX_FLOAT px1[5], py1[5]; FX_FLOAT px2[5], py2[5]; @@ -2518,7 +2518,7 @@ void CPWL_Utils::GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& pa FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/15.0f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.top - fWidth*3/5.0f), PWLPT_LINETO), @@ -2547,7 +2547,7 @@ void CPWL_Utils::GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData tail.x = crBBox.left + fWidth*4/5.0f; tail.y = k*(tail.x - crBBox.right) + rightdown.y; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/20.0f, k*(crBBox.left + fWidth/20.0f - rightdown.x) + rightdown.y), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(fHeight*17/60.0f/k + tail.x + fWidth/10.0f + fWidth/5.0f, @@ -2573,7 +2573,7 @@ void CPWL_Utils::GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.05f, crBBox.top - fWidth*0.15f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.25f, crBBox.top - fHeight*0.15f), PWLPT_LINETO), @@ -2611,7 +2611,7 @@ void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.top - fHeight*0.25f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.bottom + fHeight*0.25f), PWLPT_LINETO), @@ -2623,7 +2623,7 @@ void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30, crBBox.top - fHeight*0.33f + fHeight/15*0.5f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.top - fHeight*0.33f + fHeight/15*0.5f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.top - fHeight*0.33f), PWLPT_BEZIERTO), - + CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.bottom + fHeight*0.2f), PWLPT_LINETO), CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.bottom + fHeight*0.2f - (fWidth*57/60.0f - fWidth*0.24f)*0.25f), PWLPT_BEZIERTO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60 + fWidth*0.12f, crBBox.bottom + fHeight*0.2f - (fWidth*57/60.0f - fWidth*0.24f)*0.25f), PWLPT_BEZIERTO), @@ -2658,7 +2658,7 @@ void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& if(type == PWLPT_STREAM) sPathData = GetAppStreamFromArray(PathArray, 33); else - GetPathDataFromArray(path, PathArray, 33); + GetPathDataFromArray(path, PathArray, 33); } void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type) @@ -2666,7 +2666,7 @@ void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.25f, crBBox.top - fHeight*0.1f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.23f), PWLPT_LINETO), @@ -2710,7 +2710,7 @@ void CPWL_Utils::GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.1f), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.1f, crBBox.top - fHeight*0.5f), PWLPT_LINETO), @@ -2746,7 +2746,7 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path FX_FLOAT fWidth = crInBox.right - crInBox.left; FX_FLOAT fHeight = crInBox.top - crInBox.bottom; - CPWL_PathData PathArray[] = + CPWL_PathData PathArray[] = { CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_MOVETO), CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.45f, crInBox.top), PWLPT_LINETO), diff --git a/fpdfsdk/src/resource.h b/fpdfsdk/src/resource.h index 1ba20957a6..1729807951 100644 --- a/fpdfsdk/src/resource.h +++ b/fpdfsdk/src/resource.h @@ -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 #ifndef FPDFSDK_SRC_RESOURCE_H_ |