summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-05 16:46:58 -0800
committerLei Zhang <thestig@chromium.org>2016-01-05 16:46:58 -0800
commitc2fb35f2bbcf6c8fcf37380000544ae39d9a8cec (patch)
tree6b8da05d1624cbbe5a0c7042c9820f02180f442c /fpdfsdk/src
parent62664cee15230d6cbe08ed010721a4557b36dc22 (diff)
downloadpdfium-c2fb35f2bbcf6c8fcf37380000544ae39d9a8cec.tar.xz
Merge to XFA: Remove header files that only have includes.
Also do some cleanups in affected files. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1552583002 . (cherry picked from commit d794d34b5deb6ad691c19af758090f9ce46015a3) Review URL: https://codereview.chromium.org/1566583002 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp8
-rw-r--r--fpdfsdk/src/formfiller/FFL_CheckBox.cpp9
-rw-r--r--fpdfsdk/src/formfiller/FFL_ComboBox.cpp70
-rw-r--r--fpdfsdk/src/formfiller/FFL_FormFiller.cpp44
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp8
-rw-r--r--fpdfsdk/src/formfiller/FFL_ListBox.cpp13
-rw-r--r--fpdfsdk/src/formfiller/FFL_PushButton.cpp6
-rw-r--r--fpdfsdk/src/formfiller/FFL_RadioButton.cpp7
-rw-r--r--fpdfsdk/src/formfiller/FFL_TextField.cpp9
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp6
-rw-r--r--fpdfsdk/src/fxedit/fxet_ap.cpp4
-rw-r--r--fpdfsdk/src/fxedit/fxet_edit.cpp156
-rw-r--r--fpdfsdk/src/fxedit/fxet_list.cpp22
-rw-r--r--fpdfsdk/src/fxedit/fxet_module.cpp5
-rw-r--r--fpdfsdk/src/fxedit/fxet_pageobjs.cpp25
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Button.cpp5
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Caret.cpp10
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp9
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Edit.cpp49
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp7
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_FontMap.cpp18
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Icon.cpp22
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_IconList.cpp9
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Label.cpp3
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ListBox.cpp11
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp3
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Note.cpp40
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp7
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Signature.cpp32
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp7
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Utils.cpp102
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Wnd.cpp35
32 files changed, 238 insertions, 523 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
index b08ce35d41..1649eaf35d 100644
--- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
@@ -5,7 +5,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
+
+#include "core/include/fpdfapi/fpdf_page.h"
+#include "fpdfsdk/include/fsdk_baseannot.h"
CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
IFX_SystemHandler* pSystemHandler)
@@ -35,9 +37,9 @@ void CBA_FontMap::Initialize() {
if (!m_pDefaultFont) {
m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
if (m_pDefaultFont) {
- if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
+ if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) {
nCharset = pSubstFont->m_Charset;
- else {
+ } else {
if (m_sDefaultFontName == "Wingdings" ||
m_sDefaultFontName == "Wingdings2" ||
m_sDefaultFontName == "Wingdings3" ||
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
index 0129707340..c2e1b20253 100644
--- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
@@ -5,11 +5,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fpdfsdk/include/formfiller/FFL_CheckBox.h"
-#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-/* ------------------------------- CFFL_CheckBox -------------------------------
- */
+#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
+#include "public/fpdf_fwlevent.h"
CFFL_CheckBox::CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget)
: CFFL_Button(pApp, pWidget) {}
@@ -80,7 +80,6 @@ FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView,
if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
pWnd->SetCheck(!pWidget->IsChecked());
- // pWnd->SetCheck(!pWnd->IsChecked());
}
if (!CommitData(pPageView, nFlags))
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
index bef276d1cc..49d76bb265 100644
--- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
@@ -4,14 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_ComboBox.h"
+
+#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-
-/* ------------------------------- CFFL_ComboBox -------------------------------
- */
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h"
CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
@@ -87,40 +87,31 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
}
void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) {
- if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
- CFX_WideString swText = pWnd->GetText();
- int32_t nCurSel = pWnd->GetSelect();
-
- // mantis:0004157
- FX_BOOL bSetValue = TRUE;
-
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) {
- if (nCurSel >= 0) {
- if (swText != m_pWidget->GetOptionLabel(nCurSel))
- bSetValue = TRUE;
- else
- bSetValue = FALSE;
- } else
- bSetValue = TRUE;
- } else
- bSetValue = FALSE;
-
- CFX_WideString sOldValue;
-
- if (bSetValue) {
- sOldValue = m_pWidget->GetValue();
- m_pWidget->SetValue(swText, FALSE);
- } else {
- m_pWidget->GetSelectedIndex(0);
- m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE);
- }
+ CPWL_ComboBox* pWnd =
+ static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE));
+ if (!pWnd)
+ return;
- m_pWidget->ResetFieldAppearance(TRUE);
- m_pWidget->UpdateField();
- SetChangeMark();
+ CFX_WideString swText = pWnd->GetText();
+ int32_t nCurSel = pWnd->GetSelect();
- m_pWidget->GetPDFPage();
+ bool bSetValue = false;
+
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)
+ bSetValue = (nCurSel < 0) || (swText != m_pWidget->GetOptionLabel(nCurSel));
+
+ if (bSetValue) {
+ m_pWidget->SetValue(swText, FALSE);
+ } else {
+ m_pWidget->GetSelectedIndex(0);
+ m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE);
}
+
+ m_pWidget->ResetFieldAppearance(TRUE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
+
+ m_pWidget->GetPDFPage();
}
void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView,
@@ -216,9 +207,9 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) {
if (CPWL_ComboBox* pComboBox =
static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, TRUE))) {
- if (m_State.nIndex >= 0)
+ if (m_State.nIndex >= 0) {
pComboBox->SetSelect(m_State.nIndex);
- else {
+ } else {
if (CPWL_Edit* pEdit = pComboBox->GetEdit()) {
pEdit->SetText(m_State.sValue.c_str());
pEdit->SetSel(m_State.nStart, m_State.nEnd);
@@ -239,8 +230,9 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView,
if (bRestoreValue) {
RestoreState(pPageView);
pRet = GetPDFWindow(pPageView, FALSE);
- } else
+ } else {
pRet = GetPDFWindow(pPageView, TRUE);
+ }
m_pWidget->UpdateField();
diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
index a903824c6a..2e73b491c9 100644
--- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
@@ -4,17 +4,19 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
+
#define GetRed(rgb) ((uint8_t)(rgb))
#define GetGreen(rgb) ((uint8_t)(((FX_WORD)(rgb)) >> 8))
#define GetBlue(rgb) ((uint8_t)((rgb) >> 16))
#define FFL_HINT_ELAPSE 800
-/* ------------------------- CFFL_FormFiller ------------------------- */
-
CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp,
CPDFSDK_Annot* pAnnot)
: m_pApp(pApp), m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0, 0) {
@@ -622,8 +624,6 @@ void CFFL_FormFiller::InvalidateRect(double left,
m_pApp->FFI_Invalidate(pPage, left, top, right, bottom);
}
-/* ------------------------- CFFL_Button ------------------------- */
-
CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
: CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {}
@@ -696,25 +696,25 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView,
CPDF_FormControl* pCtrl = pWidget->GetFormControl();
CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode();
- if (eHM == CPDF_FormControl::Push) {
- if (m_bMouseDown) {
- if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL);
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
- NULL);
- } else if (m_bMouseIn) {
- if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover,
- NULL);
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
- NULL);
- } else {
+ if (eHM != CPDF_FormControl::Push) {
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ return;
+ }
+
+ if (m_bMouseDown) {
+ if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down))
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL);
+ else
pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
- }
- } else
+ } else if (m_bMouseIn) {
+ if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover))
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover,
+ NULL);
+ else
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ } else {
pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ }
}
void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index b8893e872f..36b123e165 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -4,14 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
+
#include "fpdfsdk/include/formfiller/FFL_CheckBox.h"
#include "fpdfsdk/include/formfiller/FFL_ComboBox.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
-#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_ListBox.h"
#include "fpdfsdk/include/formfiller/FFL_PushButton.h"
#include "fpdfsdk/include/formfiller/FFL_RadioButton.h"
#include "fpdfsdk/include/formfiller/FFL_TextField.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#define FFL_MAXLISTBOXHEIGHT 140.0f
@@ -607,8 +610,9 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData,
} else {
fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
}
- } else
+ } else {
fMaxListBoxHeight = fPopupMax;
+ }
if (fBottom > fMaxListBoxHeight) {
fFactHeight = fMaxListBoxHeight;
diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
index d9244e699f..638618f784 100644
--- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
@@ -4,17 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "fpdfsdk/include/formfiller/FFL_ListBox.h"
+
#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
-#include "fpdfsdk/include/formfiller/FFL_ListBox.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
#define FFL_DEFAULTLISTBOXFONTSIZE 12.0f
-/* ------------------------------- CFFL_ListBox -------------------------------
- */
-
CFFL_ListBox::CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
: CFFL_FormFiller(pApp, pWidget), m_pFontMap(NULL) {}
@@ -213,8 +213,9 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView,
if (bRestoreValue) {
RestoreState(pPageView);
pRet = GetPDFWindow(pPageView, FALSE);
- } else
+ } else {
pRet = GetPDFWindow(pPageView, TRUE);
+ }
m_pWidget->UpdateField();
diff --git a/fpdfsdk/src/formfiller/FFL_PushButton.cpp b/fpdfsdk/src/formfiller/FFL_PushButton.cpp
index fbf782e99d..d5bd509718 100644
--- a/fpdfsdk/src/formfiller/FFL_PushButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_PushButton.cpp
@@ -4,12 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_PushButton.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-/* ------------------------------- CFFL_PushButton
- * ------------------------------- */
+#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
CFFL_PushButton::CFFL_PushButton(CPDFDoc_Environment* pApp,
CPDFSDK_Annot* pAnnot)
diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
index 609e043024..2a742c0a85 100644
--- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
@@ -4,12 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_RadioButton.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-/* ------------------------------- CFFL_RadioButton
- * ------------------------------- */
+#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
CFFL_RadioButton::CFFL_RadioButton(CPDFDoc_Environment* pApp,
CPDFSDK_Annot* pWidget)
diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp
index fe0a3aae9c..8d39b82dd5 100644
--- a/fpdfsdk/src/formfiller/FFL_TextField.cpp
+++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp
@@ -4,11 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_TextField.h"
-/* ------------------------------- CFFL_TextField
- * ------------------------------- */
+#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
@@ -247,8 +247,9 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView,
if (bRestoreValue) {
RestoreState(pPageView);
pRet = GetPDFWindow(pPageView, FALSE);
- } else
+ } else {
pRet = GetPDFWindow(pPageView, TRUE);
+ }
m_pWidget->UpdateField();
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index d27ac00606..469a196813 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -4,15 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "fpdfsdk/include/fsdk_baseform.h"
+
#include <memory>
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/fsdk_actionhandler.h"
#include "fpdfsdk/include/fsdk_baseannot.h"
-#include "fpdfsdk/include/fsdk_baseform.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "fpdfsdk/include/javascript/IJavaScript.h"
+#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#ifdef PDF_ENABLE_XFA
#include "../include/fpdfxfa/fpdfxfa_doc.h"
@@ -2796,8 +2798,6 @@ FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) {
return m_aHighlightColor[nFieldType - 1];
}
-/* ------------------------- CBA_AnnotIterator ------------------------- */
-
CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
const CFX_ByteString& sType,
const CFX_ByteString& sSubType)
diff --git a/fpdfsdk/src/fxedit/fxet_ap.cpp b/fpdfsdk/src/fxedit/fxet_ap.cpp
index 4f879c0022..2803b60d72 100644
--- a/fpdfsdk/src/fxedit/fxet_ap.cpp
+++ b/fpdfsdk/src/fxedit/fxet_ap.cpp
@@ -4,9 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/fpdf_resource.h"
#include "fpdfsdk/include/fxedit/fx_edit.h"
#include "fpdfsdk/include/fxedit/fxet_edit.h"
-#include "fpdfsdk/include/fxedit/fxet_stub.h"
CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap,
int32_t nFontIndex,
@@ -177,7 +177,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream(
CFX_ByteString IFX_Edit::GetSelectAppearanceStream(
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
- const CPVT_WordRange* pRange /*= NULL*/) {
+ const CPVT_WordRange* pRange) {
CFX_ByteTextBuf sRet;
if (pRange && pRange->IsExist()) {
diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp
index b048787cc8..c7abbf44bb 100644
--- a/fpdfsdk/src/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/src/fxedit/fxet_edit.cpp
@@ -5,12 +5,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fpdfsdk/include/fxedit/fxet_edit.h"
-#include "fpdfsdk/include/fxedit/fxet_stub.h"
-#define FX_EDIT_UNDO_MAXITEM 10000
+#include "core/include/fpdfapi/fpdf_resource.h"
-/* ---------------------------- CFX_Edit_Iterator ----------------------------
- */
+#define FX_EDIT_UNDO_MAXITEM 10000
CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit,
IPDF_VariableText_Iterator* pVTIterator)
@@ -88,9 +86,6 @@ IFX_Edit* CFX_Edit_Iterator::GetEdit() const {
return m_pEdit;
}
-/* --------------------------- CFX_Edit_Provider -------------------------------
- */
-
CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap)
: m_pFontMap(pFontMap) {
ASSERT(m_pFontMap);
@@ -148,9 +143,6 @@ FX_BOOL CFX_Edit_Provider::IsLatinWord(FX_WORD word) {
return FX_EDIT_ISLATINWORD(word);
}
-/* --------------------------------- CFX_Edit_Refresh
- * --------------------------------- */
-
CFX_Edit_Refresh::CFX_Edit_Refresh() {}
CFX_Edit_Refresh::~CFX_Edit_Refresh() {}
@@ -219,9 +211,9 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) {
fWidthDiff =
pNewRect->m_rcLine.Width() - pOldRect->m_rcLine.Width();
rcResult = pNewRect->m_rcLine;
- if (fWidthDiff > 0.0f)
+ if (fWidthDiff > 0.0f) {
rcResult.left = rcResult.right - fWidthDiff;
- else {
+ } else {
rcResult.left = rcResult.right;
rcResult.right += (-fWidthDiff);
}
@@ -233,8 +225,6 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) {
rcResult.Union(pNewRect->m_rcLine);
m_RefreshRects.Add(rcResult);
}
- } else {
- // don't need to do anything
}
}
} else {
@@ -243,8 +233,6 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) {
} else {
if (pNewRect) {
m_RefreshRects.Add(pNewRect->m_rcLine);
- } else {
- // error
}
}
i++;
@@ -263,9 +251,6 @@ void CFX_Edit_Refresh::EndRefresh() {
m_RefreshRects.Empty();
}
-/* ------------------------------------- CFX_Edit_Undo
- * ------------------------------------- */
-
CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize)
: m_nCurUndoPos(0),
m_nBufSize(nBufsize),
@@ -371,9 +356,6 @@ void CFX_Edit_Undo::Reset() {
m_UndoItemStack.RemoveAll();
}
-/* -------------------------------- CFX_Edit_GroupUndoItem
- * -------------------------------- */
-
CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle)
: m_sTitle(sTitle) {}
@@ -423,9 +405,6 @@ CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() {
return m_sTitle;
}
-/* ------------------------------------- CFX_Edit_UndoItem derived classes
- * ------------------------------------- */
-
CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -460,8 +439,6 @@ void CFXEU_InsertWord::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-
CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -496,9 +473,6 @@ void CFXEU_InsertReturn::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-// CFXEU_Backspace
-
CFXEU_Backspace::CFXEU_Backspace(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -536,9 +510,6 @@ void CFXEU_Backspace::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-// CFXEU_Delete
-
CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -578,9 +549,6 @@ void CFXEU_Delete::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-// CFXEU_Clear
-
CFXEU_Clear::CFXEU_Clear(CFX_Edit* pEdit,
const CPVT_WordRange& wrSel,
const CFX_WideString& swText)
@@ -606,9 +574,6 @@ void CFXEU_Clear::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-// CFXEU_ClearRich
-
CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -652,9 +617,6 @@ void CFXEU_ClearRich::Undo() {
}
}
}
-/* -------------------------------------------------------------------------- */
-// CFXEU_InsertText
-
CFXEU_InsertText::CFXEU_InsertText(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -694,8 +656,6 @@ void CFXEU_InsertText::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-
CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit* pEdit,
const CPVT_WordPlace& place,
EDIT_PROPS_E ep,
@@ -739,8 +699,6 @@ void CFXEU_SetSecProps::Undo() {
}
}
-/* -------------------------------------------------------------------------- */
-
CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit* pEdit,
const CPVT_WordPlace& place,
EDIT_PROPS_E ep,
@@ -780,9 +738,6 @@ void CFXEU_SetWordProps::Undo() {
}
}
-/* ------------------------------------- CFX_Edit
- * ------------------------------------- */
-
CFX_Edit::CFX_Edit(IPDF_VariableText* pVT)
: m_pVT(pVT),
m_pNotify(NULL),
@@ -817,8 +772,6 @@ CFX_Edit::~CFX_Edit() {
ASSERT(!m_pGroupUndoItem);
}
-// public methods
-
void CFX_Edit::Initialize() {
m_pVT->Initialize();
SetCaret(m_pVT->GetBeginWordPlace());
@@ -860,105 +813,92 @@ IFX_Edit_FontMap* CFX_Edit::GetFontMap() {
return NULL;
}
-void CFX_Edit::SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint) {
m_pVT->SetPlateRect(rect);
m_ptScrollPos = CPDF_Point(rect.left, rect.top);
if (bPaint)
Paint();
}
-void CFX_Edit::SetAlignmentH(int32_t nFormat /* =0 */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetAlignmentH(int32_t nFormat, FX_BOOL bPaint) {
m_pVT->SetAlignment(nFormat);
if (bPaint)
Paint();
}
-void CFX_Edit::SetAlignmentV(int32_t nFormat /* =0 */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetAlignmentV(int32_t nFormat, FX_BOOL bPaint) {
m_nAlignment = nFormat;
if (bPaint)
Paint();
}
-void CFX_Edit::SetPasswordChar(FX_WORD wSubWord /* ='*' */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetPasswordChar(FX_WORD wSubWord, FX_BOOL bPaint) {
m_pVT->SetPasswordChar(wSubWord);
if (bPaint)
Paint();
}
-void CFX_Edit::SetLimitChar(int32_t nLimitChar /* =0 */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetLimitChar(int32_t nLimitChar, FX_BOOL bPaint) {
m_pVT->SetLimitChar(nLimitChar);
if (bPaint)
Paint();
}
-void CFX_Edit::SetCharArray(int32_t nCharArray /* =0 */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetCharArray(int32_t nCharArray, FX_BOOL bPaint) {
m_pVT->SetCharArray(nCharArray);
if (bPaint)
Paint();
}
-void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace /* =0.0f */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint) {
m_pVT->SetCharSpace(fCharSpace);
if (bPaint)
Paint();
}
-void CFX_Edit::SetHorzScale(int32_t nHorzScale /* =100 */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint) {
m_pVT->SetHorzScale(nHorzScale);
if (bPaint)
Paint();
}
-void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine /* =TRUE */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint) {
m_pVT->SetMultiLine(bMultiLine);
if (bPaint)
Paint();
}
-void CFX_Edit::SetAutoReturn(FX_BOOL bAuto /* =TRUE */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint) {
m_pVT->SetAutoReturn(bAuto);
if (bPaint)
Paint();
}
-void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading /* =TRUE */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint) {
m_pVT->SetLineLeading(fLineLeading);
if (bPaint)
Paint();
}
-void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto /* =TRUE */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint) {
m_pVT->SetAutoFontSize(bAuto);
if (bPaint)
Paint();
}
-void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint) {
m_pVT->SetFontSize(fFontSize);
if (bPaint)
Paint();
}
-void CFX_Edit::SetAutoScroll(FX_BOOL bAuto /* =TRUE */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint) {
m_bEnableScroll = bAuto;
if (bPaint)
Paint();
}
-void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint) {
m_bEnableOverflow = bAllowed;
if (bPaint)
Paint();
@@ -1155,8 +1095,7 @@ FX_BOOL CFX_Edit::IsRichText() const {
return m_pVT->IsRichText();
}
-void CFX_Edit::SetRichText(FX_BOOL bRichText /* =TRUE */,
- FX_BOOL bPaint /* = TRUE*/) {
+void CFX_Edit::SetRichText(FX_BOOL bRichText, FX_BOOL bPaint) {
m_pVT->SetRichText(bRichText);
if (bPaint)
Paint();
@@ -1220,7 +1159,7 @@ FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) {
return SetRichTextProps(EP_CHARSPACE, NULL, &WordProps);
}
-FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) {
+FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale) {
CPVT_WordProps WordProps;
WordProps.nHorzScale = nHorzScale;
return SetRichTextProps(EP_HORZSCALE, NULL, &WordProps);
@@ -1258,8 +1197,6 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps,
pIterator->SetAt(wrTemp.BeginPos);
BeginGroupUndo(L"");
- ;
-
bSet = SetSecProps(eProps, wrTemp.BeginPos, pSecProps, pWordProps, wrTemp,
TRUE);
@@ -1645,20 +1582,20 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps,
}
void CFX_Edit::SetText(const FX_WCHAR* text,
- int32_t charset /*= DEFAULT_CHARSET*/,
- const CPVT_SecProps* pSecProps /*= NULL*/,
- const CPVT_WordProps* pWordProps /*= NULL*/) {
+ int32_t charset,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps) {
SetText(text, charset, pSecProps, pWordProps, TRUE, TRUE);
}
FX_BOOL CFX_Edit::InsertWord(FX_WORD word,
- int32_t charset /*= DEFAULT_CHARSET*/,
- const CPVT_WordProps* pWordProps /*= NULL*/) {
+ int32_t charset,
+ const CPVT_WordProps* pWordProps) {
return InsertWord(word, charset, pWordProps, TRUE, TRUE);
}
-FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps /*= NULL*/,
- const CPVT_WordProps* pWordProps /*= NULL*/) {
+FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps) {
return InsertReturn(pSecProps, pWordProps, TRUE, TRUE);
}
@@ -1675,9 +1612,9 @@ FX_BOOL CFX_Edit::Clear() {
}
FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text,
- int32_t charset /*= DEFAULT_CHARSET*/,
- const CPVT_SecProps* pSecProps /*= NULL*/,
- const CPVT_WordProps* pWordProps /*= NULL*/) {
+ int32_t charset,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps) {
return InsertText(text, charset, pSecProps, pWordProps, TRUE, TRUE);
}
@@ -1709,8 +1646,6 @@ FX_FLOAT CFX_Edit::GetCharSpace() const {
return m_pVT->GetCharSpace();
}
-// inner methods
-
CPVT_WordRange CFX_Edit::GetWholeWordRange() const {
if (m_pVT->IsValid())
return CPVT_WordRange(m_pVT->GetBeginWordPlace(), m_pVT->GetEndWordPlace());
@@ -2033,31 +1968,8 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,
m_Refresh.BeginRefresh();
RefreshPushLineRects(GetVisibleWordRange());
- // if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) ||
- // !FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.y,m_ptScrollPos.y))
- // {
m_Refresh.NoAnalyse();
m_ptRefreshScrollPos = m_ptScrollPos;
- // }
- // else
- // {
- // switch (ePlan)
- // {
- // case RP_ANALYSE:
- // m_Refresh.Analyse(m_pVT->GetAlignment());
- //
- // if (pRange1) RefreshPushRandomRects(*pRange1);
- // if (pRange2) RefreshPushRandomRects(*pRange2);
- // break;
- // case RP_NOANALYSE:
- // m_Refresh.NoAnalyse();
- // break;
- // case RP_OPTIONAL:
- // if (pRange1) RefreshPushRandomRects(*pRange1);
- // if (pRange2) RefreshPushRandomRects(*pRange2);
- // break;
- // }
- // }
if (m_bNotify && m_pNotify) {
if (!m_bNotifyFlag) {
@@ -2097,7 +2009,6 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) {
m_Refresh.Push(CPVT_WordRange(lineinfo.lineplace, lineinfo.lineEnd),
VTToEdit(rcLine));
-
} while (pIterator->NextLine());
}
}
@@ -2549,7 +2460,6 @@ void CFX_Edit::SetText(const FX_WCHAR* text,
Paint();
if (m_bOprNotify && m_pOprNotify)
m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret);
- // if (bAddUndo)
}
FX_BOOL CFX_Edit::InsertWord(FX_WORD word,
@@ -3103,9 +3013,9 @@ void CFX_Edit::EndGroupUndo() {
}
void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) {
- if (m_pGroupUndoItem)
+ if (m_pGroupUndoItem) {
m_pGroupUndoItem->AddUndoItem(pEditUndoItem);
- else {
+ } else {
m_Undo.AddItem(pEditUndoItem);
if (m_bOprNotify && m_pOprNotify)
m_pOprNotify->OnAddUndo(pEditUndoItem);
diff --git a/fpdfsdk/src/fxedit/fxet_list.cpp b/fpdfsdk/src/fxedit/fxet_list.cpp
index 1ece0ef11a..4e8ae0cb8e 100644
--- a/fpdfsdk/src/fxedit/fxet_list.cpp
+++ b/fpdfsdk/src/fxedit/fxet_list.cpp
@@ -6,10 +6,6 @@
#include "fpdfsdk/include/fxedit/fxet_edit.h"
#include "fpdfsdk/include/fxedit/fxet_list.h"
-#include "fpdfsdk/include/fxedit/fxet_stub.h"
-
-/* ------------------------------- CFX_ListItem
- * ---------------------------------- */
CFX_ListItem::CFX_ListItem()
: m_pEdit(NULL),
@@ -100,9 +96,6 @@ CFX_WideString CFX_ListItem::GetText() const {
return L"";
}
-/* ------------------------------------ CFX_List
- * --------------------------------- */
-
CFX_List::CFX_List()
: m_fFontSize(0.0f), m_pFontMap(NULL), m_bMultiple(FALSE) {}
@@ -308,9 +301,6 @@ CFX_WideString CFX_List::GetItemText(int32_t nIndex) const {
return L"";
}
-/* ------------------------------------ CPLST_Select
- * ---------------------------------- */
-
CPLST_Select::CPLST_Select() {}
CPLST_Select::~CPLST_Select() {
@@ -323,9 +313,9 @@ CPLST_Select::~CPLST_Select() {
void CPLST_Select::Add(int32_t nItemIndex) {
int32_t nIndex = Find(nItemIndex);
- if (nIndex < 0)
+ if (nIndex < 0) {
m_aItems.Add(new CPLST_Select_Item(nItemIndex, 1));
- else {
+ } else {
if (CPLST_Select_Item* pItem = m_aItems.GetAt(nIndex)) {
pItem->nState = 1;
}
@@ -418,9 +408,6 @@ void CPLST_Select::Done() {
}
}
-/* ------------------------------------ CFX_ListCtrl
- * --------------------------------- */
-
CFX_ListCtrl::CFX_ListCtrl()
: m_pNotify(NULL),
m_bNotifyFlag(FALSE),
@@ -591,8 +578,6 @@ FX_BOOL CFX_ListCtrl::OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) {
return FALSE;
}
-/* -------- inner methods ------- */
-
void CFX_ListCtrl::SetPlateRect(const CPDF_Rect& rect) {
CFX_ListContainer::SetPlateRect(rect);
m_ptScrollPos.x = rect.left;
@@ -710,8 +695,9 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) {
if (IsMultipleSel()) {
m_aSelItems.Add(nItemIndex);
SelectItems();
- } else
+ } else {
SetSingleSelect(nItemIndex);
+ }
}
FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const {
diff --git a/fpdfsdk/src/fxedit/fxet_module.cpp b/fpdfsdk/src/fxedit/fxet_module.cpp
index 553cf3a62f..889b0f81a6 100644
--- a/fpdfsdk/src/fxedit/fxet_module.cpp
+++ b/fpdfsdk/src/fxedit/fxet_module.cpp
@@ -6,9 +6,6 @@
#include "fpdfsdk/include/fxedit/fxet_edit.h"
#include "fpdfsdk/include/fxedit/fxet_list.h"
-#include "fpdfsdk/include/fxedit/fxet_stub.h"
-
-/* ---------------------- IFX_Edit ---------------------- */
IFX_Edit* IFX_Edit::NewEdit() {
if (IPDF_VariableText* pVT = IPDF_VariableText::NewVariableText()) {
@@ -24,8 +21,6 @@ void IFX_Edit::DelEdit(IFX_Edit* pEdit) {
delete (CFX_Edit*)pEdit;
}
-/* ---------------------- IFX_List ---------------------- */
-
IFX_List* IFX_List::NewList() {
return new CFX_ListCtrl();
}
diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp
index fefa42bdfd..18687679c2 100644
--- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp
@@ -4,9 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/fpdf_pageobj.h"
+#include "core/include/fpdfapi/fpdf_render.h"
+#include "fpdfsdk/include/fx_systemhandler.h"
#include "fpdfsdk/include/fxedit/fx_edit.h"
#include "fpdfsdk/include/fxedit/fxet_edit.h"
-#include "fpdfsdk/include/fxedit/fxet_stub.h"
#define FX_EDIT_UNDERLINEHALFWIDTH 0.5f
#define FX_EDIT_CROSSOUTHALFWIDTH 0.5f
@@ -57,9 +59,10 @@ static void DrawTextString(CFX_RenderDevice* pDevice,
CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
str, crTextFill, crTextStroke, &gsd,
&ro);
- } else
+ } else {
CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
str, crTextFill, 0, NULL, &ro);
+ }
} else {
CPDF_RenderOptions ro;
ro.m_Flags = RENDER_CLEARTYPE;
@@ -76,10 +79,11 @@ static void DrawTextString(CFX_RenderDevice* pDevice,
CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
pUser2Device, str, crTextFill,
crTextStroke, &gsd, &ro);
- } else
+ } else {
CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
pUser2Device, str, crTextFill, 0,
NULL, &ro);
+ }
}
}
}
@@ -218,8 +222,6 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
word.ptWord.x + word.fWidth,
line.ptLine.y + line.fLineAscent);
rc.Intersect(rcClip);
- // CFX_Edit* pEt = (CFX_Edit*)pEdit;
- // CPDF_Rect rcEdit = pEt->VTToEdit(rc);
pSystemHandler->OutputSelectedRect(pFFLData, rc);
} else {
CFX_PathData pathSelBK;
@@ -282,7 +284,6 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice,
const CPDF_Rect& rcClip,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange) {
- // FX_FLOAT fFontSize = pEdit->GetFontSize();
CPVT_WordRange wrSelect = pEdit->GetSelectWordRange();
FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0);
@@ -588,17 +589,7 @@ void IFX_Edit::GenerateRichPageObjects(
sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
word.Word, 0);
- if (word.WordProps.nWordStyle &
- PVTWORD_STYLE_UNDERLINE) { /*
- 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));
-*/
+ if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
CPDF_Rect rcUnderline = GetUnderLineRect(word);
rcUnderline.left += ptOffset.x;
rcUnderline.right += ptOffset.x;
diff --git a/fpdfsdk/src/pdfwindow/PWL_Button.cpp b/fpdfsdk/src/pdfwindow/PWL_Button.cpp
index e9c2647aa2..5c78383380 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Button.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Button.cpp
@@ -4,18 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* ------------------------------- CPWL_Button
- * ---------------------------------- */
-
CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {}
CPWL_Button::~CPWL_Button() {
- // PWL_TRACE("~CPWL_Button\n");
}
CFX_ByteString CPWL_Button::GetClassName() const {
diff --git a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp
index d129c2c7d3..75c951068a 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp
@@ -4,17 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
#define PWL_CARET_FLASHINTERVAL 500
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
CPWL_Caret::CPWL_Caret()
: m_bFlash(FALSE),
m_ptHead(0, 0),
@@ -125,7 +120,6 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible,
m_ptFoot = ptFoot;
m_bFlash = TRUE;
- // Move(GetCaretRect(),FALSE,TRUE);
Move(m_rcInvalid, FALSE, TRUE);
}
} else {
@@ -138,7 +132,6 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible,
CPWL_Wnd::SetVisible(TRUE);
m_bFlash = TRUE;
- // Move(GetCaretRect(),FALSE,TRUE);
Move(m_rcInvalid, FALSE, TRUE);
}
} else {
@@ -160,6 +153,7 @@ void CPWL_Caret::InvalidateRect(CPDF_Rect* pRect) {
rcRefresh.bottom -= 1;
CPWL_Wnd::InvalidateRect(&rcRefresh);
- } else
+ } else {
CPWL_Wnd::InvalidateRect(pRect);
+ }
}
diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp
index 71994ea27d..f5f3a7873c 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp
@@ -4,13 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h"
+
#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "public/fpdf_fwlevent.h"
#define PWLCB_DEFAULTFONTSIZE 12.0f
@@ -19,8 +20,6 @@
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-/* ---------------------------- CPWL_CBListBox ---------------------------- */
-
FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
CPWL_Wnd::OnLButtonUp(point, nFlag);
@@ -108,8 +107,6 @@ FX_BOOL CPWL_CBListBox::OnCharWithExit(FX_WORD nChar,
return TRUE;
}
-/* ---------------------------- CPWL_CBButton ---------------------------- */
-
void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPWL_Wnd::GetThisAppearanceStream(sAppStream);
@@ -199,8 +196,6 @@ FX_BOOL CPWL_CBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
return TRUE;
}
-/* ---------------------------- CPWL_ComboBox ---------------------------- */
-
CPWL_ComboBox::CPWL_ComboBox()
: m_pEdit(NULL),
m_pButton(NULL),
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
index 6d32b7270f..8ddb7dfb6e 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
@@ -4,18 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
+
#include "core/include/fxcrt/fx_safe_types.h"
#include "core/include/fxcrt/fx_xml.h"
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/include/pdfwindow/PWL_FontMap.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-
-/* ---------------------------- CPWL_Edit ------------------------------ */
+#include "public/fpdf_fwlevent.h"
CPWL_Edit::CPWL_Edit()
: m_pFillerNotify(NULL), m_pSpellCheck(NULL), m_bFocus(FALSE) {
@@ -101,12 +100,12 @@ CPDF_Rect CPWL_Edit::GetClientRect() const {
}
void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat,
- FX_BOOL bPaint /* = TRUE*/) {
+ FX_BOOL bPaint) {
m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint);
}
void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat,
- FX_BOOL bPaint /* = TRUE*/) {
+ FX_BOOL bPaint) {
m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint);
}
@@ -1126,43 +1125,39 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place,
if (bLatin) {
while (pIterator->NextWord()) {
- if (pIterator->GetWord(wordinfo) &&
- FX_EDIT_ISLATINWORD(wordinfo.Word)) {
- wpEnd = pIterator->GetAt();
- continue;
- } else
+ if (!pIterator->GetWord(wordinfo) ||
+ !FX_EDIT_ISLATINWORD(wordinfo.Word)) {
break;
- };
+ }
+
+ wpEnd = pIterator->GetAt();
+ }
} else if (bArabic) {
while (pIterator->NextWord()) {
- if (pIterator->GetWord(wordinfo) && PWL_ISARABICWORD(wordinfo.Word)) {
- wpEnd = pIterator->GetAt();
- continue;
- } else
+ if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
break;
- };
+
+ wpEnd = pIterator->GetAt();
+ }
}
pIterator->SetAt(place);
if (bLatin) {
do {
- if (pIterator->GetWord(wordinfo) &&
- FX_EDIT_ISLATINWORD(wordinfo.Word)) {
- continue;
- } else {
- wpStart = pIterator->GetAt();
+ if (!pIterator->GetWord(wordinfo) ||
+ !FX_EDIT_ISLATINWORD(wordinfo.Word)) {
break;
}
+
+ wpStart = pIterator->GetAt();
} while (pIterator->PrevWord());
} else if (bArabic) {
do {
- if (pIterator->GetWord(wordinfo) && PWL_ISARABICWORD(wordinfo.Word)) {
- continue;
- } else {
- wpStart = pIterator->GetAt();
+ if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word))
break;
- }
+
+ wpStart = pIterator->GetAt();
} while (pIterator->PrevWord());
}
diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp
index 8d54ae0a13..e54810e0ce 100644
--- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp
@@ -4,21 +4,20 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
+
+#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
#include "fpdfsdk/include/pdfwindow/PWL_FontMap.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "public/fpdf_fwlevent.h"
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
#define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-/* ---------------------------- CPWL_EditCtrl ------------------------------ */
-
CPWL_EditCtrl::CPWL_EditCtrl()
: m_pEdit(NULL),
m_pEditCaret(NULL),
diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
index fadea905d4..e418e8b380 100644
--- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp
@@ -4,14 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_FontMap.h"
+
+#include "core/include/fpdfapi/fpdf_module.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
#define DEFAULT_FONT_NAME "Helvetica"
-/* ------------------------------ CPWL_FontMap ------------------------------ */
-
CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler)
: m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) {
ASSERT(m_pSystemHandler);
@@ -239,13 +238,6 @@ int32_t CPWL_FontMap::GetPWLFontIndex(FX_WORD word, int32_t nCharset) {
if (!pNewFont)
return -1;
- /*
- if (CPDF_Font* pFont = GetPDFFont(nFind))
- {
- PWLFont.AddWordToFontDict(pFontDict, word);
- }
- */
-
CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset);
AddedFont(pNewFont, sAlias);
@@ -313,9 +305,9 @@ CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc,
CPDF_Font* pFont = NULL;
- if (sFontName == "ZapfDingbats")
+ if (sFontName == "ZapfDingbats") {
pFont = pDoc->AddStandardFont(sFontName, NULL);
- else {
+ } else {
CPDF_FontEncoding fe(PDFFONT_ENCODING_WINANSI);
pFont = pDoc->AddStandardFont(sFontName, &fe);
}
@@ -499,8 +491,6 @@ int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) {
return ANSI_CHARSET;
}
-/* ------------------------ CPWL_DocFontMap ------------------------ */
-
CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler,
CPDF_Document* pAttachedDoc)
: CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {}
diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp
index db5355c59e..6afd76c5c6 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp
@@ -4,14 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* ------------------------------- CPWL_Image ----------------------------------
- */
-
CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {}
CPWL_Image::~CPWL_Image() {}
@@ -83,15 +79,15 @@ CFX_Matrix CPWL_Image::GetImageMatrix() {
}
CFX_ByteString CPWL_Image::GetImageAlias() {
- if (m_sImageAlias.IsEmpty()) {
- if (m_pPDFStream) {
- if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) {
- return pDict->GetString("Name");
- }
- }
- } else
+ if (!m_sImageAlias.IsEmpty())
return m_sImageAlias;
+ if (m_pPDFStream) {
+ if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) {
+ return pDict->GetString("Name");
+ }
+ }
+
return CFX_ByteString();
}
@@ -109,9 +105,6 @@ void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) {
y = 0.0f;
}
-/* ------------------------------- CPWL_Icon ----------------------------------
- */
-
CPWL_Icon::CPWL_Icon() : m_pIconFit(NULL) {}
CPWL_Icon::~CPWL_Icon() {}
@@ -132,7 +125,6 @@ FX_BOOL CPWL_Icon::IsProportionalScale() {
void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
if (m_pIconFit) {
- // m_pIconFit->GetIconPosition(fLeft,fBottom);
fLeft = 0.0f;
fBottom = 0.0f;
CPDF_Array* pA =
diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp
index 6a627d7e92..c6849d0683 100644
--- a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp
@@ -4,21 +4,20 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_IconList.h"
+
#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
#include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "public/fpdf_fwlevent.h"
#define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f
#define PWL_IconList_ITEM_WIDTH 20.0f
#define PWL_IconList_ITEM_HEIGHT 20.0f
#define PWL_IconList_ITEM_SPACE 4.0f
-/* ------------------ CPWL_IconList_Item ------------------- */
-
CPWL_IconList_Item::CPWL_IconList_Item()
: m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) {}
@@ -128,8 +127,6 @@ void CPWL_IconList_Item::OnDisabled() {
InvalidateRect();
}
-/* ----------------- CPWL_IconList_Content ----------------- */
-
CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount)
: m_nSelectIndex(-1),
m_pNotify(NULL),
@@ -348,8 +345,6 @@ void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) {
}
}
-/* -------------------- CPWL_IconList --------------------- */
-
CPWL_IconList::CPWL_IconList(int32_t nListCount)
: m_pListContent(NULL), m_nListCount(nListCount) {}
diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp
index 8ff7235701..4f8a0dd8ed 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp
@@ -4,13 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* ---------------------------- CPWL_Label ------------------------------ */
-
CPWL_Label::CPWL_Label() : m_pEdit(NULL) {
m_pEdit = IFX_Edit::NewEdit();
ASSERT(m_pEdit);
diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
index 685da4fd34..e3e83f9c7a 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
@@ -4,21 +4,20 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
+#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
+
#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
+#include "public/fpdf_fwlevent.h"
#define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
#define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-/* ------------------------ CPWL_List_Notify ----------------------- */
-
CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) {
ASSERT(m_pList);
}
@@ -65,8 +64,6 @@ void CPWL_List_Notify::IOnInvalidateRect(CPDF_Rect* pRect) {
m_pList->InvalidateRect(pRect);
}
-/* --------------------------- CPWL_ListBox ---------------------------- */
-
CPWL_ListBox::CPWL_ListBox()
: m_pList(NULL),
m_pListNotify(NULL),
@@ -180,8 +177,6 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
if (m_pList->IsItemSelected(i)) {
- // CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
- // ArgbEncode(255,0,51,113));
IFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
IFX_Edit::DrawEdit(
diff --git a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp
index f7c1ef12fd..6d9627b08a 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp
@@ -4,12 +4,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* ---------------------------- CPWL_ListCtrl ---------------------------- */
-
CPWL_ListCtrl::CPWL_ListCtrl()
: m_rcContent(0, 0, 0, 0),
m_ptScroll(0, 0),
diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp
index 4ac237df7f..760967b6a2 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp
@@ -4,16 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
+#include "fpdfsdk/include/pdfwindow/PWL_Note.h"
+
#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
#include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
#include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h"
-#include "fpdfsdk/include/pdfwindow/PWL_Note.h"
-#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
@@ -31,9 +29,6 @@
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-/* ------------------------------- CPWL_Note_Options
- * ------------------------------- */
-
CPWL_Note_Options::CPWL_Note_Options() : m_pText(NULL) {}
CPWL_Note_Options::~CPWL_Note_Options() {}
@@ -106,9 +101,6 @@ CPDF_Rect CPWL_Note_Options::GetContentRect() const {
return rcText;
}
-/* ------------------------------- CPWL_Note_Edit ------------------------------
- */
-
CPWL_Note_Edit::CPWL_Note_Edit()
: m_bEnableNotify(TRUE),
m_fOldItemHeight(0.0f),
@@ -234,9 +226,6 @@ FX_FLOAT CPWL_Note_Edit::GetItemRightMargin() {
return POPUP_ITEM_TEXT_INDENT;
}
-/* -------------------------------- CPWL_Note_LBBox
- * --------------------------------*/
-
CPWL_Note_LBBox::CPWL_Note_LBBox() {}
CPWL_Note_LBBox::~CPWL_Note_LBBox() {}
@@ -264,9 +253,6 @@ void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
FXFILL_ALTERNATE);
}
-/* -------------------------------- CPWL_Note_RBBox
- * --------------------------------*/
-
CPWL_Note_RBBox::CPWL_Note_RBBox() {}
CPWL_Note_RBBox::~CPWL_Note_RBBox() {}
@@ -294,9 +280,6 @@ void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
FXFILL_ALTERNATE);
}
-/* --------------------------------- CPWL_Note_Icon
- * ---------------------------------- */
-
CPWL_Note_Icon::CPWL_Note_Icon() : m_nType(0) {}
CPWL_Note_Icon::~CPWL_Note_Icon() {}
@@ -312,9 +295,6 @@ void CPWL_Note_Icon::DrawThisAppearance(CFX_RenderDevice* pDevice,
GetTransparency());
}
-/* --------------------------------- CPWL_Note_CloseBox
- * ---------------------------------- */
-
CPWL_Note_CloseBox::CPWL_Note_CloseBox() : m_bMouseDown(FALSE) {}
CPWL_Note_CloseBox::~CPWL_Note_CloseBox() {}
@@ -370,9 +350,6 @@ FX_BOOL CPWL_Note_CloseBox::OnLButtonUp(const CPDF_Point& point,
return CPWL_Button::OnLButtonUp(point, nFlag);
}
-/* ------------------------------ CPWL_Note_Contents
- * ------------------------------- */
-
CPWL_Note_Contents::CPWL_Note_Contents() : m_pEdit(NULL) {}
CPWL_Note_Contents::~CPWL_Note_Contents() {}
@@ -439,12 +416,13 @@ int32_t CPWL_Note_Contents::CountSubItems() const {
IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(int32_t index) const {
int32_t nIndex = index + 1;
- if (nIndex > 0 && nIndex < m_aChildren.GetSize())
+ if (nIndex > 0 && nIndex < m_aChildren.GetSize()) {
if (CPWL_Wnd* pChild = m_aChildren.GetAt(nIndex)) {
ASSERT(pChild->GetClassName() == "CPWL_NoteItem");
CPWL_NoteItem* pItem = (CPWL_NoteItem*)pChild;
return pItem;
}
+ }
return NULL;
}
@@ -601,9 +579,6 @@ void CPWL_Note_Contents::EnableRead(FX_BOOL bEnabled) {
}
}
-/* ---------------------------------- CPWL_NoteItem
- * ---------------------------------- */
-
CPWL_NoteItem::CPWL_NoteItem()
: m_pSubject(NULL),
m_pDateTime(NULL),
@@ -645,7 +620,6 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM& cp) {
m_pContents = new CPWL_Note_Contents;
PWL_CREATEPARAM ccp = cp;
ccp.pParentWnd = this;
- // ccp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR;
ccp.sBackgroundColor =
CPWL_Color(COLORTYPE_RGB, 240 / 255.0f, 240 / 255.0f, 240 / 255.0f);
ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BACKGROUND;
@@ -1044,9 +1018,6 @@ void CPWL_NoteItem::EnableRead(FX_BOOL bEnabled) {
m_pContents->EnableRead(bEnabled);
}
-/* ---------------------------------- CPWL_Note
- * ---------------------------------- */
-
CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote,
IPWL_NoteNotify* pNoteNotify,
IPWL_NoteHandler* pNoteHandler)
@@ -1380,8 +1351,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd,
0) {
FX_BOOL bScrollChanged = FALSE;
- if (lParam < 3) //·ÀÖ¹ËÀÑ­»· mantis:15759
- {
+ if (lParam < 3) {
bScrollChanged = ResetScrollBar();
if (bScrollChanged) {
lParam++;
diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
index b6a1bb3e6e..c48052da9a 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp
@@ -4,7 +4,6 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
@@ -610,8 +609,9 @@ void CPWL_ScrollBar::RePosChildWnd() {
rcClient.left + fBWidth, rcClient.top);
rcMaxButton = CPDF_Rect(rcClient.right - fBWidth, rcClient.bottom,
rcClient.right, rcClient.top);
- } else
+ } else {
SetVisible(FALSE);
+ }
}
break;
case SBT_VSCROLL:
@@ -633,8 +633,9 @@ void CPWL_ScrollBar::RePosChildWnd() {
rcClient.right, rcClient.top);
rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom,
rcClient.right, rcClient.bottom + fBWidth);
- } else
+ } else {
SetVisible(FALSE);
+ }
}
break;
}
diff --git a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp
index dead655da0..f7c73d0a7d 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp
@@ -4,16 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
#include "fpdfsdk/include/pdfwindow/PWL_Label.h"
#include "fpdfsdk/include/pdfwindow/PWL_Signature.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* --------------------------------- CPWL_Signature_Image
- * --------------------------------- */
-
CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {}
CPWL_Signature_Image::~CPWL_Signature_Image() {}
@@ -58,9 +54,6 @@ void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
fVScale = rcClient.Height() / fImageH;
}
-/* --------------------------------- CPWL_Signature
- * --------------------------------- */
-
CPWL_Signature::CPWL_Signature()
: m_pText(NULL),
m_pDescription(NULL),
@@ -169,34 +162,13 @@ void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
- if (m_bFlagExist)
+ if (m_bFlagExist) {
CPWL_Utils::DrawIconAppStream(
pDevice, pUser2Device, PWL_ICONTYPE_FOXIT,
CPWL_Utils::GetCenterSquare(GetClientRect()),
CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f),
CPWL_Color(COLORTYPE_TRANSPARENT), 255);
-
- /*
- CPDF_Rect rcClient = GetClientRect();
-
- CFX_PathData path;
-
- path.SetPointCount(2);
- path.SetPoint(0, rcClient.left, (rcClient.top + rcClient.bottom) * 0.5f,
- FXPT_MOVETO);
- path.SetPoint(1, rcClient.right, (rcClient.top + rcClient.bottom) * 0.5f,
- FXPT_LINETO);
-
- CFX_GraphStateData gsd;
- gsd.SetDashCount(2);
- gsd.m_DashArray[0] = 6.0f;
- gsd.m_DashArray[1] = 6.0f;
- gsd.m_DashPhase = 0;
-
- gsd.m_LineWidth = 10.0f;
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0),
- FXFILL_ALTERNATE);
- */
+ }
}
void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
index e22076edd2..52f25fcd84 100644
--- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
@@ -4,14 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* --------------------------- CPWL_PushButton ---------------------------- */
-
CPWL_PushButton::CPWL_PushButton() {}
CPWL_PushButton::~CPWL_PushButton() {}
@@ -24,8 +21,6 @@ CPDF_Rect CPWL_PushButton::GetFocusRect() const {
return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth());
}
-/* --------------------------- CPWL_CheckBox ---------------------------- */
-
CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) {}
CPWL_CheckBox::~CPWL_CheckBox() {}
@@ -55,8 +50,6 @@ FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
return TRUE;
}
-/* --------------------------- CPWL_RadioButton ---------------------------- */
-
CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) {}
CPWL_RadioButton::~CPWL_RadioButton() {}
diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
index 71a9d474b7..2c9ec99dc8 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
@@ -4,7 +4,6 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
@@ -14,8 +13,6 @@
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-/* ---------------------------- CPWL_Utils ------------------------------ */
-
CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData,
int32_t nCount) {
CFX_ByteTextBuf csAP;
@@ -136,71 +133,49 @@ CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1,
}
CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect& crBBox) {
- CFX_ByteTextBuf csAP;
-
- FX_FLOAT fWidth = crBBox.right - crBBox.left;
- FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
-
- const int32_t num = 8;
-
- CPWL_Point pts[num * 3] = {// 1
- 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.31f, 0.29f),
- CPWL_Point(0.31f, 0.28f),
-
- // 3
- 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.78f, 0.69f),
- CPWL_Point(0.76f, 0.75f),
-
- // 5
- 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.44f, 0.47f),
-
- // 7
- 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.28f, 0.66f),
- CPWL_Point(0.30f, 0.56f)};
-
- for (int32_t j = 0; j < num * 3; j++) {
- pts[j].x *= fWidth;
- pts[j].x += crBBox.left;
-
- pts[j].y *= fHeight;
- pts[j].y += crBBox.bottom;
+ const FX_FLOAT fWidth = crBBox.right - crBBox.left;
+ const FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
+
+ CPWL_Point pts[8][3] = {{CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f),
+ CPWL_Point(0.29f, 0.40f)},
+ {CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f),
+ CPWL_Point(0.31f, 0.28f)},
+ {CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f),
+ CPWL_Point(0.77f, 0.67f)},
+ {CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f),
+ CPWL_Point(0.76f, 0.75f)},
+ {CPWL_Point(0.76f, 0.75f), CPWL_Point(0.73f, 0.80f),
+ CPWL_Point(0.68f, 0.75f)},
+ {CPWL_Point(0.68f, 0.74f), CPWL_Point(0.68f, 0.74f),
+ CPWL_Point(0.44f, 0.47f)},
+ {CPWL_Point(0.43f, 0.47f), CPWL_Point(0.40f, 0.47f),
+ CPWL_Point(0.41f, 0.58f)},
+ {CPWL_Point(0.40f, 0.60f), CPWL_Point(0.28f, 0.66f),
+ CPWL_Point(0.30f, 0.56f)}};
+
+ for (size_t i = 0; i < FX_ArraySize(pts); ++i) {
+ for (size_t j = 0; j < FX_ArraySize(pts[0]); ++j) {
+ pts[i][j].x = pts[i][j].x * fWidth + crBBox.left;
+ pts[i][j].y *= pts[i][j].y * fHeight + crBBox.bottom;
+ }
}
- csAP << pts[0].x << " " << pts[0].y << " m\n";
+ CFX_ByteTextBuf csAP;
+ csAP << pts[0][0].x << " " << pts[0][0].y << " m\n";
- for (int32_t i = 0; i < num; i++) {
- int32_t nCur = i * 3;
- int32_t n1 = i * 3 + 1;
- int32_t n2 = i * 3 + 2;
- int32_t nNext = (i < num - 1 ? (i + 1) * 3 : 0);
+ for (size_t i = 0; i < FX_ArraySize(pts); ++i) {
+ size_t nNext = i < FX_ArraySize(pts) - 1 ? i + 1 : 0;
- FX_FLOAT px1 = pts[n1].x - pts[nCur].x;
- FX_FLOAT py1 = pts[n1].y - pts[nCur].y;
- FX_FLOAT px2 = pts[n2].x - pts[nNext].x;
- FX_FLOAT py2 = pts[n2].y - pts[nNext].y;
+ FX_FLOAT px1 = pts[i][1].x - pts[i][0].x;
+ FX_FLOAT py1 = pts[i][1].y - pts[i][0].y;
+ FX_FLOAT px2 = pts[i][2].x - pts[nNext][0].x;
+ FX_FLOAT py2 = pts[i][2].y - pts[nNext][0].y;
- 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";
+ csAP << pts[i][0].x + px1 * PWL_BEZIER << " "
+ << pts[i][0].y + py1 * PWL_BEZIER << " "
+ << pts[nNext][0].x + px2 * PWL_BEZIER << " "
+ << pts[nNext][0].y + py2 * PWL_BEZIER << " " << pts[nNext][0].x << " "
+ << pts[nNext][0].y << " c\n";
}
return csAP.GetByteString();
@@ -2338,7 +2313,6 @@ void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData,
const PWL_PATH_TYPE type) {
FX_FLOAT fWidth = crBBox.right - crBBox.left;
FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
- // FX_FLOAT fcatercorner = (FX_FLOAT)sqrt(fWidth*fWidth + fHeight*fHeight);
CPWL_Point center_point(crBBox.left + fWidth / 2,
crBBox.bottom + fHeight / 2);
diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
index baa24cb8bf..9c4e21713b 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
@@ -6,13 +6,10 @@
#include <map>
-#include "fpdfsdk/include/pdfwindow/PDFWindow.h"
#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
-/* -------------------------- CPWL_Timer -------------------------- */
-
static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() {
// Leak the object at shutdown.
static auto timeMap = new std::map<int32_t, CPWL_Timer*>;
@@ -58,8 +55,6 @@ void CPWL_Timer::TimerProc(int32_t idEvent) {
pTimer->m_pAttached->TimerProc();
}
-/* -------------------------- CPWL_TimerHandler -------------------------- */
-
CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(NULL) {}
CPWL_TimerHandler::~CPWL_TimerHandler() {
@@ -81,20 +76,16 @@ void CPWL_TimerHandler::EndTimer() {
void CPWL_TimerHandler::TimerProc() {}
-/* --------------------------- CPWL_MsgControl ---------------------------- */
-
class CPWL_MsgControl {
friend class CPWL_Wnd;
public:
- CPWL_MsgControl(CPWL_Wnd* pWnd) {
- // PWL_TRACE("new CPWL_MsgControl\n");
+ explicit CPWL_MsgControl(CPWL_Wnd* pWnd) {
m_pCreatedWnd = pWnd;
Default();
}
~CPWL_MsgControl() {
- // PWL_TRACE("~CPWL_MsgControl\n");
Default();
}
@@ -114,10 +105,12 @@ class CPWL_MsgControl {
}
FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const {
- if (pWnd)
- for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++)
+ if (pWnd) {
+ for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) {
if (m_aMousePath.GetAt(i) == pWnd)
return TRUE;
+ }
+ }
return FALSE;
}
@@ -127,10 +120,12 @@ class CPWL_MsgControl {
}
FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const {
- if (pWnd)
- for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++)
+ if (pWnd) {
+ for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) {
if (m_aKeyboardPath.GetAt(i) == pWnd)
return TRUE;
+ }
+ }
return FALSE;
}
@@ -187,8 +182,6 @@ class CPWL_MsgControl {
CPWL_Wnd* m_pMainKeyboardWnd;
};
-/* --------------------------- CPWL_Wnd ---------------------------- */
-
CPWL_Wnd::CPWL_Wnd()
: m_pVScrollBar(NULL),
m_rcWindow(),
@@ -620,14 +613,6 @@ int32_t CPWL_Wnd::GetBorderWidth() const {
}
int32_t CPWL_Wnd::GetInnerBorderWidth() const {
- /*
- switch (GetBorderStyle())
- {
- case PBS_BEVELED:
- case PBS_INSET:
- return GetBorderWidth() / 2;
- }
- */
return 0;
}
@@ -902,8 +887,6 @@ CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const {
return color;
}
-/* ----------------------------------------------------------------- */
-
int32_t CPWL_Wnd::GetTransparency() {
return m_sPrivateParam.nTransparency;
}