summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/formfiller
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/formfiller')
-rw-r--r--fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp503
-rw-r--r--fpdfsdk/src/formfiller/FFL_CheckBox.cpp213
-rw-r--r--fpdfsdk/src/formfiller/FFL_ComboBox.cpp563
-rw-r--r--fpdfsdk/src/formfiller/FFL_FormFiller.cpp1152
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp1937
-rw-r--r--fpdfsdk/src/formfiller/FFL_ListBox.cpp431
-rw-r--r--fpdfsdk/src/formfiller/FFL_Notify.cpp230
-rw-r--r--fpdfsdk/src/formfiller/FFL_PushButton.cpp45
-rw-r--r--fpdfsdk/src/formfiller/FFL_RadioButton.cpp205
-rw-r--r--fpdfsdk/src/formfiller/FFL_TextField.cpp509
-rw-r--r--fpdfsdk/src/formfiller/FFL_Utils.cpp173
11 files changed, 2809 insertions, 3152 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
index 53efe9fe3a..cb6d51939e 100644
--- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
@@ -7,293 +7,280 @@
#include "../../include/formfiller/FormFiller.h"
#include "../../include/formfiller/FFL_CBA_Fontmap.h"
-CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler) :
- CPWL_FontMap(pSystemHandler),
- m_pDocument(NULL),
- m_pAnnotDict(NULL),
- m_pDefaultFont(NULL),
- m_sAPType("N")
-{
- ASSERT(pAnnot != NULL);
-
- CPDF_Page* pPage = pAnnot->GetPDFPage();
-
- m_pDocument = pPage->m_pDocument;
- m_pAnnotDict = pAnnot->GetPDFAnnot()->GetAnnotDict();
+CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
+ IFX_SystemHandler* pSystemHandler)
+ : CPWL_FontMap(pSystemHandler),
+ m_pDocument(NULL),
+ m_pAnnotDict(NULL),
+ m_pDefaultFont(NULL),
+ m_sAPType("N") {
+ ASSERT(pAnnot != NULL);
+
+ CPDF_Page* pPage = pAnnot->GetPDFPage();
+
+ m_pDocument = pPage->m_pDocument;
+ m_pAnnotDict = pAnnot->GetPDFAnnot()->GetAnnotDict();
}
-CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict,
- IFX_SystemHandler* pSystemHandler) :
- CPWL_FontMap(pSystemHandler),
- m_pDocument(pDocument),
- m_pAnnotDict(pAnnotDict),
- m_pDefaultFont(NULL),
- m_sAPType("N")
-{
+CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument,
+ CPDF_Dictionary* pAnnotDict,
+ IFX_SystemHandler* pSystemHandler)
+ : CPWL_FontMap(pSystemHandler),
+ m_pDocument(pDocument),
+ m_pAnnotDict(pAnnotDict),
+ m_pDefaultFont(NULL),
+ m_sAPType("N") {}
+
+CBA_FontMap::~CBA_FontMap() {}
+
+void CBA_FontMap::Reset() {
+ Empty();
+ m_pDefaultFont = NULL;
+ m_sDefaultFontName = "";
}
-CBA_FontMap::~CBA_FontMap()
-{
+void CBA_FontMap::Initial(const FX_CHAR* fontname) {
+ int32_t nCharset = DEFAULT_CHARSET;
+
+ if (!m_pDefaultFont) {
+ m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
+ if (m_pDefaultFont) {
+ if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
+ nCharset = pSubstFont->m_Charset;
+ else {
+ if (m_sDefaultFontName == "Wingdings" ||
+ m_sDefaultFontName == "Wingdings2" ||
+ m_sDefaultFontName == "Wingdings3" ||
+ m_sDefaultFontName == "Webdings")
+ nCharset = SYMBOL_CHARSET;
+ else
+ nCharset = ANSI_CHARSET;
+ }
+ AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
+ AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName);
+ }
+ }
+
+ if (nCharset != ANSI_CHARSET)
+ CPWL_FontMap::Initial(fontname);
}
-void CBA_FontMap::Reset()
-{
- Empty();
- m_pDefaultFont = NULL;
- m_sDefaultFontName = "";
-}
-
-void CBA_FontMap::Initial(const FX_CHAR* fontname)
-{
- int32_t nCharset = DEFAULT_CHARSET;
-
- if (!m_pDefaultFont)
- {
- m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
- if (m_pDefaultFont)
- {
- if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
- nCharset = pSubstFont->m_Charset;
- else
- {
- if (m_sDefaultFontName == "Wingdings" || m_sDefaultFontName == "Wingdings2" ||
- m_sDefaultFontName == "Wingdings3" || m_sDefaultFontName == "Webdings")
- nCharset = SYMBOL_CHARSET;
- else
- nCharset = ANSI_CHARSET;
- }
- AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
- AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName);
- }
- }
-
- if (nCharset != ANSI_CHARSET)
- CPWL_FontMap::Initial(fontname);
-}
+void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
+ const CFX_ByteString& sFontName) {
+ ASSERT(pFont != NULL);
-void CBA_FontMap::SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName)
-{
- ASSERT(pFont != NULL);
+ if (m_pDefaultFont)
+ return;
- if (m_pDefaultFont) return;
+ m_pDefaultFont = pFont;
+ m_sDefaultFontName = sFontName;
- m_pDefaultFont = pFont;
- m_sDefaultFontName = sFontName;
+ // if (m_sDefaultFontName.IsEmpty())
+ // m_sDefaultFontName = pFont->GetFontTypeName();
-// if (m_sDefaultFontName.IsEmpty())
-// m_sDefaultFontName = pFont->GetFontTypeName();
-
- int32_t nCharset = DEFAULT_CHARSET;
- if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
- nCharset = pSubstFont->m_Charset;
- AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
+ int32_t nCharset = DEFAULT_CHARSET;
+ if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
+ nCharset = pSubstFont->m_Charset;
+ AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
}
-CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset)
-{
- ASSERT(m_pAnnotDict != NULL);
+CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
+ int32_t nCharset) {
+ ASSERT(m_pAnnotDict != NULL);
- if (m_pAnnotDict->GetString("Subtype") == "Widget")
- {
- CPDF_Document* pDocument = GetDocument();
- ASSERT(pDocument != NULL);
+ if (m_pAnnotDict->GetString("Subtype") == "Widget") {
+ CPDF_Document* pDocument = GetDocument();
+ ASSERT(pDocument != NULL);
- CPDF_Dictionary * pRootDict = pDocument->GetRoot();
- if (!pRootDict) return NULL;
+ CPDF_Dictionary* pRootDict = pDocument->GetRoot();
+ if (!pRootDict)
+ return NULL;
- CPDF_Dictionary* pAcroFormDict = pRootDict->GetDict("AcroForm");
- if (!pAcroFormDict) return NULL;
+ CPDF_Dictionary* pAcroFormDict = pRootDict->GetDict("AcroForm");
+ if (!pAcroFormDict)
+ return NULL;
- CPDF_Dictionary * pDRDict = pAcroFormDict->GetDict("DR");
- if (!pDRDict) return NULL;
+ CPDF_Dictionary* pDRDict = pAcroFormDict->GetDict("DR");
+ if (!pDRDict)
+ return NULL;
- return FindResFontSameCharset(pDRDict, sFontAlias, nCharset);
- }
+ return FindResFontSameCharset(pDRDict, sFontAlias, nCharset);
+ }
- return NULL;
+ return NULL;
}
-CPDF_Document* CBA_FontMap::GetDocument()
-{
- return m_pDocument;
+CPDF_Document* CBA_FontMap::GetDocument() {
+ return m_pDocument;
}
-CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,
- int32_t nCharset)
-{
- if (!pResDict) return NULL;
-
- CPDF_Document* pDocument = GetDocument();
- ASSERT(pDocument != NULL);
-
- CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
- if (pFonts == NULL) return NULL;
-
- CPDF_Font* pFind = NULL;
-
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos)
- {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey;
- pObj = pFonts->GetNextElement(pos, csKey);
- if (pObj == NULL) continue;
-
- CPDF_Object* pDirect = pObj->GetDirect();
- if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) continue;
-
- CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
- if (pElement->GetString("Type") != "Font") continue;
-
- CPDF_Font* pFont = pDocument->LoadFont(pElement);
- if (pFont == NULL) continue;
- const CFX_SubstFont* pSubst = pFont->GetSubstFont();
- if (pSubst == NULL) continue;
- if (pSubst->m_Charset == nCharset)
- {
- sFontAlias = csKey;
- pFind = pFont;
- }
- }
- return pFind;
+CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
+ CFX_ByteString& sFontAlias,
+ int32_t nCharset) {
+ if (!pResDict)
+ return NULL;
+
+ CPDF_Document* pDocument = GetDocument();
+ ASSERT(pDocument != NULL);
+
+ CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
+ if (pFonts == NULL)
+ return NULL;
+
+ CPDF_Font* pFind = NULL;
+
+ FX_POSITION pos = pFonts->GetStartPos();
+ while (pos) {
+ CPDF_Object* pObj = NULL;
+ CFX_ByteString csKey;
+ pObj = pFonts->GetNextElement(pos, csKey);
+ if (pObj == NULL)
+ continue;
+
+ CPDF_Object* pDirect = pObj->GetDirect();
+ if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY)
+ continue;
+
+ CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
+ if (pElement->GetString("Type") != "Font")
+ continue;
+
+ CPDF_Font* pFont = pDocument->LoadFont(pElement);
+ if (pFont == NULL)
+ continue;
+ const CFX_SubstFont* pSubst = pFont->GetSubstFont();
+ if (pSubst == NULL)
+ continue;
+ if (pSubst->m_Charset == nCharset) {
+ sFontAlias = csKey;
+ pFind = pFont;
+ }
+ }
+ return pFind;
}
-void CBA_FontMap::AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias)
-{
- AddFontToAnnotDict(pFont, sFontAlias);
+void CBA_FontMap::AddedFont(CPDF_Font* pFont,
+ const CFX_ByteString& sFontAlias) {
+ AddFontToAnnotDict(pFont, sFontAlias);
}
-void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias)
-{
- if (!pFont) return;
-
- ASSERT(m_pAnnotDict != NULL);
- ASSERT(m_pDocument != NULL);
-
- CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP");
-
- if (pAPDict == NULL)
- {
- pAPDict = FX_NEW CPDF_Dictionary;
- m_pAnnotDict->SetAt("AP", pAPDict);
- }
-
- //to avoid checkbox and radiobutton
- CPDF_Object* pObject = pAPDict->GetElement(m_sAPType);
- if (pObject && pObject->GetType() == PDFOBJ_DICTIONARY)
- return;
-
- CPDF_Stream* pStream = pAPDict->GetStream(m_sAPType);
- if (pStream == NULL)
- {
- pStream = new CPDF_Stream(NULL, 0, NULL);
- int32_t objnum = m_pDocument->AddIndirectObject(pStream);
- pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum);
- }
-
- CPDF_Dictionary * pStreamDict = pStream->GetDict();
-
- if (!pStreamDict)
- {
- pStreamDict = FX_NEW CPDF_Dictionary;
- pStream->InitStream(NULL, 0, pStreamDict);
- }
-
- if (pStreamDict)
- {
- CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources");
- if (!pStreamResList)
- {
- pStreamResList = FX_NEW CPDF_Dictionary();
- pStreamDict->SetAt("Resources", pStreamResList);
- }
-
- if (pStreamResList)
- {
- CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font");
- if (!pStreamResFontList)
- {
- pStreamResFontList = new CPDF_Dictionary;
- int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList);
- pStreamResList->SetAtReference("Font", m_pDocument, objnum);
- }
- if (!pStreamResFontList->KeyExist(sAlias))
- pStreamResFontList->SetAtReference(sAlias, m_pDocument, pFont->GetFontDict());
- }
- }
+void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
+ const CFX_ByteString& sAlias) {
+ if (!pFont)
+ return;
+
+ ASSERT(m_pAnnotDict != NULL);
+ ASSERT(m_pDocument != NULL);
+
+ CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP");
+
+ if (pAPDict == NULL) {
+ pAPDict = FX_NEW CPDF_Dictionary;
+ m_pAnnotDict->SetAt("AP", pAPDict);
+ }
+
+ // to avoid checkbox and radiobutton
+ CPDF_Object* pObject = pAPDict->GetElement(m_sAPType);
+ if (pObject && pObject->GetType() == PDFOBJ_DICTIONARY)
+ return;
+
+ CPDF_Stream* pStream = pAPDict->GetStream(m_sAPType);
+ if (pStream == NULL) {
+ pStream = new CPDF_Stream(NULL, 0, NULL);
+ int32_t objnum = m_pDocument->AddIndirectObject(pStream);
+ pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum);
+ }
+
+ CPDF_Dictionary* pStreamDict = pStream->GetDict();
+
+ if (!pStreamDict) {
+ pStreamDict = FX_NEW CPDF_Dictionary;
+ pStream->InitStream(NULL, 0, pStreamDict);
+ }
+
+ if (pStreamDict) {
+ CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources");
+ if (!pStreamResList) {
+ pStreamResList = FX_NEW CPDF_Dictionary();
+ pStreamDict->SetAt("Resources", pStreamResList);
+ }
+
+ if (pStreamResList) {
+ CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font");
+ if (!pStreamResFontList) {
+ pStreamResFontList = new CPDF_Dictionary;
+ int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList);
+ pStreamResList->SetAtReference("Font", m_pDocument, objnum);
+ }
+ if (!pStreamResFontList->KeyExist(sAlias))
+ pStreamResFontList->SetAtReference(sAlias, m_pDocument,
+ pFont->GetFontDict());
+ }
+ }
}
-CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias)
-{
- ASSERT(m_pAnnotDict != NULL);
- ASSERT(m_pDocument != NULL);
-
- CPDF_Dictionary* pAcroFormDict = NULL;
-
- FX_BOOL bWidget = (m_pAnnotDict->GetString("Subtype") == "Widget");
-
- if (bWidget)
- {
- if (CPDF_Dictionary * pRootDict = m_pDocument->GetRoot())
- pAcroFormDict = pRootDict->GetDict("AcroForm");
- }
-
- CFX_ByteString sDA;
- CPDF_Object* pObj;
- if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA")))
- sDA = pObj->GetString();
-
- if (bWidget)
- {
- if (sDA.IsEmpty())
- {
- pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA");
- sDA = pObj ? pObj->GetString() : CFX_ByteString();
- }
- }
-
- CPDF_Dictionary * pFontDict = NULL;
-
- if (!sDA.IsEmpty())
- {
- CPDF_SimpleParser syntax(sDA);
- syntax.FindTagParam("Tf", 2);
- CFX_ByteString sFontName = syntax.GetWord();
- sAlias = PDF_NameDecode(sFontName).Mid(1);
-
- if (CPDF_Dictionary * pDRDict = m_pAnnotDict->GetDict("DR"))
- if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
- pFontDict = pDRFontDict->GetDict(sAlias);
-
- if (!pFontDict)
- if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP"))
- if (CPDF_Dictionary* pNormalDict = pAPDict->GetDict("N"))
- if (CPDF_Dictionary* pNormalResDict = pNormalDict->GetDict("Resources"))
- if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDict("Font"))
- pFontDict = pResFontDict->GetDict(sAlias);
-
- if (bWidget)
- {
- if (!pFontDict)
- {
- if (pAcroFormDict)
- {
- if (CPDF_Dictionary * pDRDict = pAcroFormDict->GetDict("DR"))
- if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
- pFontDict = pDRFontDict->GetDict(sAlias);
- }
- }
- }
- }
-
- return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
+CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
+ ASSERT(m_pAnnotDict != NULL);
+ ASSERT(m_pDocument != NULL);
+
+ CPDF_Dictionary* pAcroFormDict = NULL;
+
+ FX_BOOL bWidget = (m_pAnnotDict->GetString("Subtype") == "Widget");
+
+ if (bWidget) {
+ if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot())
+ pAcroFormDict = pRootDict->GetDict("AcroForm");
+ }
+
+ CFX_ByteString sDA;
+ CPDF_Object* pObj;
+ if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA")))
+ sDA = pObj->GetString();
+
+ if (bWidget) {
+ if (sDA.IsEmpty()) {
+ pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA");
+ sDA = pObj ? pObj->GetString() : CFX_ByteString();
+ }
+ }
+
+ CPDF_Dictionary* pFontDict = NULL;
+
+ if (!sDA.IsEmpty()) {
+ CPDF_SimpleParser syntax(sDA);
+ syntax.FindTagParam("Tf", 2);
+ CFX_ByteString sFontName = syntax.GetWord();
+ sAlias = PDF_NameDecode(sFontName).Mid(1);
+
+ if (CPDF_Dictionary* pDRDict = m_pAnnotDict->GetDict("DR"))
+ if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
+ pFontDict = pDRFontDict->GetDict(sAlias);
+
+ if (!pFontDict)
+ if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP"))
+ if (CPDF_Dictionary* pNormalDict = pAPDict->GetDict("N"))
+ if (CPDF_Dictionary* pNormalResDict =
+ pNormalDict->GetDict("Resources"))
+ if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDict("Font"))
+ pFontDict = pResFontDict->GetDict(sAlias);
+
+ if (bWidget) {
+ if (!pFontDict) {
+ if (pAcroFormDict) {
+ if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDict("DR"))
+ if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
+ pFontDict = pDRFontDict->GetDict(sAlias);
+ }
+ }
+ }
+ }
+
+ return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
-void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType)
-{
- m_sAPType = sAPType;
+void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
+ m_sAPType = sAPType;
- Reset();
- Initial();
+ Reset();
+ Initial();
}
-
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
index 55d2d45bc2..42c6251d68 100644
--- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
@@ -8,137 +8,122 @@
#include "../../include/formfiller/FFL_FormFiller.h"
#include "../../include/formfiller/FFL_CheckBox.h"
+/* ------------------------------- CFFL_CheckBox -------------------------------
+ */
-/* ------------------------------- CFFL_CheckBox ------------------------------- */
+CFFL_CheckBox::CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget)
+ : CFFL_Button(pApp, pWidget) {}
-CFFL_CheckBox::CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget) :
- CFFL_Button(pApp, pWidget)
-{
-}
-
-CFFL_CheckBox::~CFFL_CheckBox()
-{
-}
+CFFL_CheckBox::~CFFL_CheckBox() {}
-CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
-{
- CPWL_CheckBox* pWnd = new CPWL_CheckBox();
- pWnd->Create(cp);
+CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) {
+ CPWL_CheckBox* pWnd = new CPWL_CheckBox();
+ pWnd->Create(cp);
- ASSERT(m_pWidget != NULL);
- pWnd->SetCheck(m_pWidget->IsChecked());
+ ASSERT(m_pWidget != NULL);
+ pWnd->SetCheck(m_pWidget->IsChecked());
- return pWnd;
+ return pWnd;
}
-FX_BOOL CFFL_CheckBox::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags)
-{
- switch (nKeyCode)
- {
- case FWL_VKEY_Return:
- case FWL_VKEY_Space:
- return TRUE;
- default:
- return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags);
- }
+FX_BOOL CFFL_CheckBox::OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags) {
+ switch (nKeyCode) {
+ case FWL_VKEY_Return:
+ case FWL_VKEY_Space:
+ return TRUE;
+ default:
+ return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags);
+ }
}
-FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- switch (nChar)
- {
- case FWL_VKEY_Return:
- case FWL_VKEY_Space:
- {
- CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
- ASSERT(pIFormFiller != NULL);
-
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- ASSERT(pPageView != NULL);
-
- FX_BOOL bReset = FALSE;
- FX_BOOL bExit = FALSE;
-
- pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit,nFlags);
-
- if (bReset) return TRUE;
- if (bExit) return TRUE;
-
- CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
-
- if (CPWL_CheckBox * pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE))
- pWnd->SetCheck(!pWnd->IsChecked());
-
- CommitData(pPageView,nFlags);
- return TRUE;
- }
- default:
- return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
- }
+FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ switch (nChar) {
+ case FWL_VKEY_Return:
+ case FWL_VKEY_Space: {
+ CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+ ASSERT(pIFormFiller != NULL);
+
+ CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ ASSERT(pPageView != NULL);
+
+ FX_BOOL bReset = FALSE;
+ FX_BOOL bExit = FALSE;
+
+ pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit, nFlags);
+
+ if (bReset)
+ return TRUE;
+ if (bExit)
+ return TRUE;
+
+ CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+
+ if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE))
+ pWnd->SetCheck(!pWnd->IsChecked());
+
+ CommitData(pPageView, nFlags);
+ return TRUE;
+ }
+ default:
+ return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+ }
}
-FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
+FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
- if (IsValid())
- {
- if (CPWL_CheckBox * pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE))
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- pWnd->SetCheck(!pWidget->IsChecked());
- // pWnd->SetCheck(!pWnd->IsChecked());
- }
+ if (IsValid()) {
+ 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)) return FALSE;
- }
+ if (!CommitData(pPageView, nFlags))
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
-FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView)
-{
+FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
- ASSERT(m_pWidget != NULL);
+ if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) {
+ return pWnd->IsChecked() != m_pWidget->IsChecked();
+ }
- if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->IsChecked() != m_pWidget->IsChecked();
- }
-
- return FALSE;
+ return FALSE;
}
-void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView)
-{
-
- ASSERT(m_pWidget != NULL);
-
- if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE))
- {
-
- FX_BOOL bNewChecked = pWnd->IsChecked();
-
-
- if (bNewChecked)
- {
- CPDF_FormField* pField = m_pWidget->GetFormField();
- ASSERT(pField != NULL);
-
- for (int32_t i=0,sz=pField->CountControls(); i<sz; i++)
- {
- if (CPDF_FormControl* pCtrl = pField->GetControl(i))
- {
- if (pCtrl->IsChecked())
- {
- break;
- }
- }
- }
- }
-
- m_pWidget->SetCheck(bNewChecked, FALSE);
- m_pWidget->UpdateField();
- SetChangeMark();
- }
-
+void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
+
+ if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) {
+ FX_BOOL bNewChecked = pWnd->IsChecked();
+
+ if (bNewChecked) {
+ CPDF_FormField* pField = m_pWidget->GetFormField();
+ ASSERT(pField != NULL);
+
+ for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) {
+ if (CPDF_FormControl* pCtrl = pField->GetControl(i)) {
+ if (pCtrl->IsChecked()) {
+ break;
+ }
+ }
+ }
+ }
+
+ m_pWidget->SetCheck(bNewChecked, FALSE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
+ }
}
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
index 96574d66cb..1477e24c44 100644
--- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
@@ -10,409 +10,358 @@
#include "../../include/formfiller/FFL_CBA_Fontmap.h"
#include "../../include/formfiller/FFL_ComboBox.h"
-
-/* ------------------------------- CFFL_ComboBox ------------------------------- */
-
-CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) :
- CFFL_FormFiller(pApp, pAnnot), m_pFontMap( NULL )
-{
- m_State.nIndex = 0;
- m_State.nStart = 0;
- m_State.nEnd = 0;
+/* ------------------------------- CFFL_ComboBox -------------------------------
+ */
+
+CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
+ : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
+ m_State.nIndex = 0;
+ m_State.nStart = 0;
+ m_State.nEnd = 0;
}
-CFFL_ComboBox::~CFFL_ComboBox()
-{
- delete m_pFontMap;
+CFFL_ComboBox::~CFFL_ComboBox() {
+ delete m_pFontMap;
}
-PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam()
-{
- PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
+PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() {
+ PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
- ASSERT(m_pWidget != NULL);
+ ASSERT(m_pWidget != NULL);
- int nFlags = m_pWidget->GetFieldFlags();
+ int nFlags = m_pWidget->GetFieldFlags();
- if (nFlags & FIELDFLAG_EDIT)
- {
- cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT;
- }
+ if (nFlags & FIELDFLAG_EDIT) {
+ cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT;
+ }
- if (!m_pFontMap)
- {
- m_pFontMap = new CBA_FontMap(m_pWidget, GetSystemHandler());
- m_pFontMap->Initial();
- }
+ if (!m_pFontMap) {
+ m_pFontMap = new CBA_FontMap(m_pWidget, GetSystemHandler());
+ m_pFontMap->Initial();
+ }
- cp.pFontMap = m_pFontMap;
- cp.pFocusHandler = this;
+ cp.pFontMap = m_pFontMap;
+ cp.pFocusHandler = this;
- return cp;
+ return cp;
}
-CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
-{
- CPWL_ComboBox * pWnd = new CPWL_ComboBox();
- pWnd->AttachFFLData(this);
- pWnd->Create(cp);
-
- CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller();
- pWnd->SetFillerNotify(pFormFiller);
-
- int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
- CFX_WideString swText;
- if (nCurSel < 0)
- swText = m_pWidget->GetValue();
- else
- swText = m_pWidget->GetOptionLabel(nCurSel);
-
- for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
- {
- pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
- }
-
- pWnd->SetSelect(nCurSel);
- pWnd->SetText(swText.c_str());
- return pWnd;
+CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) {
+ CPWL_ComboBox* pWnd = new CPWL_ComboBox();
+ pWnd->AttachFFLData(this);
+ pWnd->Create(cp);
+
+ CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller();
+ pWnd->SetFillerNotify(pFormFiller);
+
+ int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
+ CFX_WideString swText;
+ if (nCurSel < 0)
+ swText = m_pWidget->GetValue();
+ else
+ swText = m_pWidget->GetOptionLabel(nCurSel);
+
+ for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) {
+ pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
+ }
+
+ pWnd->SetSelect(nCurSel);
+ pWnd->SetText(swText.c_str());
+ return pWnd;
}
-
-FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
}
-FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView)
-{
- CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE);
- if (!pWnd)
- return FALSE;
+FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
+ CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE);
+ if (!pWnd)
+ return FALSE;
- int32_t nCurSel = pWnd->GetSelect();
- if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT))
- return nCurSel != m_pWidget->GetSelectedIndex(0);
+ int32_t nCurSel = pWnd->GetSelect();
+ if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT))
+ return nCurSel != m_pWidget->GetSelectedIndex(0);
- if (nCurSel >= 0)
- return nCurSel != m_pWidget->GetSelectedIndex(0);
+ if (nCurSel >= 0)
+ return nCurSel != m_pWidget->GetSelectedIndex(0);
- return pWnd->GetText() != m_pWidget->GetValue();
+ return pWnd->GetText() != m_pWidget->GetValue();
}
-void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView)
-{
- ASSERT(m_pWidget != NULL);
-
- 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;
+void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
- CFX_WideString sOldValue;
+ 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 (bSetValue)
- {
- sOldValue = m_pWidget->GetValue();
- m_pWidget->SetValue(swText, FALSE);
- }
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) {
+ if (nCurSel >= 0) {
+ if (swText != m_pWidget->GetOptionLabel(nCurSel))
+ bSetValue = TRUE;
else
- {
- m_pWidget->GetSelectedIndex(0);
- m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE);
- }
-
- m_pWidget->ResetFieldAppearance(TRUE);
- m_pWidget->UpdateField();
- SetChangeMark();
-
- m_pWidget->GetPDFPage();
+ 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);
+ }
+ m_pWidget->ResetFieldAppearance(TRUE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
- }
+ m_pWidget->GetPDFPage();
+ }
}
- void CFFL_ComboBox::GetActionData( CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, PDFSDK_FieldAction& fa)
-{
- switch (type)
- {
+void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa) {
+ switch (type) {
case CPDF_AAction::KeyStroke:
- if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE))
- {
- if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
- {
- fa.bFieldFull = pEdit->IsTextFull();
- int nSelStart = 0;
- int nSelEnd = 0;
- pEdit->GetSel(nSelStart, nSelEnd);
- fa.nSelEnd = nSelEnd;
- fa.nSelStart = nSelStart;
- fa.sValue = pEdit->GetText();
- fa.sChangeEx = GetSelectExportText();
-
- if (fa.bFieldFull)
- {
- fa.sChange = L"";
- fa.sChangeEx = L"";
- }
- }
+ if (CPWL_ComboBox* pComboBox =
+ (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) {
+ fa.bFieldFull = pEdit->IsTextFull();
+ int nSelStart = 0;
+ int nSelEnd = 0;
+ pEdit->GetSel(nSelStart, nSelEnd);
+ fa.nSelEnd = nSelEnd;
+ fa.nSelStart = nSelStart;
+ fa.sValue = pEdit->GetText();
+ fa.sChangeEx = GetSelectExportText();
+
+ if (fa.bFieldFull) {
+ fa.sChange = L"";
+ fa.sChangeEx = L"";
+ }
}
- break;
+ }
+ break;
case CPDF_AAction::Validate:
- if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE))
- {
- if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
- {
- fa.sValue = pEdit->GetText();
- }
+ if (CPWL_ComboBox* pComboBox =
+ (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) {
+ fa.sValue = pEdit->GetText();
}
- break;
+ }
+ break;
case CPDF_AAction::LoseFocus:
case CPDF_AAction::GetFocus:
- ASSERT(m_pWidget != NULL);
- fa.sValue = m_pWidget->GetValue();
- break;
+ ASSERT(m_pWidget != NULL);
+ fa.sValue = m_pWidget->GetValue();
+ break;
default:
- break;
- }
+ break;
+ }
}
-
-
-void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa)
-{
- switch (type)
- {
+void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa) {
+ switch (type) {
case CPDF_AAction::KeyStroke:
- if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE))
- {
- if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
- {
- pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
- pEdit->ReplaceSel(fa.sChange.c_str());
- }
+ if (CPWL_ComboBox* pComboBox =
+ (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) {
+ pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
+ pEdit->ReplaceSel(fa.sChange.c_str());
}
- break;
+ }
+ break;
default:
- break;
- }
+ break;
+ }
}
-FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew)
-{
- switch (type)
- {
+FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew) {
+ switch (type) {
case CPDF_AAction::KeyStroke:
- return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nSelStart != faNew.nSelStart ||
- faOld.sChange != faNew.sChange;
+ return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) ||
+ faOld.nSelStart != faNew.nSelStart ||
+ faOld.sChange != faNew.sChange;
default:
- break;
- }
+ break;
+ }
- return FALSE;
+ return FALSE;
}
-void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView)
-{
- ASSERT(pPageView != NULL);
+void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) {
+ ASSERT(pPageView != NULL);
- if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE))
- {
- m_State.nIndex = pComboBox->GetSelect();
+ if (CPWL_ComboBox* pComboBox =
+ (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
+ m_State.nIndex = pComboBox->GetSelect();
- if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
- {
- pEdit->GetSel(m_State.nStart, m_State.nEnd);
- m_State.sValue = pEdit->GetText();
- }
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) {
+ pEdit->GetSel(m_State.nStart, m_State.nEnd);
+ m_State.sValue = pEdit->GetText();
}
+ }
}
-void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView)
-{
- ASSERT(pPageView != NULL);
-
- if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, TRUE))
- {
- if (m_State.nIndex >= 0)
- pComboBox->SetSelect(m_State.nIndex);
- else
- {
- if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
- {
- pEdit->SetText(m_State.sValue.c_str());
- pEdit->SetSel(m_State.nStart, m_State.nEnd);
- }
- }
+void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) {
+ ASSERT(pPageView != NULL);
+
+ if (CPWL_ComboBox* pComboBox =
+ (CPWL_ComboBox*)GetPDFWindow(pPageView, TRUE)) {
+ if (m_State.nIndex >= 0)
+ pComboBox->SetSelect(m_State.nIndex);
+ else {
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) {
+ pEdit->SetText(m_State.sValue.c_str());
+ pEdit->SetSel(m_State.nStart, m_State.nEnd);
+ }
}
+ }
}
-CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue)
-{
- if (bRestoreValue)
- SaveState(pPageView);
+CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue) {
+ if (bRestoreValue)
+ SaveState(pPageView);
- DestroyPDFWindow(pPageView);
+ DestroyPDFWindow(pPageView);
- CPWL_Wnd* pRet = NULL;
+ CPWL_Wnd* pRet = NULL;
- if (bRestoreValue)
- {
- RestoreState(pPageView);
- pRet = GetPDFWindow(pPageView, FALSE);
- }
- else
- pRet = GetPDFWindow(pPageView, TRUE);
+ if (bRestoreValue) {
+ RestoreState(pPageView);
+ pRet = GetPDFWindow(pPageView, FALSE);
+ } else
+ pRet = GetPDFWindow(pPageView, TRUE);
- m_pWidget->UpdateField();
+ m_pWidget->UpdateField();
- return pRet;
+ return pRet;
}
-void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag)
-{
- ASSERT(m_pWidget != NULL);
+void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) {
+ ASSERT(m_pWidget != NULL);
- int nFlags = m_pWidget->GetFieldFlags();
+ int nFlags = m_pWidget->GetFieldFlags();
- if (nFlags & FIELDFLAG_COMMITONSELCHANGE)
- {
- if (m_bValid)
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
+ if (nFlags & FIELDFLAG_COMMITONSELCHANGE) {
+ if (m_bValid) {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
- if (CommitData(pPageView, nFlag))
- {
- DestroyPDFWindow(pPageView);
- m_bValid = FALSE;
- }
- }
+ if (CommitData(pPageView, nFlag)) {
+ DestroyPDFWindow(pPageView);
+ m_bValid = FALSE;
+ }
}
+ }
}
-FX_BOOL CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView)
-{
- if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE))
- {
- if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
- {
- return pEdit->IsTextFull();
- }
- }
-
- return FALSE;
+FX_BOOL CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) {
+ if (CPWL_ComboBox* pComboBox =
+ (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) {
+ return pEdit->IsTextFull();
+ }
+ }
+
+ return FALSE;
}
-void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd)
-{
- ASSERT(m_pApp != NULL);
+void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) {
+ ASSERT(m_pApp != NULL);
- ASSERT(pWnd != NULL);
+ ASSERT(pWnd != NULL);
- if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT)
- {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(134);
- pEdit->SetCodePage(936);
+ 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->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);
- }
+ pEdit->SetEditNotify(this);
+ }
}
-void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd)
-{
- ASSERT(m_pApp != NULL);
+void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd) {
+ ASSERT(m_pApp != NULL);
}
-FX_BOOL CFFL_ComboBox::CanCopy(CPDFSDK_Document* pDocument)
-{
- ASSERT(pDocument != NULL);
+FX_BOOL CFFL_ComboBox::CanCopy(CPDFSDK_Document* pDocument) {
+ ASSERT(pDocument != NULL);
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_ComboBox::CanCut(CPDFSDK_Document* pDocument)
-{
- ASSERT(pDocument != NULL);
+FX_BOOL CFFL_ComboBox::CanCut(CPDFSDK_Document* pDocument) {
+ ASSERT(pDocument != NULL);
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_ComboBox::CanPaste(CPDFSDK_Document* pDocument)
-{
- ASSERT(pDocument != NULL);
+FX_BOOL CFFL_ComboBox::CanPaste(CPDFSDK_Document* pDocument) {
+ ASSERT(pDocument != NULL);
- return FALSE;
+ return FALSE;
}
-void CFFL_ComboBox::DoCopy(CPDFSDK_Document* pDocument)
-{
- ASSERT(pDocument != NULL);
+void CFFL_ComboBox::DoCopy(CPDFSDK_Document* pDocument) {
+ ASSERT(pDocument != NULL);
}
-void CFFL_ComboBox::DoCut(CPDFSDK_Document* pDocument)
-{
- ASSERT(pDocument != NULL);
+void CFFL_ComboBox::DoCut(CPDFSDK_Document* pDocument) {
+ ASSERT(pDocument != NULL);
}
-void CFFL_ComboBox::DoPaste(CPDFSDK_Document* pDocument)
-{
- ASSERT(pDocument != NULL);
+void CFFL_ComboBox::DoPaste(CPDFSDK_Document* pDocument) {
+ ASSERT(pDocument != NULL);
}
-void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit)
-{
- ASSERT(pEdit != NULL);
+void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) {
+ ASSERT(pEdit != NULL);
}
-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())
- {
- swRet = pFormField->GetOptionValue(nExport);
- if (swRet.IsEmpty())
- swRet = pFormField->GetOptionLabel(nExport);
- }
+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()) {
+ swRet = pFormField->GetOptionValue(nExport);
+ if (swRet.IsEmpty())
+ swRet = pFormField->GetOptionLabel(nExport);
}
+ }
- return swRet;
+ return swRet;
}
diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
index 717d1a57b1..5eef5bc370 100644
--- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
@@ -4,831 +4,763 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
#include "../../include/formfiller/FFL_FormFiller.h"
#include "../../include/formfiller/FFL_Notify.h"
#include "../../include/formfiller/FFL_CBA_Fontmap.h"
-#define GetRed(rgb) ((uint8_t)(rgb))
-#define GetGreen(rgb) ((uint8_t)(((FX_WORD)(rgb)) >> 8))
-#define GetBlue(rgb) ((uint8_t)((rgb)>>16))
+#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
+#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)
-{
- m_pWidget = (CPDFSDK_Widget*) pAnnot;
-}
-
-CFFL_FormFiller::~CFFL_FormFiller()
-{
- for (auto& it : m_Maps) {
- CPWL_Wnd* pWnd = it.second;
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData();
- pWnd->Destroy();
- delete pWnd;
- delete pData;
- }
- m_Maps.clear();
+CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp,
+ CPDFSDK_Annot* pAnnot)
+ : m_pApp(pApp), m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0, 0) {
+ m_pWidget = (CPDFSDK_Widget*)pAnnot;
}
-void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow)
-{
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE);
- }
+CFFL_FormFiller::~CFFL_FormFiller() {
+ for (auto& it : m_Maps) {
+ CPWL_Wnd* pWnd = it.second;
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData();
+ pWnd->Destroy();
+ delete pWnd;
+ delete pData;
+ }
+ m_Maps.clear();
}
-CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView)
-{
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->GetWindowRect();
- }
-
- return CPDF_Rect(0,0,0,0);
+void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView,
+ const CPDF_Rect& rcWindow) {
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE);
+ }
}
-FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
-{
- ASSERT(pPageView != NULL);
- ASSERT(pAnnot != NULL);
+CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) {
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ return pWnd->GetWindowRect();
+ }
- CPDF_Rect rcAnnot = m_pWidget->GetRect();
+ return CPDF_Rect(0, 0, 0, 0);
+}
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- CPDF_Rect rcWindow = pWnd->GetWindowRect();
- rcAnnot = PWLtoFFL(rcWindow);
- }
+FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ ASSERT(pPageView != NULL);
+ ASSERT(pAnnot != NULL);
- CPDF_Rect rcWin = rcAnnot;
+ CPDF_Rect rcAnnot = m_pWidget->GetRect();
- CPDF_Rect rcFocus = GetFocusBox(pPageView);
- if (!rcFocus.IsEmpty())
- rcWin.Union(rcFocus);
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ CPDF_Rect rcWindow = pWnd->GetWindowRect();
+ rcAnnot = PWLtoFFL(rcWindow);
+ }
- CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin,1);
+ CPDF_Rect rcWin = rcAnnot;
- return rect.GetOutterRect();
-}
+ CPDF_Rect rcFocus = GetFocusBox(pPageView);
+ if (!rcFocus.IsEmpty())
+ rcWin.Union(rcFocus);
-void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags)
-{
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin, 1);
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- CPDF_Matrix mt = GetCurMatrix();
- mt.Concat(*pUser2Device);
- pWnd->DrawAppearance(pDevice,&mt);
- }
- else
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (CFFL_IFormFiller::IsVisible(pWidget))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
- }
+ return rect.GetOutterRect();
}
-void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags)
-{
+void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags) {
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ CPDF_Matrix mt = GetCurMatrix();
+ mt.Concat(*pUser2Device);
+ pWnd->DrawAppearance(pDevice, &mt);
+ } else {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ if (CFFL_IFormFiller::IsVisible(pWidget))
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ }
}
-
-void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot)
-{
+void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
}
-void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot)
-{
-}
+void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {}
-void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot)
-{
-}
+void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {}
-void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
-{
-}
+void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {}
+
+void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {}
-void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
-{
- EndTimer();
- ASSERT(m_pWidget != NULL);
+void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ EndTimer();
+ ASSERT(m_pWidget != NULL);
}
-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);
+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);
- if(!rect.Contains((int)point.x, (int)point.y))
- return FALSE;
+ if (!rect.Contains((int)point.x, (int)point.y))
+ return FALSE;
- return pWnd->OnLButtonDown(WndtoPWL(pPageView, point),nFlags);
- }
+ return pWnd->OnLButtonDown(WndtoPWL(pPageView, point), nFlags);
+ }
- return FALSE;
+ return FALSE;
}
-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);
- return TRUE;
- }
+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);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
-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;
- }
+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;
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y))
- {
- m_ptOldPos = point;
- }
+FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) {
+ m_ptOldPos = point;
+ }
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags);
- return TRUE;
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point)
-{
- if (!IsValid()) return FALSE;
+FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ short zDelta,
+ const CPDF_Point& point) {
+ if (!IsValid())
+ return FALSE;
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE))
- {
- return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFlags);
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) {
+ return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags);
+ }
- return FALSE;
+ return FALSE;
}
-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;
- }
+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;
+ }
- return FALSE;
+ return FALSE;
}
-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;
- }
+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;
+ }
- return FALSE;
+ return FALSE;
}
-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;
- }
+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;
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags)
-{
- if (IsValid())
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
+FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags) {
+ if (IsValid()) {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->OnKeyDown(nKeyCode,nFlags);
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ return pWnd->OnKeyDown(nKeyCode, nFlags);
}
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- if (IsValid())
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
+FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ if (IsValid()) {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->OnChar(nChar,nFlags);
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ return pWnd->OnChar(nChar, nFlags);
}
+ }
- return FALSE;
+ return FALSE;
}
-void CFFL_FormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot)
-{
- ASSERT(FALSE);
+void CFFL_FormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) {
+ ASSERT(FALSE);
}
-void CFFL_FormFiller::OnSelected(CPDFSDK_Annot* pAnnot)
-{
- ASSERT(FALSE);
+void CFFL_FormFiller::OnSelected(CPDFSDK_Annot* pAnnot) {
+ ASSERT(FALSE);
}
-FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
-{
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage();
- CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument();
- CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage);
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
- pWnd->SetFocus();
+FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage();
+ CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument();
+ CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage);
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
+ pWnd->SetFocus();
- m_bValid = TRUE;
- FX_RECT rcRect = GetViewBBox(pPageView,pAnnot);
- InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
- return TRUE;
+ m_bValid = TRUE;
+ FX_RECT rcRect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
+ return TRUE;
}
-FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
-{
- if (!IsValid())
- return TRUE;
+FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
+ if (!IsValid())
+ return TRUE;
- CPDFSDK_PageView* pPageView = GetCurPageView();
- CommitData(pPageView, nFlag);
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ CommitData(pPageView, nFlag);
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- pWnd->KillFocus();
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
+ pWnd->KillFocus();
- switch (m_pWidget->GetFieldType())
- {
+ switch (m_pWidget->GetFieldType()) {
case FIELDTYPE_PUSHBUTTON:
case FIELDTYPE_CHECKBOX:
case FIELDTYPE_RADIOBUTTON:
- EscapeFiller(pPageView, TRUE);
- break;
+ EscapeFiller(pPageView, TRUE);
+ break;
default:
- EscapeFiller(pPageView, FALSE);
- break;
- }
- return TRUE;
+ EscapeFiller(pPageView, FALSE);
+ break;
+ }
+ return TRUE;
}
-FX_BOOL CFFL_FormFiller::IsValid() const
-{
- return m_bValid;
+FX_BOOL CFFL_FormFiller::IsValid() const {
+ return m_bValid;
}
-PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam()
-{
- ASSERT(m_pApp != NULL);
+PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() {
+ ASSERT(m_pApp != NULL);
- PWL_CREATEPARAM cp;
- cp.pParentWnd = NULL;
- cp.pProvider = this;
- cp.rcRectWnd = GetPDFWindowRect();
+ PWL_CREATEPARAM cp;
+ cp.pParentWnd = NULL;
+ cp.pProvider = this;
+ cp.rcRectWnd = GetPDFWindowRect();
- FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE;
- FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags();
- if (dwFieldFlag & FIELDFLAG_READONLY)
- {
- dwCreateFlags |= PWS_READONLY;
- }
+ FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE;
+ FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags();
+ if (dwFieldFlag & FIELDFLAG_READONLY) {
+ dwCreateFlags |= PWS_READONLY;
+ }
- FX_COLORREF color;
- if (m_pWidget->GetFillColor(color))
- {
- cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
- }
+ FX_COLORREF color;
+ if (m_pWidget->GetFillColor(color)) {
+ cp.sBackgroundColor =
+ CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
+ }
- if (m_pWidget->GetBorderColor(color))
- {
- cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
- }
+ if (m_pWidget->GetBorderColor(color)) {
+ cp.sBorderColor =
+ CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
+ }
- cp.sTextColor = CPWL_Color(COLORTYPE_GRAY,0);
+ cp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0);
- if (m_pWidget->GetTextColor(color))
- {
- cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
- }
+ if (m_pWidget->GetTextColor(color)) {
+ cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
+ }
- cp.fFontSize = m_pWidget->GetFontSize();
- cp.dwBorderWidth = m_pWidget->GetBorderWidth();
+ cp.fFontSize = m_pWidget->GetFontSize();
+ cp.dwBorderWidth = m_pWidget->GetBorderWidth();
- int nBorderStyle = m_pWidget->GetBorderStyle();
+ int nBorderStyle = m_pWidget->GetBorderStyle();
- switch (nBorderStyle)
- {
+ switch (nBorderStyle) {
case BBS_SOLID:
- cp.nBorderStyle = PBS_SOLID;
- break;
+ cp.nBorderStyle = PBS_SOLID;
+ break;
case BBS_DASH:
- cp.nBorderStyle = PBS_DASH;
- cp.sDash = CPWL_Dash(3,3,0);
- break;
+ cp.nBorderStyle = PBS_DASH;
+ cp.sDash = CPWL_Dash(3, 3, 0);
+ break;
case BBS_BEVELED:
- cp.nBorderStyle = PBS_BEVELED;
- cp.dwBorderWidth *= 2;
- break;
+ cp.nBorderStyle = PBS_BEVELED;
+ cp.dwBorderWidth *= 2;
+ break;
case BBS_INSET:
- cp.nBorderStyle = PBS_INSET;
- cp.dwBorderWidth *= 2;
- break;
+ cp.nBorderStyle = PBS_INSET;
+ cp.dwBorderWidth *= 2;
+ break;
case BBS_UNDERLINE:
- cp.nBorderStyle = PBS_UNDERLINED;
- break;
- }
+ cp.nBorderStyle = PBS_UNDERLINED;
+ break;
+ }
- if (cp.fFontSize <= 0)
- {
- dwCreateFlags |= PWS_AUTOFONTSIZE;
- }
+ if (cp.fFontSize <= 0) {
+ dwCreateFlags |= PWS_AUTOFONTSIZE;
+ }
- cp.dwFlags = dwCreateFlags;
- cp.pSystemHandler = m_pApp->GetSysHandler();
- return cp;
+ cp.dwFlags = dwCreateFlags;
+ cp.pSystemHandler = m_pApp->GetSysHandler();
+ return cp;
}
-CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew)
-{
- ASSERT(pPageView);
+CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bNew) {
+ ASSERT(pPageView);
- auto it = m_Maps.find(pPageView);
- const bool found = it != m_Maps.end();
- CPWL_Wnd* pWnd = found ? it->second : nullptr;
- if (!bNew)
- return pWnd;
+ auto it = m_Maps.find(pPageView);
+ const bool found = it != m_Maps.end();
+ CPWL_Wnd* pWnd = found ? it->second : nullptr;
+ if (!bNew)
+ return pWnd;
- if (found) {
- CFFL_PrivateData* pPrivateData =
- (CFFL_PrivateData*)pWnd->GetAttachedData();
- if (pPrivateData->nWidgetAge != m_pWidget->GetAppearanceAge()) {
- return ResetPDFWindow(
- pPageView, m_pWidget->GetValueAge() == pPrivateData->nValueAge);
- }
- } else {
- PWL_CREATEPARAM cp = GetCreateParam();
- cp.hAttachedWnd = (FX_HWND)m_pWidget;
+ if (found) {
+ CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pWnd->GetAttachedData();
+ if (pPrivateData->nWidgetAge != m_pWidget->GetAppearanceAge()) {
+ return ResetPDFWindow(
+ pPageView, m_pWidget->GetValueAge() == pPrivateData->nValueAge);
+ }
+ } else {
+ PWL_CREATEPARAM cp = GetCreateParam();
+ cp.hAttachedWnd = (FX_HWND)m_pWidget;
- CFFL_PrivateData* pPrivateData = new CFFL_PrivateData;
- pPrivateData->pWidget = m_pWidget;
- pPrivateData->pPageView = pPageView;
- pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge();
- pPrivateData->nValueAge = 0;
+ CFFL_PrivateData* pPrivateData = new CFFL_PrivateData;
+ pPrivateData->pWidget = m_pWidget;
+ pPrivateData->pPageView = pPageView;
+ pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge();
+ pPrivateData->nValueAge = 0;
- cp.pAttachedData = pPrivateData;
+ cp.pAttachedData = pPrivateData;
- pWnd = NewPDFWindow(cp, pPageView);
- m_Maps[pPageView] = pWnd;
- }
+ pWnd = NewPDFWindow(cp, pPageView);
+ m_Maps[pPageView] = pWnd;
+ }
- return pWnd;
+ return pWnd;
}
-void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView)
-{
- auto it = m_Maps.find(pPageView);
- if (it == m_Maps.end())
- return;
+void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) {
+ auto it = m_Maps.find(pPageView);
+ if (it == m_Maps.end())
+ return;
- CPWL_Wnd* pWnd = it->second;
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData();
- pWnd->Destroy();
- delete pWnd;
- delete pData;
+ CPWL_Wnd* pWnd = it->second;
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData();
+ pWnd->Destroy();
+ delete pWnd;
+ delete pData;
- m_Maps.erase(it);
+ m_Maps.erase(it);
}
-CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData)
-{
- if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData)
- {
- if (pPrivateData->pPageView)
- {
- CPDF_Matrix mtPageView;
- pPrivateData->pPageView->GetCurrentMatrix(mtPageView);
- CPDF_Matrix mt = GetCurMatrix();
- mt.Concat(mtPageView);
+CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) {
+ if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) {
+ if (pPrivateData->pPageView) {
+ CPDF_Matrix mtPageView;
+ pPrivateData->pPageView->GetCurrentMatrix(mtPageView);
+ CPDF_Matrix mt = GetCurMatrix();
+ mt.Concat(mtPageView);
- return mt;
- }
+ return mt;
}
- return CPDF_Matrix(1,0,0,1,0,0);
+ }
+ return CPDF_Matrix(1, 0, 0, 1, 0, 0);
}
-CPDF_Matrix CFFL_FormFiller::GetCurMatrix()
-{
- CPDF_Matrix mt;
-
- ASSERT(m_pWidget != NULL);
+CPDF_Matrix CFFL_FormFiller::GetCurMatrix() {
+ CPDF_Matrix mt;
- CPDF_Rect rcDA ;
- m_pWidget->GetPDFAnnot()->GetRect(rcDA);
+ ASSERT(m_pWidget != NULL);
+ CPDF_Rect rcDA;
+ m_pWidget->GetPDFAnnot()->GetRect(rcDA);
- switch (m_pWidget->GetRotate())
- {
+ switch (m_pWidget->GetRotate()) {
default:
case 0:
- mt = CPDF_Matrix(1,0,0,1,0,0);
- break;
+ mt = CPDF_Matrix(1, 0, 0, 1, 0, 0);
+ break;
case 90:
- mt = CPDF_Matrix(0,1,-1,0,rcDA.right - rcDA.left,0);
- break;
+ mt = CPDF_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0);
+ break;
case 180:
- mt = CPDF_Matrix(-1,0,0,-1,rcDA.right - rcDA.left,rcDA.top - rcDA.bottom);
- break;
+ mt = CPDF_Matrix(-1, 0, 0, -1, rcDA.right - rcDA.left,
+ rcDA.top - rcDA.bottom);
+ break;
case 270:
- mt = CPDF_Matrix(0,-1,1,0,0,rcDA.top - rcDA.bottom);
- break;
- }
- mt.e += rcDA.left;
- mt.f += rcDA.bottom;
+ mt = CPDF_Matrix(0, -1, 1, 0, 0, rcDA.top - rcDA.bottom);
+ break;
+ }
+ mt.e += rcDA.left;
+ mt.f += rcDA.bottom;
- return mt;
+ return mt;
}
-CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex)
-{
- ASSERT(m_pApp != NULL);
+CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) {
+ ASSERT(m_pApp != NULL);
- return L"";
+ return L"";
}
-CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const
-{
- CPDF_Rect rectAnnot;
- m_pWidget->GetPDFAnnot()->GetRect(rectAnnot);
+CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const {
+ CPDF_Rect rectAnnot;
+ m_pWidget->GetPDFAnnot()->GetRect(rectAnnot);
- FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
- FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
- if ((m_pWidget->GetRotate() / 90) & 0x01)
- return CPDF_Rect(0, 0, fHeight, fWidth);
+ FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
+ FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
+ if ((m_pWidget->GetRotate() / 90) & 0x01)
+ return CPDF_Rect(0, 0, fHeight, fWidth);
- return CPDF_Rect(0, 0, fWidth, fHeight);
+ return CPDF_Rect(0, 0, fWidth, fHeight);
}
-CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView()
-{
- CPDFXFA_Page* pPage = m_pAnnot->GetPDFXFAPage();
- CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
- if (!pSDKDoc)
- return NULL;
- return pSDKDoc->GetPageView(pPage);
+CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() {
+ CPDFXFA_Page* pPage = m_pAnnot->GetPDFXFAPage();
+ CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
+ if (!pSDKDoc)
+ return NULL;
+ return pSDKDoc->GetPageView(pPage);
}
-CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView)
-{
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
- CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox();
- if (rcPage.Contains(rcFocus))
- return rcFocus;
- }
- return CPDF_Rect(0,0,0,0);
+CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) {
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
+ CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
+ CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox();
+ if (rcPage.Contains(rcFocus))
+ return rcFocus;
+ }
+ return CPDF_Rect(0, 0, 0, 0);
}
-CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect)
-{
- CPDF_Matrix mt;
- mt.SetReverse(GetCurMatrix());
+CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) {
+ CPDF_Matrix mt;
+ mt.SetReverse(GetCurMatrix());
- CPDF_Rect temp = rect;
- mt.TransformRect(temp);
+ CPDF_Rect temp = rect;
+ mt.TransformRect(temp);
- return temp;
+ return temp;
}
-CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect)
-{
- CPDF_Matrix mt = GetCurMatrix();
+CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) {
+ CPDF_Matrix mt = GetCurMatrix();
- CPDF_Rect temp = rect;
- mt.TransformRect(temp);
+ CPDF_Rect temp = rect;
+ mt.TransformRect(temp);
- return temp;
+ return temp;
}
-CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point)
-{
- CPDF_Matrix mt;
- mt.SetReverse(GetCurMatrix());
+CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point) {
+ CPDF_Matrix mt;
+ mt.SetReverse(GetCurMatrix());
- CPDF_Point pt = point;
- mt.Transform(pt.x,pt.y);
+ CPDF_Point pt = point;
+ mt.Transform(pt.x, pt.y);
- return pt;
+ return pt;
}
-CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point)
-{
- CPDF_Matrix mt = GetCurMatrix();
+CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point& point) {
+ CPDF_Matrix mt = GetCurMatrix();
- CPDF_Point pt = point;
- mt.Transform(pt.x,pt.y);
-
- return pt;
-}
-
-CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt)
-{
- return FFLtoPWL(pt);
-}
-
-CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect & rect)
-{
- return rect;
-}
-
-FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag)
-{
- if (IsDataChanged(pPageView))
- {
- FX_BOOL bRC = TRUE;
- FX_BOOL bExit = FALSE;
- CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
- pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag);
- if (bExit)
- return TRUE;
- if (!bRC)
- {
- ResetPDFWindow(pPageView, FALSE);
- return TRUE;
- }
-
- pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag);
- if (bExit)
- return TRUE;
- if (!bRC)
- {
- ResetPDFWindow(pPageView, FALSE);
- return TRUE;
- }
-
- SaveData(pPageView);
- pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit,nFlag);
- if (bExit)
- return TRUE;
-
- pIFormFiller->OnFormat(m_pWidget, pPageView, bExit,nFlag);
- }
- return TRUE;
-}
+ CPDF_Point pt = point;
+ mt.Transform(pt.x, pt.y);
-FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView)
-{
- return FALSE;
+ return pt;
}
-void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView)
-{
+CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView,
+ const CPDF_Point& pt) {
+ return FFLtoPWL(pt);
}
-FX_BOOL CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView)
-{
- return FALSE;
+CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView,
+ const CPDF_Rect& rect) {
+ return rect;
}
-void CFFL_FormFiller::SetChangeMark()
-{
- m_pApp->FFI_OnChange();
-}
+FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView,
+ FX_UINT nFlag) {
+ if (IsDataChanged(pPageView)) {
+ FX_BOOL bRC = TRUE;
+ FX_BOOL bExit = FALSE;
+ CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+ pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag);
+ if (bExit)
+ return TRUE;
+ if (!bRC) {
+ ResetPDFWindow(pPageView, FALSE);
+ return TRUE;
+ }
-void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa)
-{
- fa.sValue = m_pWidget->GetValue();
-}
+ pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag);
+ if (bExit)
+ return TRUE;
+ if (!bRC) {
+ ResetPDFWindow(pPageView, FALSE);
+ return TRUE;
+ }
-void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa)
-{
-}
+ SaveData(pPageView);
+ pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag);
+ if (bExit)
+ return TRUE;
-FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew)
-{
- return FALSE;
+ pIFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag);
+ }
+ return TRUE;
}
-void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView)
-{
+FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) {
+ return FALSE;
}
-void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView)
-{
-}
+void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {}
-CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue)
-{
- return GetPDFWindow(pPageView, FALSE);
+FX_BOOL CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView) {
+ return FALSE;
}
-void CFFL_FormFiller::TimerProc()
-{
-
+void CFFL_FormFiller::SetChangeMark() {
+ m_pApp->FFI_OnChange();
}
-IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const
-{
- return m_pApp->GetSysHandler();
+void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa) {
+ fa.sValue = m_pWidget->GetValue();
}
-void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown)
-{
+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,
+ const PDFSDK_FieldAction& faNew) {
+ return FALSE;
}
-void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow)
-{
- m_bValid = FALSE;
+void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) {}
- FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget);
- InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
+void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) {}
- if(bDestroyPDFWindow)
- DestroyPDFWindow(pPageView);
+CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue) {
+ return GetPDFWindow(pPageView, FALSE);
}
-FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument)
-{
- return FALSE;
-}
+void CFFL_FormFiller::TimerProc() {}
-FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument)
-{
- return FALSE;
+IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const {
+ return m_pApp->GetSysHandler();
}
-FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument)
-{
- return FALSE;
-}
+void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) {}
-void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument)
-{
-}
+void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView,
+ FX_BOOL bDestroyPDFWindow) {
+ m_bValid = FALSE;
-void CFFL_FormFiller::DoCut(CPDFSDK_Document* pDocument)
-{
-}
+ FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget);
+ InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
-void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument)
-{
+ if (bDestroyPDFWindow)
+ DestroyPDFWindow(pPageView);
}
-void CFFL_FormFiller::InvalidateRect(double left, double top, double right, double bottom)
-{
- CPDFXFA_Page* pPage = m_pWidget->GetPDFXFAPage();
- m_pApp->FFI_Invalidate(pPage, left, top, right, bottom);
+FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-/* ------------------------- CFFL_Button ------------------------- */
-
-CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) :
- CFFL_FormFiller(pApp, pWidget),
- m_bMouseIn(FALSE),
- m_bMouseDown(FALSE)
-{
+FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-CFFL_Button::~CFFL_Button()
-{
+FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-void CFFL_Button::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
-{
- m_bMouseIn = TRUE;
- FX_RECT rect = GetViewBBox(pPageView,pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
-}
+void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument) {}
-void CFFL_Button::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
-{
- m_bMouseIn = FALSE;
+void CFFL_FormFiller::DoCut(CPDFSDK_Document* pDocument) {}
- FX_RECT rect = GetViewBBox(pPageView,pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
- EndTimer();
- ASSERT(m_pWidget != NULL);
+void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument) {}
+
+void CFFL_FormFiller::InvalidateRect(double left,
+ double top,
+ double right,
+ double bottom) {
+ CPDFXFA_Page* pPage = m_pWidget->GetPDFXFAPage();
+ m_pApp->FFI_Invalidate(pPage, left, top, right, bottom);
}
-FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- CPDF_Rect rcAnnot = pAnnot->GetRect();
- if(!rcAnnot.Contains(point.x, point.y))
- return FALSE;
+/* ------------------------- CFFL_Button ------------------------- */
- m_bMouseDown = TRUE;
- m_bValid = TRUE;
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
- return TRUE;
-}
+CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
+ : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {}
-FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- CPDF_Rect rcAnnot = pAnnot->GetRect();
- if(!rcAnnot.Contains(point.x, point.y))
- return FALSE;
+CFFL_Button::~CFFL_Button() {}
- m_bMouseDown = FALSE;
- m_pWidget->GetPDFPage();
+void CFFL_Button::OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ m_bMouseIn = TRUE;
+ FX_RECT rect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+}
+void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ m_bMouseIn = FALSE;
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
- return TRUE;
+ FX_RECT rect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ EndTimer();
+ ASSERT(m_pWidget != NULL);
}
-FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(m_pApp != NULL);
+FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ CPDF_Rect rcAnnot = pAnnot->GetRect();
+ if (!rcAnnot.Contains(point.x, point.y))
+ return FALSE;
- return TRUE;
+ m_bMouseDown = TRUE;
+ m_bValid = TRUE;
+ FX_RECT rect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ return TRUE;
}
-void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags)
-{
- ASSERT(pPageView != NULL);
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- 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
- {
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
- }
+FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ CPDF_Rect rcAnnot = pAnnot->GetRect();
+ if (!rcAnnot.Contains(point.x, point.y))
+ return FALSE;
+
+ m_bMouseDown = FALSE;
+ m_pWidget->GetPDFPage();
+
+ FX_RECT rect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ return TRUE;
+}
+
+FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(m_pApp != NULL);
+
+ return TRUE;
+}
+
+void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags) {
+ ASSERT(pPageView != NULL);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ 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 {
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, 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, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags)
-{
- OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
+void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags) {
+ OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
}
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index bb9316da20..278169e878 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -13,1254 +13,1189 @@
#include "../../include/formfiller/FFL_RadioButton.h"
#include "../../include/formfiller/FFL_TextField.h"
-#define FFL_MAXLISTBOXHEIGHT 140.0f
+#define FFL_MAXLISTBOXHEIGHT 140.0f
// HHOOK CFFL_IFormFiller::m_hookSheet = NULL;
// MSG CFFL_IFormFiller::g_Msg;
-/* ----------------------------- CFFL_IFormFiller ----------------------------- */
+/* ----------------------------- CFFL_IFormFiller -----------------------------
+ */
-CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) :
- m_pApp(pApp),
- m_bNotifying(FALSE)
-{
-}
+CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp)
+ : m_pApp(pApp), m_bNotifying(FALSE) {}
-CFFL_IFormFiller::~CFFL_IFormFiller()
-{
- for (auto& it : m_Maps)
- delete it.second;
- m_Maps.clear();
+CFFL_IFormFiller::~CFFL_IFormFiller() {
+ for (auto& it : m_Maps)
+ delete it.second;
+ m_Maps.clear();
}
-FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point)
-{
- CPDF_Rect rc = pAnnot->GetRect();
- if(rc.Contains(point.x, point.y))
- return TRUE;
- return FALSE;
+FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CPDF_Point point) {
+ CPDF_Rect rc = pAnnot->GetRect();
+ if (rc.Contains(point.x, point.y))
+ return TRUE;
+ return FALSE;
}
-FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot)
-{
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- return pFormFiller->GetViewBBox(pPageView, pAnnot);
+FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
+ return pFormFiller->GetViewBBox(pPageView, pAnnot);
- ASSERT(pPageView != NULL);
+ ASSERT(pPageView != NULL);
- CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
- CPDF_Rect rcAnnot;
- pPDFAnnot->GetRect(rcAnnot);
+ CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
+ CPDF_Rect rcAnnot;
+ pPDFAnnot->GetRect(rcAnnot);
- CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1);
- return rcWin.GetOutterRect();
+ CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1);
+ return rcWin.GetOutterRect();
}
-void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags)
-{
- ASSERT(pPageView != NULL);
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
-
- if (IsVisible(pWidget))
- {
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- if (pFormFiller->IsValid())
- {
- pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
- pAnnot->GetPDFPage();
-
- CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
- if (pDocument->GetFocusAnnot() == pAnnot)
- {
- CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView);
- 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.m_DashArray[0] = 1.0f;
- gsd.m_DashPhase = 0;
- gsd.m_LineWidth = 1.0f;
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE);
- }
- }
- return;
- }
+void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
+ /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow,*/ FX_DWORD dwFlags) {
+ ASSERT(pPageView != NULL);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+
+ if (IsVisible(pWidget)) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ if (pFormFiller->IsValid()) {
+ pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
+ pAnnot->GetPDFPage();
+
+ CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
+ if (pDocument->GetFocusAnnot() == pAnnot) {
+ CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView);
+ 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.m_DashArray[0] = 1.0f;
+ gsd.m_DashPhase = 0;
+ gsd.m_LineWidth = 1.0f;
+ pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
+ ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE);
+ }
}
-
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
-
- if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
- pWidget->DrawShadow(pDevice, pPageView);
+ return;
+ }
}
-}
-void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot)
-{
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- pFormFiller->OnCreate(pAnnot);
- }
-}
+ pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device,
+ dwFlags);
+ else
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
-void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot)
-{
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- pFormFiller->OnLoad(pAnnot);
- }
+ if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
+ pWidget->DrawShadow(pDevice, pPageView);
+ }
}
-void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot)
-{
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- pFormFiller->OnDelete(pAnnot);
- }
+void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnCreate(pAnnot);
+ }
+}
- UnRegisterFormFiller(pAnnot);
+void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnLoad(pAnnot);
+ }
}
-void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnDelete(pAnnot);
+ }
- if (!m_bNotifying)
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (pWidget->GetAAction(CPDF_AAction::CursorEnter))
- {
- m_bNotifying = TRUE;
+ UnRegisterFormFiller(pAnnot);
+}
- int nValueAge = pWidget->GetValueAge();
+void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlag) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- pWidget->ClearAppModified();
+ if (!m_bNotifying) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) {
+ m_bNotifying = TRUE;
- ASSERT(pPageView != NULL);
+ 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;
+ 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 ( !IsValidAnnot(pPageView, pAnnot) ) return;
- if (pWidget->IsAppModified())
- {
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE))
- {
- pFormFiller->ResetPDFWindow(pPageView, pWidget->GetValueAge() == nValueAge);
- }
- }
+ if (pWidget->IsAppModified()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ pWidget->GetValueAge() == nValueAge);
}
+ }
}
+ }
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
- {
- pFormFiller->OnMouseEnter(pPageView, pAnnot);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
+ pFormFiller->OnMouseEnter(pPageView, pAnnot);
+ }
}
-void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
-
- if (!m_bNotifying)
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (pWidget->GetAAction(CPDF_AAction::CursorExit))
- {
- m_bNotifying = TRUE;
- pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
- pWidget->ClearAppModified();
-
- ASSERT(pPageView != NULL);
+void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlag) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ if (!m_bNotifying) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (pWidget->GetAAction(CPDF_AAction::CursorExit)) {
+ m_bNotifying = TRUE;
+ 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);
+ 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;
+ pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView);
+ m_bNotifying = FALSE;
- //if (!IsValidAnnot(pPageView, pAnnot)) return;
+ // if (!IsValidAnnot(pPageView, pAnnot)) return;
- if (pWidget->IsAppModified())
- {
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE))
- {
- pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge());
- }
- }
+ if (pWidget->IsAppModified()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
}
+ }
}
+ }
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- pFormFiller->OnMouseExit(pPageView, pAnnot);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnMouseExit(pPageView, pAnnot);
+ }
}
-FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
-
- if (!m_bNotifying)
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAAction(CPDF_AAction::ButtonDown))
- {
- m_bNotifying = TRUE;
- pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
- pWidget->ClearAppModified();
-
- ASSERT(pPageView != NULL);
-
+FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ if (!m_bNotifying) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (Annot_HitTest(pPageView, pAnnot, point) &&
+ pWidget->GetAAction(CPDF_AAction::ButtonDown)) {
+ m_bNotifying = TRUE;
+ 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;
- 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))
- {
- pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge());
- }
- }
+ if (pWidget->IsAppModified()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
}
+ }
}
+ }
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
+FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
- switch (pWidget->GetFieldType())
- {
+ switch (pWidget->GetFieldType()) {
case FIELDTYPE_PUSHBUTTON:
case FIELDTYPE_CHECKBOX:
case FIELDTYPE_RADIOBUTTON:
- if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y))
- pDocument->SetFocusAnnot(pAnnot);
- break;
- default:
+ if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y))
pDocument->SetFocusAnnot(pAnnot);
- break;
- }
-
- FX_BOOL bRet = FALSE;
-
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
- }
-
- if (pDocument->GetFocusAnnot() == pAnnot)
- {
- FX_BOOL bExit = FALSE;
- FX_BOOL bReset = FALSE;
- OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags);
- if (bExit) return TRUE;
-
- OnClick(pWidget, pPageView, bReset, bExit, nFlags);
- if (bExit) return TRUE;
- }
- return bRet;
+ break;
+ default:
+ pDocument->SetFocusAnnot(pAnnot);
+ break;
+ }
+
+ FX_BOOL bRet = FALSE;
+
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
+ }
+
+ if (pDocument->GetFocusAnnot() == pAnnot) {
+ FX_BOOL bExit = FALSE;
+ FX_BOOL bReset = FALSE;
+ OnButtonUp(pWidget, pPageView, bReset, bExit, nFlags);
+ if (bExit)
+ return TRUE;
+
+ OnClick(pWidget, pPageView, bReset, bExit, nFlags);
+ if (bExit)
+ return TRUE;
+ }
+ return bRet;
}
-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))
- {
- m_bNotifying = TRUE;
- int nAge = pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
+void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag) {
+ ASSERT(pWidget != NULL);
- ASSERT(pPageView != NULL);
-// CReader_DocView* pDocView = pPageView->GetDocView();
-// ASSERT(pDocView != NULL);
+ if (!m_bNotifying) {
+ if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) {
+ 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);
- 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;
- 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());
- }
+ if (!IsValidAnnot(pPageView, pWidget)) {
+ bExit = TRUE;
+ return;
+ }
- bReset = TRUE;
- }
+ if (nAge != pWidget->GetAppearanceAge()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
}
+
+ bReset = TRUE;
+ }
}
+ }
}
-FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- //change cursor
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
- {
- return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
- }
+ // change cursor
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
+ return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ short zDelta,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, point);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, point);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (nChar == FWL_VKEY_Tab)
- return TRUE;
+FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ if (nChar == FWL_VKEY_Tab)
+ return TRUE;
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- return pFormFiller->OnChar(pAnnot, nChar, nFlags);
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
+ return pFormFiller->OnChar(pAnnot, nChar, nFlags);
- return FALSE;
+ return FALSE;
}
-void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- pFormFiller->OnDeSelected(pAnnot);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnDeSelected(pAnnot);
+ }
}
-void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot)
-{
- ASSERT(pAnnot != NULL);
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot) {
+ ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- pFormFiller->OnSelected(pAnnot);
- }
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ pFormFiller->OnSelected(pAnnot);
+ }
}
-FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
-{
- if (!pAnnot)
- return FALSE;
+FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
+ if (!pAnnot)
+ return FALSE;
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (!m_bNotifying)
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (pWidget->GetAAction(CPDF_AAction::GetFocus))
- {
- m_bNotifying = TRUE;
- 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 (pWidget->IsAppModified())
- {
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE))
- {
- pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge());
- }
- }
- }
- }
+ if (!m_bNotifying) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (pWidget->GetAAction(CPDF_AAction::GetFocus)) {
+ m_bNotifying = TRUE;
+ pWidget->GetAppearanceAge();
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
- return pFormFiller->OnSetFocus(pAnnot, nFlag);
+ int nValueAge = pWidget->GetValueAge();
+ pWidget->ClearAppModified();
- return TRUE;
-}
+ CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ ASSERT(pPageView != NULL);
-FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
-{
- if(!pAnnot) return FALSE;
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
- {
- if (pFormFiller->OnKillFocus(pAnnot, nFlag))
- {
- if (!m_bNotifying)
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (pWidget->GetAAction(CPDF_AAction::LoseFocus))
- {
- 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;
-
- }
- }
+ 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 (pWidget->IsAppModified()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
}
- else
- return FALSE;
+ }
}
+ }
- return TRUE;
-}
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
+ return pFormFiller->OnSetFocus(pAnnot, nFlag);
-FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget)
-{
- return pWidget->IsVisible();
+ return TRUE;
}
-FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget)
-{
- ASSERT(pWidget != NULL);
+FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
+ if (!pAnnot)
+ return FALSE;
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- int nFieldFlags = pWidget->GetFieldFlags();
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
+ if (pFormFiller->OnKillFocus(pAnnot, nFlag)) {
+ if (!m_bNotifying) {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) {
+ m_bNotifying = TRUE;
+ pWidget->ClearAppModified();
- return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
-}
+ CPDFSDK_PageView* pPageView = pWidget->GetPageView();
+ ASSERT(pPageView != NULL);
-FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget)
-{
- if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return TRUE;
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
- CPDF_Page* pPage = pWidget->GetPDFPage();
- CPDF_Document* pDocument = pPage->m_pDocument;
- FX_DWORD dwPermissions = pDocument->GetUserPermissions();
- return (dwPermissions & FPDFPERM_FILL_FORM) ||
- (dwPermissions & FPDFPERM_ANNOT_FORM) ||
- (dwPermissions & FPDFPERM_MODIFY);
-}
+ pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa);
-CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister)
-{
- auto it = m_Maps.find(pAnnot);
- if (it != m_Maps.end())
- return it->second;
+ pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView);
+ m_bNotifying = FALSE;
+ }
+ }
+ } else
+ return FALSE;
+ }
- if (!bRegister)
- return nullptr;
+ return TRUE;
+}
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- int nFieldType = pWidget->GetFieldType();
- CFFL_FormFiller* pFormFiller;
- switch (nFieldType) {
- case FIELDTYPE_PUSHBUTTON:
- pFormFiller = new CFFL_PushButton(m_pApp, pWidget);
- break;
- case FIELDTYPE_CHECKBOX:
- pFormFiller = new CFFL_CheckBox(m_pApp, pWidget);
- break;
- case FIELDTYPE_RADIOBUTTON:
- pFormFiller = new CFFL_RadioButton(m_pApp, pWidget);
- break;
- case FIELDTYPE_TEXTFIELD:
- pFormFiller = new CFFL_TextField(m_pApp, pWidget);
- break;
- case FIELDTYPE_LISTBOX:
- pFormFiller = new CFFL_ListBox(m_pApp, pWidget);
- break;
- case FIELDTYPE_COMBOBOX:
- pFormFiller = new CFFL_ComboBox(m_pApp, pWidget);
- break;
- case FIELDTYPE_UNKNOWN:
- default:
- pFormFiller = nullptr;
- break;
- }
+FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) {
+ return pWidget->IsVisible();
+}
- if (!pFormFiller)
- return nullptr;
+FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) {
+ ASSERT(pWidget != NULL);
- m_Maps[pAnnot] = pFormFiller;
- return pFormFiller;
-}
+ int nFieldFlags = pWidget->GetFieldFlags();
-void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot)
-{
- if ( pAnnot != NULL )
- {
- UnRegisterFormFiller( pAnnot );
- }
+ return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
}
-void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot)
-{
- auto it = m_Maps.find(pAnnot);
- if (it == m_Maps.end())
- return;
+FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) {
+ if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
+ return TRUE;
- delete it->second;
- m_Maps.erase(it);
+ CPDF_Page* pPage = pWidget->GetPDFPage();
+ CPDF_Document* pDocument = pPage->m_pDocument;
+ FX_DWORD dwPermissions = pDocument->GetUserPermissions();
+ return (dwPermissions & FPDFPERM_FILL_FORM) ||
+ (dwPermissions & FPDFPERM_ANNOT_FORM) ||
+ (dwPermissions & FPDFPERM_MODIFY);
}
-void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext)
-{
+CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot,
+ FX_BOOL bRegister) {
+ auto it = m_Maps.find(pAnnot);
+ if (it != m_Maps.end())
+ return it->second;
+
+ if (!bRegister)
+ return nullptr;
+
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ int nFieldType = pWidget->GetFieldType();
+ CFFL_FormFiller* pFormFiller;
+ switch (nFieldType) {
+ case FIELDTYPE_PUSHBUTTON:
+ pFormFiller = new CFFL_PushButton(m_pApp, pWidget);
+ break;
+ case FIELDTYPE_CHECKBOX:
+ pFormFiller = new CFFL_CheckBox(m_pApp, pWidget);
+ break;
+ case FIELDTYPE_RADIOBUTTON:
+ pFormFiller = new CFFL_RadioButton(m_pApp, pWidget);
+ break;
+ case FIELDTYPE_TEXTFIELD:
+ pFormFiller = new CFFL_TextField(m_pApp, pWidget);
+ break;
+ case FIELDTYPE_LISTBOX:
+ pFormFiller = new CFFL_ListBox(m_pApp, pWidget);
+ break;
+ case FIELDTYPE_COMBOBOX:
+ pFormFiller = new CFFL_ComboBox(m_pApp, pWidget);
+ break;
+ case FIELDTYPE_UNKNOWN:
+ default:
+ pFormFiller = nullptr;
+ break;
+ }
+
+ if (!pFormFiller)
+ return nullptr;
+ m_Maps[pAnnot] = pFormFiller;
+ return pFormFiller;
}
-void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet)
-{
- ASSERT(pPrivateData != NULL);
+void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) {
+ if (pAnnot != NULL) {
+ UnRegisterFormFiller(pAnnot);
+ }
+}
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) {
+ auto it = m_Maps.find(pAnnot);
+ if (it == m_Maps.end())
+ return;
+ delete it->second;
+ m_Maps.erase(it);
+}
+void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget,
+ FX_BOOL bSameField,
+ FX_BOOL bNext) {}
+void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData,
+ FX_FLOAT fPopupMin,
+ FX_FLOAT fPopupMax,
+ int32_t& nRet,
+ FX_FLOAT& fPopupRet) {
+ ASSERT(pPrivateData != NULL);
- CPDF_Rect rcPageView(0,0,0,0);
- rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth();
- rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight();
- rcPageView.Normalize();
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+ CPDF_Rect rcPageView(0, 0, 0, 0);
+ rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth();
+ rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight();
+ rcPageView.Normalize();
- ASSERT(pData->pWidget != NULL);
- CPDF_Rect rcAnnot = pData->pWidget->GetRect();
+ ASSERT(pData->pWidget != NULL);
+ CPDF_Rect rcAnnot = pData->pWidget->GetRect();
- FX_FLOAT fTop = 0.0f;
- FX_FLOAT fBottom = 0.0f;
+ FX_FLOAT fTop = 0.0f;
+ FX_FLOAT fBottom = 0.0f;
- CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget;
- switch (pWidget->GetRotate() / 90)
- {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget;
+ switch (pWidget->GetRotate() / 90) {
default:
case 0:
- fTop = rcPageView.top - rcAnnot.top;
- fBottom = rcAnnot.bottom - rcPageView.bottom;
- break;
+ fTop = rcPageView.top - rcAnnot.top;
+ fBottom = rcAnnot.bottom - rcPageView.bottom;
+ break;
case 1:
- fTop = rcAnnot.left - rcPageView.left;
- fBottom = rcPageView.right - rcAnnot.right;
- break;
+ fTop = rcAnnot.left - rcPageView.left;
+ fBottom = rcPageView.right - rcAnnot.right;
+ break;
case 2:
- fTop = rcAnnot.bottom - rcPageView.bottom;
- fBottom = rcPageView.top - rcAnnot.top;
- break;
+ fTop = rcAnnot.bottom - rcPageView.bottom;
+ fBottom = rcPageView.top - rcAnnot.top;
+ break;
case 3:
- fTop = rcPageView.right - rcAnnot.right;
- fBottom = rcAnnot.left - rcPageView.left;
- break;
- }
-
- FX_FLOAT fFactHeight = 0;
- FX_BOOL bBottom = TRUE;
- FX_FLOAT fMaxListBoxHeight = 0;
- if (fPopupMax > FFL_MAXLISTBOXHEIGHT)
- {
- if (fPopupMin > FFL_MAXLISTBOXHEIGHT)
- {
- fMaxListBoxHeight = fPopupMin;
- }
- else
- {
- fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
- }
+ fTop = rcPageView.right - rcAnnot.right;
+ fBottom = rcAnnot.left - rcPageView.left;
+ break;
+ }
+
+ FX_FLOAT fFactHeight = 0;
+ FX_BOOL bBottom = TRUE;
+ FX_FLOAT fMaxListBoxHeight = 0;
+ if (fPopupMax > FFL_MAXLISTBOXHEIGHT) {
+ if (fPopupMin > FFL_MAXLISTBOXHEIGHT) {
+ fMaxListBoxHeight = fPopupMin;
+ } else {
+ fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
}
- else
- fMaxListBoxHeight = fPopupMax;
-
- if (fBottom > fMaxListBoxHeight)
- {
- fFactHeight = fMaxListBoxHeight;
+ } else
+ fMaxListBoxHeight = fPopupMax;
+
+ if (fBottom > fMaxListBoxHeight) {
+ fFactHeight = fMaxListBoxHeight;
+ bBottom = TRUE;
+ } else {
+ if (fTop > fMaxListBoxHeight) {
+ fFactHeight = fMaxListBoxHeight;
+ bBottom = FALSE;
+ } else {
+ if (fTop > fBottom) {
+ fFactHeight = fTop;
+ bBottom = FALSE;
+ } else {
+ fFactHeight = fBottom;
bBottom = TRUE;
+ }
}
- else
- {
- if (fTop > fMaxListBoxHeight)
- {
- fFactHeight = fMaxListBoxHeight;
- bBottom = FALSE;
- }
- else
- {
- if (fTop > fBottom)
- {
- fFactHeight = fTop;
- bBottom = FALSE;
- }
- else
- {
- fFactHeight = fBottom;
- bBottom = TRUE;
- }
- }
- }
+ }
+
+ nRet = bBottom ? 0 : 1;
+ fPopupRet = fFactHeight;
+}
- nRet = bBottom ? 0 : 1;
- fPopupRet = fFactHeight;
+void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData,
+ const CPDF_Rect& rcWindow) {
+ ASSERT(pPrivateData != NULL);
+
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE)) {
+ CPDF_Rect rcOld =
+ pFormFiller->PWLtoFFL(pFormFiller->GetWindowRect(pData->pPageView));
+ CPDF_Rect rcNew = pFormFiller->PWLtoFFL(rcWindow);
+ pFormFiller->SetWindowRect(pData->pPageView, rcWindow);
+
+ CPDF_Rect unRect = rcOld;
+ unRect.Union(rcNew);
+ // FX_RECT rcRect = unRect.GetOutterRect();
+ unRect.left = (FX_FLOAT)(unRect.left - 0.5);
+ unRect.right = (FX_FLOAT)(unRect.right + 0.5);
+ unRect.top = (FX_FLOAT)(unRect.top + 0.5);
+ unRect.bottom = (FX_FLOAT)(unRect.bottom - 0.5);
+ m_pApp->FFI_Invalidate(pData->pWidget->GetPDFXFAPage(), unRect.left,
+ unRect.top, unRect.right, unRect.bottom);
+ }
}
-void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow)
-{
- ASSERT(pPrivateData != NULL);
+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);
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+ ASSERT(pData->pWidget != NULL);
+
+ CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
+ ASSERT(pFormFiller != NULL);
+
+ pFormFiller->OnKeyStroke(bKeyDown);
+}
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) {
+ if (!m_bNotifying) {
+ ASSERT(pWidget != NULL);
+ if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) {
+ m_bNotifying = TRUE;
+ pWidget->ClearAppModified();
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE))
- {
+ ASSERT(pPageView != NULL);
- CPDF_Rect rcOld = pFormFiller->PWLtoFFL(pFormFiller->GetWindowRect(pData->pPageView));
- CPDF_Rect rcNew = pFormFiller->PWLtoFFL(rcWindow);
- pFormFiller->SetWindowRect(pData->pPageView, rcWindow);
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
+ fa.bWillCommit = TRUE;
+ fa.bKeyDown = TRUE;
+ fa.bRC = TRUE;
- CPDF_Rect unRect = rcOld;
- unRect.Union(rcNew);
- //FX_RECT rcRect = unRect.GetOutterRect();
- unRect.left = (FX_FLOAT)(unRect.left - 0.5);
- unRect.right = (FX_FLOAT)(unRect.right + 0.5);
- unRect.top = (FX_FLOAT)(unRect.top + 0.5);
- unRect.bottom = (FX_FLOAT)(unRect.bottom -0.5);
- m_pApp->FFI_Invalidate(pData->pWidget->GetPDFXFAPage(), unRect.left, unRect.top, unRect.right, unRect.bottom);
- }
-}
+ CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
+ ASSERT(pFormFiller != NULL);
-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);
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
- ASSERT(pData->pWidget != NULL);
+ pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa);
+ pFormFiller->SaveState(pPageView);
- CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
- ASSERT(pFormFiller != NULL);
+ PDFSDK_FieldAction faOld = fa;
+ pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView);
- pFormFiller->OnKeyStroke(bKeyDown);
+ bRC = fa.bRC;
+ // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
+ // pWidget);
+
+ m_bNotifying = FALSE;
+ }
+ }
}
-void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag)
-{
- if (!m_bNotifying)
- {
- ASSERT(pWidget != NULL);
- if (pWidget->GetAAction(CPDF_AAction::KeyStroke))
- {
- m_bNotifying = TRUE;
- pWidget->ClearAppModified();
+void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) {
+ if (!m_bNotifying) {
+ ASSERT(pWidget != NULL);
+ if (pWidget->GetAAction(CPDF_AAction::Validate)) {
+ m_bNotifying = TRUE;
+ pWidget->ClearAppModified();
- ASSERT(pPageView != NULL);
+ 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);
- fa.bWillCommit = TRUE;
- fa.bKeyDown = TRUE;
- fa.bRC = TRUE;
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
+ fa.bKeyDown = TRUE;
+ fa.bRC = TRUE;
- CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
- ASSERT(pFormFiller != NULL);
+ CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
+ ASSERT(pFormFiller != NULL);
- pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa);
- pFormFiller->SaveState(pPageView);
+ pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa);
+ pFormFiller->SaveState(pPageView);
- PDFSDK_FieldAction faOld = fa;
- pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView);
+ PDFSDK_FieldAction faOld = fa;
+ pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView);
- bRC = fa.bRC;
-// bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget);
+ bRC = fa.bRC;
+ // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
+ // pWidget);
- m_bNotifying = FALSE;
- }
+ m_bNotifying = FALSE;
}
+ }
}
-void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag)
-{
- if (!m_bNotifying)
- {
- ASSERT(pWidget != NULL);
- if (pWidget->GetAAction(CPDF_AAction::Validate))
- {
- m_bNotifying = TRUE;
- pWidget->ClearAppModified();
+void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) {
+ if (!m_bNotifying) {
+ ASSERT(pWidget != NULL);
+ ASSERT(pPageView != NULL);
+ // CReader_DocView* pDocView = pPageView->GetDocView();
+ // ASSERT(pDocView != NULL);
+ CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
+ ASSERT(pDocument != NULL);
+
+ CPDFSDK_InterForm* pInterForm =
+ (CPDFSDK_InterForm*)pDocument->GetInterForm();
+ ASSERT(pInterForm != NULL);
- ASSERT(pPageView != NULL);
-// CReader_DocView* pDocView = pPageView->GetDocView();
-// ASSERT(pDocView != NULL);
+ pInterForm->OnCalculate(pWidget->GetFormField());
+ // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
+ // pWidget);
+ m_bNotifying = FALSE;
+ }
+}
- PDFSDK_FieldAction fa;
- fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
- fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
- fa.bKeyDown = TRUE;
- fa.bRC = TRUE;
+void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) {
+ if (!m_bNotifying) {
+ ASSERT(pWidget != NULL);
+ ASSERT(pPageView != NULL);
+ // CReader_DocView* pDocView = pPageView->GetDocView();
+ // ASSERT(pDocView != NULL);
+ CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
+ ASSERT(pDocument != NULL);
- CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
- ASSERT(pFormFiller != NULL);
+ CPDFSDK_InterForm* pInterForm =
+ (CPDFSDK_InterForm*)pDocument->GetInterForm();
+ ASSERT(pInterForm != NULL);
- pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa);
- pFormFiller->SaveState(pPageView);
+ FX_BOOL bFormated = FALSE;
+ CFX_WideString sValue =
+ pInterForm->OnFormat(pWidget->GetFormField(), bFormated);
- PDFSDK_FieldAction faOld = fa;
- pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView);
+ // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView,
+ // pWidget);
- bRC = fa.bRC;
-// bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget);
+ if (bExit)
+ return;
- m_bNotifying = FALSE;
- }
+ if (bFormated) {
+ pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(),
+ TRUE);
+ pInterForm->UpdateField(pWidget->GetFormField());
}
+
+ m_bNotifying = FALSE;
+ }
}
-void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag)
-{
- if (!m_bNotifying)
- {
- ASSERT(pWidget != NULL);
- ASSERT(pPageView != NULL);
-// CReader_DocView* pDocView = pPageView->GetDocView();
-// ASSERT(pDocView != NULL);
- CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- ASSERT(pDocument != NULL);
+void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag) {
+ ASSERT(pWidget != NULL);
+
+ if (!m_bNotifying) {
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) {
+ m_bNotifying = TRUE;
+ int nAge = pWidget->GetAppearanceAge();
+ int nValueAge = pWidget->GetValueAge();
+
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
- CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
+ pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView);
+ m_bNotifying = FALSE;
- pInterForm->OnCalculate(pWidget->GetFormField());
+ if (!IsValidAnnot(pPageView, pWidget)) {
+ bExit = TRUE;
+ return;
+ }
-// bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget);
+ if (nAge != pWidget->GetAppearanceAge()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
+ }
- m_bNotifying = FALSE;
+ bReset = TRUE;
+ }
}
+ }
}
-void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag)
-{
- if (!m_bNotifying)
- {
- ASSERT(pWidget != NULL);
- ASSERT(pPageView != NULL);
-// CReader_DocView* pDocView = pPageView->GetDocView();
-// ASSERT(pDocView != NULL);
- CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- ASSERT(pDocument != NULL);
+void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag) {
+ ASSERT(pWidget != NULL);
- CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
+ if (!m_bNotifying) {
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) {
+ m_bNotifying = TRUE;
+ int nAge = pWidget->GetAppearanceAge();
+ int nValueAge = pWidget->GetValueAge();
- FX_BOOL bFormated = FALSE;
- CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormated);
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
-// bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget);
+ pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView);
+ m_bNotifying = FALSE;
- if (bExit) return;
+ if (!IsValidAnnot(pPageView, pWidget)) {
+ bExit = TRUE;
+ return;
+ }
- if (bFormated)
- {
- pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), TRUE);
- pInterForm->UpdateField(pWidget->GetFormField());
+ if (nAge != pWidget->GetAppearanceAge()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
}
- m_bNotifying = FALSE;
+ bReset = TRUE;
+ }
}
+ }
}
-void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag)
-{
- ASSERT(pWidget != NULL);
-
- if (!m_bNotifying)
- {
- if (pWidget->HasXFAAAction(PDFSDK_XFA_Click))
- {
- m_bNotifying = TRUE;
- int nAge = pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
-
- PDFSDK_FieldAction fa;
- fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
- fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
-
- pWidget->OnXFAAAction(PDFSDK_XFA_Click, 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;
- }
- }
- }
+void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) {
+ ASSERT(pPrivateData != NULL);
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+ ASSERT(pData->pWidget != NULL);
+
+ FX_BOOL bTempReset = FALSE;
+ FX_BOOL bTempExit = FALSE;
+ this->OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit,
+ nFlag);
+
+ if (bTempReset || bTempExit) {
+ bExit = TRUE;
+ }
}
-void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag)
-{
- ASSERT(pWidget != NULL);
-
- if (!m_bNotifying)
- {
- if (pWidget->HasXFAAAction(PDFSDK_XFA_Full))
- {
- m_bNotifying = TRUE;
- int nAge = pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
-
- PDFSDK_FieldAction fa;
- fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
- fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
-
- pWidget->OnXFAAAction(PDFSDK_XFA_Full, 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;
- }
- }
- }
+void CFFL_IFormFiller::OnPopupPostOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) {
+ ASSERT(pPrivateData != NULL);
+ CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
+ ASSERT(pData->pWidget != NULL);
+
+ FX_BOOL bTempReset = FALSE;
+ FX_BOOL bTempExit = FALSE;
+ this->OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit,
+ nFlag);
+
+ if (bTempReset || bTempExit) {
+ bExit = TRUE;
+ }
}
-void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag)
-{
- ASSERT(pPrivateData != NULL);
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
- ASSERT(pData->pWidget != NULL);
-
- FX_BOOL bTempReset = FALSE;
- FX_BOOL bTempExit = FALSE;
- this->OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag);
+void CFFL_IFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag) {
+ ASSERT(pWidget != NULL);
- if (bTempReset || bTempExit)
- {
- bExit = TRUE;
- }
-}
+ if (!m_bNotifying) {
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) {
+ m_bNotifying = TRUE;
+ int nAge = pWidget->GetAppearanceAge();
+ int nValueAge = pWidget->GetValueAge();
-void CFFL_IFormFiller::OnPopupPostOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag)
-{
- ASSERT(pPrivateData != NULL);
- CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
- ASSERT(pData->pWidget != NULL);
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
- FX_BOOL bTempReset = FALSE;
- FX_BOOL bTempExit = FALSE;
- this->OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag);
+ pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView);
+ m_bNotifying = FALSE;
- if (bTempReset || bTempExit)
- {
- bExit = TRUE;
- }
-}
+ if (!IsValidAnnot(pPageView, pWidget)) {
+ bExit = TRUE;
+ return;
+ }
-void CFFL_IFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag)
-{
- ASSERT(pWidget != NULL);
-
- if (!m_bNotifying)
- {
- if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen))
- {
- m_bNotifying = TRUE;
- int nAge = pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
-
- PDFSDK_FieldAction fa;
- fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
- fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
-
- pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, 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;
- }
- }
- }
-}
+ if (nAge != pWidget->GetAppearanceAge()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
+ }
-void CFFL_IFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag)
-{
- ASSERT(pWidget != NULL);
-
- if (!m_bNotifying)
- {
- if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen))
- {
- m_bNotifying = TRUE;
- int nAge = pWidget->GetAppearanceAge();
- int nValueAge = pWidget->GetValueAge();
-
- PDFSDK_FieldAction fa;
- fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
- fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
-
- pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, 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;
- }
- }
- }
+ bReset = TRUE;
+ }
+ }
+ }
}
-FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot)
-{
- if(pPageView)
- return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
+void CFFL_IFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag) {
+ ASSERT(pWidget != NULL);
- return FALSE;
-}
+ if (!m_bNotifying) {
+ if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) {
+ m_bNotifying = TRUE;
+ int nAge = pWidget->GetAppearanceAge();
+ int nValueAge = pWidget->GetValueAge();
-void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument)
-{
+ PDFSDK_FieldAction fa;
+ fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
+ fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
-}
+ pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView);
+ m_bNotifying = FALSE;
-void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument)
-{
- BeforeUndo(pDocument);
-}
+ if (!IsValidAnnot(pPageView, pWidget)) {
+ bExit = TRUE;
+ return;
+ }
-void CFFL_IFormFiller::AfterUndo(CPDFSDK_Document* pDocument)
-{
-}
+ if (nAge != pWidget->GetAppearanceAge()) {
+ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
+ pFormFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
+ }
-void CFFL_IFormFiller::AfterRedo(CPDFSDK_Document* pDocument)
-{
+ bReset = TRUE;
+ }
+ }
+ }
}
-FX_BOOL CFFL_IFormFiller::CanCopy(CPDFSDK_Document* pDocument)
-{
+FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) {
+ if (pPageView)
+ return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_IFormFiller::CanCut(CPDFSDK_Document* pDocument)
-{
+void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument) {}
- return FALSE;
+void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument) {
+ BeforeUndo(pDocument);
}
-FX_BOOL CFFL_IFormFiller::CanPaste(CPDFSDK_Document* pDocument)
-{
+void CFFL_IFormFiller::AfterUndo(CPDFSDK_Document* pDocument) {}
+
+void CFFL_IFormFiller::AfterRedo(CPDFSDK_Document* pDocument) {}
- return FALSE;
+FX_BOOL CFFL_IFormFiller::CanCopy(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-void CFFL_IFormFiller::DoCopy(CPDFSDK_Document* pDocument)
-{
+FX_BOOL CFFL_IFormFiller::CanCut(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-void CFFL_IFormFiller::DoCut(CPDFSDK_Document* pDocument)
-{
+FX_BOOL CFFL_IFormFiller::CanPaste(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-void CFFL_IFormFiller::DoPaste(CPDFSDK_Document* pDocument)
-{
+void CFFL_IFormFiller::DoCopy(CPDFSDK_Document* pDocument) {}
+
+void CFFL_IFormFiller::DoCut(CPDFSDK_Document* pDocument) {}
+
+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,
+ 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 (pFormFiller->IsFieldFull(pData->pPageView)) {
+ FX_BOOL bFullExit = FALSE;
+ FX_BOOL bFullReset = FALSE;
+ OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag);
+
+ if (bFullReset || bFullExit) {
+ bExit = TRUE;
+ return;
+ }
+ }
+
+ if (!m_bNotifying) {
+ if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) {
+ m_bNotifying = TRUE;
+ int nAge = pData->pWidget->GetAppearanceAge();
+ int nValueAge = pData->pWidget->GetValueAge();
+
+ 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);
+ fa.sChange = strChange;
+ fa.sChangeEx = strChangeEx;
+ fa.bKeyDown = bKeyDown;
+ fa.bWillCommit = FALSE;
+ fa.bRC = TRUE;
+ fa.nSelStart = nSelStart;
+ fa.nSelEnd = nSelEnd;
+
+ 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)) {
+ bExit = TRUE;
+ m_bNotifying = FALSE;
+ return;
+ }
-}
-void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode,
- 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 (pFormFiller->IsFieldFull(pData->pPageView))
- {
- FX_BOOL bFullExit = FALSE;
- FX_BOOL bFullReset = FALSE;
- OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag);
-
- if (bFullReset || bFullExit)
- {
- bExit = TRUE;
- return;
- }
- }
-
- if (!m_bNotifying)
- {
- if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke))
- {
- m_bNotifying = TRUE;
- int nAge = pData->pWidget->GetAppearanceAge();
- int nValueAge = pData->pWidget->GetValueAge();
-
- 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);
- fa.sChange = strChange;
- fa.sChangeEx = strChangeEx;
- fa.bKeyDown = bKeyDown;
- fa.bWillCommit = FALSE;
- fa.bRC = TRUE;
- fa.nSelStart = nSelStart;
- fa.nSelEnd = nSelEnd;
-
-
- 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))
- {
- bExit = TRUE;
- 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);
- bRC = FALSE;
- }
- else
- {
- pFormFiller->RestoreState(pData->pPageView);
- bRC = FALSE;
- }
-
- if (pDocument->GetFocusAnnot() != pData->pWidget)
- {
- pFormFiller->CommitData(pData->pPageView,nFlag);
- bExit = TRUE;
- }
- }
- else
- {
- if (!IsValidAnnot(pData->pPageView, pData->pWidget))
- {
- bExit = TRUE;
- m_bNotifying = FALSE;
- return;
- }
- }
-
- m_bNotifying = FALSE;
- }
- }
+ 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);
+ bRC = FALSE;
+ } else {
+ pFormFiller->RestoreState(pData->pPageView);
+ bRC = FALSE;
+ }
+
+ if (pDocument->GetFocusAnnot() != pData->pWidget) {
+ pFormFiller->CommitData(pData->pPageView, nFlag);
+ bExit = TRUE;
+ }
+ } else {
+ if (!IsValidAnnot(pData->pPageView, pData->pWidget)) {
+ bExit = TRUE;
+ m_bNotifying = FALSE;
+ return;
+ }
+ }
+
+ m_bNotifying = FALSE;
+ }
+ }
}
-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);
+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);
+ CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
+ ASSERT(pFormFiller != NULL);
- if (!bEditOrList)
- pFormFiller->OnKeyStroke(bExit);
+ if (!bEditOrList)
+ pFormFiller->OnKeyStroke(bExit);
}
diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
index c105cfcbdd..0735f48cf3 100644
--- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
@@ -12,286 +12,237 @@
//#include "../../include/formfiller/FFL_Undo.h"
#include "../../include/formfiller/FFL_CBA_Fontmap.h"
+#define FFL_DEFAULTLISTBOXFONTSIZE 12.0f
-#define FFL_DEFAULTLISTBOXFONTSIZE 12.0f
+/* ------------------------------- CFFL_ListBox -------------------------------
+ */
+CFFL_ListBox::CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
+ : CFFL_FormFiller(pApp, pWidget), m_pFontMap(NULL) {}
-/* ------------------------------- CFFL_ListBox ------------------------------- */
-
-CFFL_ListBox::CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) :
- CFFL_FormFiller(pApp, pWidget),
- m_pFontMap(NULL)
-{
+CFFL_ListBox::~CFFL_ListBox() {
+ delete m_pFontMap;
}
-CFFL_ListBox::~CFFL_ListBox()
-{
- delete m_pFontMap;
+PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() {
+ PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
+
+ ASSERT(m_pWidget != NULL);
+ FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags();
+
+ if (dwFieldFlag & FIELDFLAG_MULTISELECT) {
+ cp.dwFlags |= PLBS_MULTIPLESEL;
+ }
+
+ cp.dwFlags |= PWS_VSCROLL;
+
+ if (cp.dwFlags & PWS_AUTOFONTSIZE)
+ cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE;
+
+ if (!m_pFontMap) {
+ m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler());
+ m_pFontMap->Initial();
+ }
+ cp.pFontMap = m_pFontMap;
+
+ return cp;
}
-PWL_CREATEPARAM CFFL_ListBox::GetCreateParam()
-{
- PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
+CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) {
+ CPWL_ListBox* pWnd = new CPWL_ListBox();
+ pWnd->AttachFFLData(this);
+ pWnd->Create(cp);
- ASSERT(m_pWidget != NULL);
- FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags();
+ ASSERT(m_pApp != NULL);
+ CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+ pWnd->SetFillerNotify(pIFormFiller);
- if (dwFieldFlag & FIELDFLAG_MULTISELECT)
- {
- cp.dwFlags |= PLBS_MULTIPLESEL;
- }
+ for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++)
+ pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
- cp.dwFlags |= PWS_VSCROLL;
+ if (pWnd->HasFlag(PLBS_MULTIPLESEL)) {
+ m_OriginSelections.clear();
- if (cp.dwFlags & PWS_AUTOFONTSIZE)
- cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE;
+ FX_BOOL bSetCaret = FALSE;
+ for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) {
+ if (m_pWidget->IsOptionSelected(i)) {
+ if (!bSetCaret) {
+ pWnd->SetCaret(i);
+ bSetCaret = TRUE;
+ }
+ pWnd->Select(i);
+ m_OriginSelections.insert(i);
+ }
+ }
+ } else {
+ for (int i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) {
+ if (m_pWidget->IsOptionSelected(i)) {
+ pWnd->Select(i);
+ break;
+ }
+ }
+ }
- if (!m_pFontMap)
- {
- m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler());
- m_pFontMap->Initial();
- }
- cp.pFontMap = m_pFontMap;
+ pWnd->SetTopVisibleIndex(m_pWidget->GetTopVisibleIndex());
- return cp;
+ return pWnd;
}
-CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
-{
- CPWL_ListBox* pWnd = new CPWL_ListBox();
- pWnd->AttachFFLData(this);
- pWnd->Create(cp);
-
- ASSERT(m_pApp != NULL);
- CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
- pWnd->SetFillerNotify(pIFormFiller);
-
- for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
- pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
-
- if (pWnd->HasFlag(PLBS_MULTIPLESEL))
- {
- m_OriginSelections.clear();
-
- FX_BOOL bSetCaret = FALSE;
- for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
- {
- if (m_pWidget->IsOptionSelected(i))
- {
- if (!bSetCaret)
- {
- pWnd->SetCaret(i);
- bSetCaret = TRUE;
- }
- pWnd->Select(i);
- m_OriginSelections.insert(i);
- }
- }
- }
- else
- {
- for (int i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
- {
- if (m_pWidget->IsOptionSelected(i))
- {
- pWnd->Select(i);
- break;
- }
- }
- }
-
- pWnd->SetTopVisibleIndex(m_pWidget->GetTopVisibleIndex());
-
- return pWnd;
+FX_BOOL CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
}
+FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
+ CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE);
+ if (!pListBox)
+ return FALSE;
-FX_BOOL CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
+ int nSelCount = 0;
+ for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; ++i) {
+ if (pListBox->IsItemSelected(i)) {
+ if (m_OriginSelections.count(i) == 0)
+ return TRUE;
+
+ nSelCount++;
+ }
+ }
+
+ return nSelCount != m_OriginSelections.size();
+ }
+ return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0);
}
-FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView)
-{
- CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE);
- if (!pListBox)
- return FALSE;
+void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
- int nSelCount = 0;
- for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; ++i) {
- if (pListBox->IsItemSelected(i)) {
- if (m_OriginSelections.count(i) == 0)
- return TRUE;
-
- nSelCount++;
- }
+ if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) {
+ CFX_IntArray aOldSelect, aNewSelect;
+
+ {
+ for (int i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) {
+ if (m_pWidget->IsOptionSelected(i)) {
+ aOldSelect.Add(i);
}
+ }
+ }
+
+ int32_t nNewTopIndex = pListBox->GetTopVisibleIndex();
- return nSelCount != m_OriginSelections.size();
+ m_pWidget->ClearSelection(FALSE);
+
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
+ for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) {
+ if (pListBox->IsItemSelected(i)) {
+ m_pWidget->SetOptionSelection(i, TRUE, FALSE);
+ aNewSelect.Add(i);
+ }
+ }
+ } else {
+ m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE);
+ aNewSelect.Add(pListBox->GetCurSel());
}
- return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0);
-}
-void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView)
-{
- ASSERT(m_pWidget != NULL);
-
- if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE))
- {
- CFX_IntArray aOldSelect, aNewSelect;
-
- {
- for (int i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
- {
- if (m_pWidget->IsOptionSelected(i))
- {
- aOldSelect.Add(i);
- }
- }
- }
-
-
- int32_t nNewTopIndex = pListBox->GetTopVisibleIndex();
-
- m_pWidget->ClearSelection(FALSE);
-
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT)
- {
- for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++)
- {
- if (pListBox->IsItemSelected(i))
- {
- m_pWidget->SetOptionSelection(i, TRUE, FALSE);
- aNewSelect.Add(i);
- }
- }
- }
- else
- {
- m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE);
- aNewSelect.Add(pListBox->GetCurSel());
- }
-
- m_pWidget->SetTopVisibleIndex(nNewTopIndex);
- m_pWidget->ResetFieldAppearance(TRUE);
- m_pWidget->UpdateField();
- SetChangeMark();
- }
+ m_pWidget->SetTopVisibleIndex(nNewTopIndex);
+ m_pWidget->ResetFieldAppearance(TRUE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
+ }
}
-void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa)
-{
- switch (type)
- {
- case CPDF_AAction::Validate:
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT)
- {
- fa.sValue = L"";
- }
- else
- {
- if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE))
- {
- ASSERT(m_pWidget != NULL);
- int32_t nCurSel = pListBox->GetCurSel();
- if (nCurSel >= 0)
- fa.sValue = m_pWidget->GetOptionLabel(nCurSel);
- }
- }
- break;
- case CPDF_AAction::LoseFocus:
- case CPDF_AAction::GetFocus:
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT)
- {
- fa.sValue = L"";
- }
- else
- {
- ASSERT(m_pWidget != NULL);
- int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
- if (nCurSel >= 0)
- fa.sValue = m_pWidget->GetOptionLabel(nCurSel);
- }
- break;
- default:
- break;
- }
+void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa) {
+ switch (type) {
+ case CPDF_AAction::Validate:
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
+ fa.sValue = L"";
+ } else {
+ if (CPWL_ListBox* pListBox =
+ (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) {
+ ASSERT(m_pWidget != NULL);
+ int32_t nCurSel = pListBox->GetCurSel();
+ if (nCurSel >= 0)
+ fa.sValue = m_pWidget->GetOptionLabel(nCurSel);
+ }
+ }
+ break;
+ case CPDF_AAction::LoseFocus:
+ case CPDF_AAction::GetFocus:
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
+ fa.sValue = L"";
+ } else {
+ ASSERT(m_pWidget != NULL);
+ int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
+ if (nCurSel >= 0)
+ fa.sValue = m_pWidget->GetOptionLabel(nCurSel);
+ }
+ break;
+ default:
+ break;
+ }
}
+void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa) {}
-void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa)
-{
-}
+void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) {
+ ASSERT(pPageView != NULL);
-void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView)
-{
- ASSERT(pPageView != NULL);
-
- if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE))
- {
- for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++)
- {
- if (pListBox->IsItemSelected(i))
- {
- m_State.Add(i);
- }
- }
- }
+ if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) {
+ for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) {
+ if (pListBox->IsItemSelected(i)) {
+ m_State.Add(i);
+ }
+ }
+ }
}
-void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView)
-{
- if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE))
- {
- for (int i=0,sz=m_State.GetSize(); i<sz; i++)
- pListBox->Select(m_State[i]);
- }
+void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView) {
+ if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) {
+ for (int i = 0, sz = m_State.GetSize(); i < sz; i++)
+ pListBox->Select(m_State[i]);
+ }
}
-CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue)
-{
- if (bRestoreValue)
- SaveState(pPageView);
+CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue) {
+ if (bRestoreValue)
+ SaveState(pPageView);
- DestroyPDFWindow(pPageView);
+ DestroyPDFWindow(pPageView);
- CPWL_Wnd* pRet = NULL;
+ CPWL_Wnd* pRet = NULL;
- if (bRestoreValue)
- {
- RestoreState(pPageView);
- pRet = GetPDFWindow(pPageView, FALSE);
- }
- else
- pRet = GetPDFWindow(pPageView, TRUE);
+ if (bRestoreValue) {
+ RestoreState(pPageView);
+ pRet = GetPDFWindow(pPageView, FALSE);
+ } else
+ pRet = GetPDFWindow(pPageView, TRUE);
- m_pWidget->UpdateField();
+ m_pWidget->UpdateField();
- return pRet;
+ return pRet;
}
-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)
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
-
- if (CommitData(pPageView, nFlag))
- {
- DestroyPDFWindow(pPageView);
- m_bValid = FALSE;
- }
- }
- }
-}
+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) {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
+
+ if (CommitData(pPageView, nFlag)) {
+ DestroyPDFWindow(pPageView);
+ m_bValid = FALSE;
+ }
+ }
+ }
+}
diff --git a/fpdfsdk/src/formfiller/FFL_Notify.cpp b/fpdfsdk/src/formfiller/FFL_Notify.cpp
index 58a2202b61..e348f8e0b9 100644
--- a/fpdfsdk/src/formfiller/FFL_Notify.cpp
+++ b/fpdfsdk/src/formfiller/FFL_Notify.cpp
@@ -10,164 +10,168 @@
// #include "../../include/formfiller/FFL_ComboBox.h"
// #include "../../include/formfiller/FFL_Module.h"
-/* -------------------------------- CFFL_Notify ------------------------------ */
+/* -------------------------------- CFFL_Notify ------------------------------
+ */
//#pragma warning(disable: 4800)
-CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) :
- m_bDoActioning(FALSE),
- m_nNotifyFlag(0)
-{
- ASSERT(pFormFiller != NULL);
+CFFL_Notify::CFFL_Notify(CFFL_FormFiller* pFormFiller)
+ : m_bDoActioning(FALSE), m_nNotifyFlag(0) {
+ ASSERT(pFormFiller != NULL);
}
-CFFL_Notify::~CFFL_Notify()
-{
-}
+CFFL_Notify::~CFFL_Notify() {}
-void CFFL_Notify::BeforeNotify()
-{
- m_nNotifyFlag ++;
+void CFFL_Notify::BeforeNotify() {
+ m_nNotifyFlag++;
}
-
-void CFFL_Notify::AfterNotify()
-{
- m_nNotifyFlag --;
+void CFFL_Notify::AfterNotify() {
+ m_nNotifyFlag--;
}
-FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL & bExit)
-{
- BeforeNotify();
- FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonUp, bExit);
- AfterNotify();
- return bRet;
+FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL& bExit) {
+ BeforeNotify();
+ FX_BOOL bRet =
+ FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonUp, bExit);
+ AfterNotify();
+ return bRet;
}
-FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL & bExit)
-{
- BeforeNotify();
- FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonDown, bExit);
- AfterNotify();
- return bRet;
+FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL& bExit) {
+ BeforeNotify();
+ FX_BOOL bRet =
+ FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonDown, bExit);
+ AfterNotify();
+ return bRet;
}
-FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL & bExit)
-{
- BeforeNotify();
- FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorEnter, bExit);
- AfterNotify();
- return bRet;
+FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL& bExit) {
+ BeforeNotify();
+ FX_BOOL bRet =
+ FALSE; // DoAAction(CPDF_AAction::AActionType::CursorEnter, bExit);
+ AfterNotify();
+ return bRet;
}
-FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL & bExit)
-{
- BeforeNotify();
- FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorExit, bExit);
- AfterNotify();
- return bRet;
+FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL& bExit) {
+ BeforeNotify();
+ FX_BOOL bRet =
+ FALSE; // DoAAction(CPDF_AAction::AActionType::CursorExit, bExit);
+ AfterNotify();
+ return bRet;
}
-FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL & bExit)
-{
- BeforeNotify();
- FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::GetFocus, bExit);
- AfterNotify();
- return bRet;
+FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL& bExit) {
+ BeforeNotify();
+ FX_BOOL bRet =
+ FALSE; // DoAAction(CPDF_AAction::AActionType::GetFocus, bExit);
+ AfterNotify();
+ return bRet;
}
-FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL & bExit)
-{
- BeforeNotify();
- FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::LoseFocus, bExit);
- AfterNotify();
- return bRet;
+FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL& bExit) {
+ BeforeNotify();
+ FX_BOOL bRet =
+ FALSE; // DoAAction(CPDF_AAction::AActionType::LoseFocus, bExit);
+ AfterNotify();
+ return bRet;
}
-FX_BOOL CFFL_Notify::OnCalculate()
-{
- return TRUE;
+FX_BOOL CFFL_Notify::OnCalculate() {
+ return TRUE;
}
-FX_BOOL CFFL_Notify::OnFormat(int iCommitKey)
-{
- return TRUE;
+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,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
- FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull,
- int& nSelStart, int& nSelEnd, FX_BOOL& bRC)
-{
- return TRUE;
+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,
+ int& nSelStart,
+ int& nSelEnd,
+ FX_BOOL& bRC) {
+ return TRUE;
}
-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)
-{
- return TRUE;
+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) {
+ return TRUE;
}
-FX_BOOL CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit)
-{
- if (m_bDoActioning)
- return FALSE;
+FX_BOOL CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL& bExit) {
+ if (m_bDoActioning)
+ return FALSE;
- CPDF_Action action;
- if (!FindAAction(eAAT, action))
- return FALSE;
+ CPDF_Action action;
+ if (!FindAAction(eAAT, action))
+ return FALSE;
- m_bDoActioning = TRUE;
- ExecuteActionTree(eAAT,action,bExit);
- m_bDoActioning = FALSE;
- return TRUE;
+ m_bDoActioning = TRUE;
+ ExecuteActionTree(eAAT, action, bExit);
+ m_bDoActioning = FALSE;
+ return TRUE;
}
-FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Action & action, FX_BOOL& bExit)
-{
- if (!ExecuteAction(eAAT,action,bExit)) return FALSE;
- if (bExit) return TRUE;
+FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action,
+ FX_BOOL& bExit) {
+ if (!ExecuteAction(eAAT, action, bExit))
+ return FALSE;
+ if (bExit)
+ return TRUE;
- for (int32_t i=0,sz=action.GetSubActionsCount(); i<sz; i++)
- {
- CPDF_Action subaction = action.GetSubAction(i);
- if (!ExecuteActionTree(eAAT,subaction,bExit)) return FALSE;
- if (bExit) break;
- }
+ for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
+ CPDF_Action subaction = action.GetSubAction(i);
+ if (!ExecuteActionTree(eAAT, subaction, bExit))
+ return FALSE;
+ if (bExit)
+ break;
+ }
- return TRUE;
+ return TRUE;
}
-
-FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action)
-{
- return FALSE;
+FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action) {
+ return FALSE;
}
-FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action)
-{
- CPDF_Action MyAction;
-
- if (aaction.ActionExist(eAAT))
- {
- MyAction = aaction.GetAction(eAAT);
- }
- else
- return FALSE;
+FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction,
+ CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action) {
+ CPDF_Action MyAction;
+ if (aaction.ActionExist(eAAT)) {
+ MyAction = aaction.GetAction(eAAT);
+ } else
+ return FALSE;
- if (MyAction.GetType() == CPDF_Action::Unknown)
- return FALSE;
+ if (MyAction.GetType() == CPDF_Action::Unknown)
+ return FALSE;
- action = MyAction;
+ action = MyAction;
- return TRUE;
+ return TRUE;
}
-FX_BOOL CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit)
-{
- return FALSE;
+FX_BOOL CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action,
+ FX_BOOL& bExit) {
+ return FALSE;
}
//#pragma warning(default: 4800)
-
diff --git a/fpdfsdk/src/formfiller/FFL_PushButton.cpp b/fpdfsdk/src/formfiller/FFL_PushButton.cpp
index a5df48840c..533d786177 100644
--- a/fpdfsdk/src/formfiller/FFL_PushButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_PushButton.cpp
@@ -8,36 +8,33 @@
#include "../../include/formfiller/FFL_FormFiller.h"
#include "../../include/formfiller/FFL_PushButton.h"
-/* ------------------------------- CFFL_PushButton ------------------------------- */
+/* ------------------------------- CFFL_PushButton
+ * ------------------------------- */
-CFFL_PushButton::CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot):
- CFFL_Button( pApp, pAnnot)
-{
-}
+CFFL_PushButton::CFFL_PushButton(CPDFDoc_Environment* pApp,
+ CPDFSDK_Annot* pAnnot)
+ : CFFL_Button(pApp, pAnnot) {}
-CFFL_PushButton::~CFFL_PushButton()
-{
-}
+CFFL_PushButton::~CFFL_PushButton() {}
-CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
-{
- CPWL_PushButton* pWnd = new CPWL_PushButton();
- pWnd->Create(cp);
+CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) {
+ CPWL_PushButton* pWnd = new CPWL_PushButton();
+ pWnd->Create(cp);
- return pWnd;
+ return pWnd;
}
-
-FX_BOOL CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+FX_BOOL CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
}
-void CFFL_PushButton::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags)
-{
- CFFL_Button::OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
+void CFFL_PushButton::OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags) {
+ CFFL_Button::OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
}
-
-
diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
index 1f73e8ccaa..7c4f9a9e49 100644
--- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
@@ -9,129 +9,124 @@
#include "../../include/formfiller/FFL_RadioButton.h"
//#include "../include/FFL_Undo.h"
-/* ------------------------------- CFFL_RadioButton ------------------------------- */
+/* ------------------------------- CFFL_RadioButton
+ * ------------------------------- */
-CFFL_RadioButton::CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) :
- CFFL_Button(pApp, pWidget)
-{
-}
+CFFL_RadioButton::CFFL_RadioButton(CPDFDoc_Environment* pApp,
+ CPDFSDK_Annot* pWidget)
+ : CFFL_Button(pApp, pWidget) {}
-CFFL_RadioButton::~CFFL_RadioButton()
-{
-}
+CFFL_RadioButton::~CFFL_RadioButton() {}
-CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
-{
- CPWL_RadioButton* pWnd = new CPWL_RadioButton();
- pWnd->Create(cp);
+CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) {
+ CPWL_RadioButton* pWnd = new CPWL_RadioButton();
+ pWnd->Create(cp);
- ASSERT(m_pWidget != NULL);
- pWnd->SetCheck(m_pWidget->IsChecked());
+ ASSERT(m_pWidget != NULL);
+ pWnd->SetCheck(m_pWidget->IsChecked());
- return pWnd;
+ return pWnd;
}
-FX_BOOL CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags)
-{
- switch (nKeyCode)
- {
- case FWL_VKEY_Return:
- case FWL_VKEY_Space:
- return TRUE;
- default:
- return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags);
- }
+FX_BOOL CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags) {
+ switch (nKeyCode) {
+ case FWL_VKEY_Return:
+ case FWL_VKEY_Space:
+ return TRUE;
+ default:
+ return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags);
+ }
}
-FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- switch (nChar)
- {
- case FWL_VKEY_Return:
- case FWL_VKEY_Space:
- {
- CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
- ASSERT(pIFormFiller != NULL);
-
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- ASSERT(pPageView != NULL);
-
- FX_BOOL bReset = FALSE;
- FX_BOOL bExit = FALSE;
-
- pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit,nFlags);
-
- if (bReset) return TRUE;
- if (bExit) return TRUE;
-
- CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
-
- if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE))
- pWnd->SetCheck(TRUE);
- CommitData(pPageView,nFlags);
- return TRUE;
- }
- default:
- return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
- }
+FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ switch (nChar) {
+ case FWL_VKEY_Return:
+ case FWL_VKEY_Space: {
+ CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+ ASSERT(pIFormFiller != NULL);
+
+ CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ ASSERT(pPageView != NULL);
+
+ FX_BOOL bReset = FALSE;
+ FX_BOOL bExit = FALSE;
+
+ pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit, nFlags);
+
+ if (bReset)
+ return TRUE;
+ if (bExit)
+ return TRUE;
+
+ CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+
+ if (CPWL_RadioButton* pWnd =
+ (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE))
+ pWnd->SetCheck(TRUE);
+ CommitData(pPageView, nFlags);
+ return TRUE;
+ }
+ default:
+ return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+ }
}
-FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
-{
- CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
+FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point) {
+ CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
- if (IsValid())
- {
- if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE))
- pWnd->SetCheck(TRUE);
+ if (IsValid()) {
+ if (CPWL_RadioButton* pWnd =
+ (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE))
+ pWnd->SetCheck(TRUE);
- if (!CommitData(pPageView,nFlags)) return FALSE;
- }
+ if (!CommitData(pPageView, nFlags))
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
-FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView)
-{
- ASSERT(m_pWidget != NULL);
+FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
- if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->IsChecked() != m_pWidget->IsChecked();
- }
+ if (CPWL_RadioButton* pWnd =
+ (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) {
+ return pWnd->IsChecked() != m_pWidget->IsChecked();
+ }
- return FALSE;
+ return FALSE;
}
-void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView)
-{
- ASSERT(m_pWidget != NULL);
-
- if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE))
- {
-
- FX_BOOL bNewChecked = pWnd->IsChecked();
-
- if (bNewChecked)
- {
- CPDF_FormField* pField = m_pWidget->GetFormField();
- ASSERT(pField != NULL);
-
- for (int32_t i=0,sz=pField->CountControls(); i<sz; i++)
- {
- if (CPDF_FormControl* pCtrl = pField->GetControl(i))
- {
- if (pCtrl->IsChecked())
- {
- break;
- }
- }
- }
- }
-
- m_pWidget->SetCheck(bNewChecked, FALSE);
- m_pWidget->UpdateField();
- SetChangeMark();
- }
+void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
+
+ if (CPWL_RadioButton* pWnd =
+ (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) {
+ FX_BOOL bNewChecked = pWnd->IsChecked();
+
+ if (bNewChecked) {
+ CPDF_FormField* pField = m_pWidget->GetFormField();
+ ASSERT(pField != NULL);
+
+ for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) {
+ if (CPDF_FormControl* pCtrl = pField->GetControl(i)) {
+ if (pCtrl->IsChecked()) {
+ break;
+ }
+ }
+ }
+ }
+
+ m_pWidget->SetCheck(bNewChecked, FALSE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
+ }
}
-
diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp
index dbcf4e5739..38d74f065c 100644
--- a/fpdfsdk/src/formfiller/FFL_TextField.cpp
+++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp
@@ -7,380 +7,317 @@
#include "../../include/formfiller/FFL_TextField.h"
#include "../../include/formfiller/FFL_CBA_Fontmap.h"
-/* ------------------------------- CFFL_TextField ------------------------------- */
+/* ------------------------------- CFFL_TextField
+ * ------------------------------- */
-CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) :
- CFFL_FormFiller(pApp, pAnnot),
- m_pFontMap(NULL)//,
- //m_pSpellCheck(NULL)
+CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
+ : CFFL_FormFiller(pApp, pAnnot),
+ m_pFontMap(NULL) //,
+// m_pSpellCheck(NULL)
{
- m_State.nStart = m_State.nEnd = 0;
+ m_State.nStart = m_State.nEnd = 0;
}
-CFFL_TextField::~CFFL_TextField()
-{
- delete m_pFontMap;
+CFFL_TextField::~CFFL_TextField() {
+ delete m_pFontMap;
}
-PWL_CREATEPARAM CFFL_TextField::GetCreateParam()
-{
- PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
-
- ASSERT(m_pWidget != NULL);
- int nFlags = m_pWidget->GetFieldFlags();
+PWL_CREATEPARAM CFFL_TextField::GetCreateParam() {
+ PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
+ ASSERT(m_pWidget != NULL);
+ int nFlags = m_pWidget->GetFieldFlags();
- if (nFlags & FIELDFLAG_PASSWORD)
- {
- cp.dwFlags |= PES_PASSWORD;
- }
+ if (nFlags & FIELDFLAG_PASSWORD) {
+ cp.dwFlags |= PES_PASSWORD;
+ }
- if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK))
- {
- }
+ if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) {
+ }
- if (nFlags & FIELDFLAG_MULTILINE)
- {
- cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP;
+ if (nFlags & FIELDFLAG_MULTILINE) {
+ cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP;
- if (!(nFlags & FIELDFLAG_DONOTSCROLL))
- {
- cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL;
- }
+ if (!(nFlags & FIELDFLAG_DONOTSCROLL)) {
+ cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL;
}
- else
- {
- cp.dwFlags |= PES_CENTER;
+ } else {
+ cp.dwFlags |= PES_CENTER;
- if (!(nFlags & FIELDFLAG_DONOTSCROLL))
- {
- cp.dwFlags |= PES_AUTOSCROLL;
- }
+ if (!(nFlags & FIELDFLAG_DONOTSCROLL)) {
+ cp.dwFlags |= PES_AUTOSCROLL;
}
+ }
- if (nFlags & FIELDFLAG_COMB)
- {
- cp.dwFlags |= PES_CHARARRAY;
- }
+ if (nFlags & FIELDFLAG_COMB) {
+ cp.dwFlags |= PES_CHARARRAY;
+ }
- if (nFlags & FIELDFLAG_RICHTEXT)
- {
- cp.dwFlags |= PES_RICH;
- }
+ if (nFlags & FIELDFLAG_RICHTEXT) {
+ cp.dwFlags |= PES_RICH;
+ }
- cp.dwFlags |= PES_UNDO;
+ cp.dwFlags |= PES_UNDO;
- switch (m_pWidget->GetAlignment())
- {
+ switch (m_pWidget->GetAlignment()) {
default:
case BF_ALIGN_LEFT:
- cp.dwFlags |= PES_LEFT;
- break;
+ cp.dwFlags |= PES_LEFT;
+ break;
case BF_ALIGN_MIDDLE:
- cp.dwFlags |= PES_MIDDLE;
- break;
+ cp.dwFlags |= PES_MIDDLE;
+ break;
case BF_ALIGN_RIGHT:
- cp.dwFlags |= PES_RIGHT;
- break;
- }
+ cp.dwFlags |= PES_RIGHT;
+ break;
+ }
+
+ if (!m_pFontMap) {
+ m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler());
+ m_pFontMap->Initial();
+ }
+ cp.pFontMap = m_pFontMap;
+ cp.pFocusHandler = this;
+
+ return cp;
+}
- if (!m_pFontMap)
- {
- m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler());
- m_pFontMap->Initial();
+CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) {
+ CPWL_Edit* pWnd = new CPWL_Edit();
+ pWnd->AttachFFLData(this);
+ pWnd->Create(cp);
+
+ ASSERT(m_pApp != NULL);
+ CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+ pWnd->SetFillerNotify(pIFormFiller);
+
+ ASSERT(m_pWidget != NULL);
+ int32_t nMaxLen = m_pWidget->GetMaxLen();
+ CFX_WideString swValue = m_pWidget->GetValue();
+
+ if (nMaxLen > 0) {
+ if (pWnd->HasFlag(PES_CHARARRAY)) {
+ pWnd->SetCharArray(nMaxLen);
+ pWnd->SetAlignFormatV(PEAV_CENTER);
+ } else {
+ pWnd->SetLimitChar(nMaxLen);
}
- cp.pFontMap = m_pFontMap;
- cp.pFocusHandler = this;
+ }
- return cp;
+ pWnd->SetText(swValue.c_str());
+ return pWnd;
}
-CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
-{
- CPWL_Edit * pWnd = new CPWL_Edit();
- pWnd->AttachFFLData(this);
- pWnd->Create(cp);
-
-
-
- ASSERT(m_pApp != NULL);
- CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
- pWnd->SetFillerNotify(pIFormFiller);
-
- ASSERT(m_pWidget != NULL);
- int32_t nMaxLen = m_pWidget->GetMaxLen();
- CFX_WideString swValue = m_pWidget->GetValue();
-
- if (nMaxLen > 0)
- {
- if (pWnd->HasFlag(PES_CHARARRAY))
- {
- pWnd->SetCharArray(nMaxLen);
- pWnd->SetAlignFormatV(PEAV_CENTER);
- }
- else
- {
- pWnd->SetLimitChar(nMaxLen);
+FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot,
+ FX_UINT nChar,
+ FX_UINT nFlags) {
+ switch (nChar) {
+ case FWL_VKEY_Return:
+ if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
+ m_bValid = !m_bValid;
+ CPDF_Rect rcAnnot = pAnnot->GetRect();
+ m_pApp->FFI_Invalidate(pAnnot->GetPDFXFAPage(), rcAnnot.left,
+ rcAnnot.top, rcAnnot.right, rcAnnot.bottom);
+
+ if (m_bValid) {
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
+ pWnd->SetFocus();
+ } else {
+ if (CommitData(pPageView, nFlags)) {
+ DestroyPDFWindow(pPageView);
+ return TRUE;
+ } else {
+ return FALSE;
+ }
}
+ }
+ break;
+ case FWL_VKEY_Escape: {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
+ EscapeFiller(pPageView, TRUE);
+ return TRUE;
}
+ }
- pWnd->SetText(swValue.c_str());
- return pWnd;
-}
-
-
-FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
-{
- switch (nChar)
- {
- case FWL_VKEY_Return:
- if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE))
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
- m_bValid = !m_bValid;
- CPDF_Rect rcAnnot = pAnnot->GetRect();
- m_pApp->FFI_Invalidate(pAnnot->GetPDFXFAPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom);
-
- if (m_bValid)
- {
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
- pWnd->SetFocus();
- }
- else
- {
- if (CommitData(pPageView, nFlags))
- {
- DestroyPDFWindow(pPageView);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- }
- break;
- case FWL_VKEY_Escape:
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
- EscapeFiller(pPageView,TRUE);
- return TRUE;
- }
- }
-
- return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+ return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
}
-FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView)
-{
- ASSERT(m_pWidget != NULL);
+FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
- if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- return pEdit->GetText() != m_pWidget->GetValue();
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+ return pEdit->GetText() != m_pWidget->GetValue();
- return FALSE;
+ return FALSE;
}
-void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView)
-{
- ASSERT(m_pWidget != NULL);
+void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) {
+ ASSERT(m_pWidget != NULL);
- if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- {
- CFX_WideString sOldValue = m_pWidget->GetValue();
- CFX_WideString sNewValue = pWnd->GetText();
+ if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
+ CFX_WideString sOldValue = m_pWidget->GetValue();
+ CFX_WideString sNewValue = pWnd->GetText();
- m_pWidget->SetValue(sNewValue, FALSE);
- m_pWidget->ResetFieldAppearance(TRUE);
- m_pWidget->UpdateField();
- SetChangeMark();
- }
+ m_pWidget->SetValue(sNewValue, FALSE);
+ m_pWidget->ResetFieldAppearance(TRUE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
+ }
}
-void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa)
-{
- switch (type)
- {
+void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa) {
+ switch (type) {
case CPDF_AAction::KeyStroke:
- if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- {
- fa.bFieldFull = pWnd->IsTextFull();
+ if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
+ fa.bFieldFull = pWnd->IsTextFull();
- fa.sValue = pWnd->GetText();
+ fa.sValue = pWnd->GetText();
- if (fa.bFieldFull)
- {
- fa.sChange = L"";
- fa.sChangeEx = L"";
- }
+ if (fa.bFieldFull) {
+ fa.sChange = L"";
+ fa.sChangeEx = L"";
}
- break;
+ }
+ break;
case CPDF_AAction::Validate:
- if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- {
- fa.sValue = pWnd->GetText();
- }
- break;
+ if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
+ fa.sValue = pWnd->GetText();
+ }
+ break;
case CPDF_AAction::LoseFocus:
case CPDF_AAction::GetFocus:
- ASSERT(m_pWidget != NULL);
- fa.sValue = m_pWidget->GetValue();
- break;
+ ASSERT(m_pWidget != NULL);
+ fa.sValue = m_pWidget->GetValue();
+ break;
default:
- break;
- }
+ break;
+ }
}
-void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa)
-{
- switch (type)
- {
+void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa) {
+ switch (type) {
case CPDF_AAction::KeyStroke:
- if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- {
- pEdit->SetFocus();
- pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
- pEdit->ReplaceSel(fa.sChange.c_str());
- }
- break;
+ if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
+ pEdit->SetFocus();
+ pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
+ pEdit->ReplaceSel(fa.sChange.c_str());
+ }
+ break;
default:
- break;
- }
+ break;
+ }
}
-
-FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew)
-{
- switch (type)
- {
+FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew) {
+ switch (type) {
case CPDF_AAction::KeyStroke:
- return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nSelStart != faNew.nSelStart ||
- faOld.sChange != faNew.sChange;
+ return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) ||
+ faOld.nSelStart != faNew.nSelStart ||
+ faOld.sChange != faNew.sChange;
default:
- break;
- }
+ break;
+ }
- return FALSE;
+ return FALSE;
}
-void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView)
-{
- ASSERT(pPageView != NULL);
+void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) {
+ ASSERT(pPageView != NULL);
- if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- {
- pWnd->GetSel(m_State.nStart, m_State.nEnd);
- m_State.sValue = pWnd->GetText();
- }
+ if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
+ pWnd->GetSel(m_State.nStart, m_State.nEnd);
+ m_State.sValue = pWnd->GetText();
+ }
}
-void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView)
-{
- ASSERT(pPageView != NULL);
+void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) {
+ ASSERT(pPageView != NULL);
- if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE))
- {
- pWnd->SetText(m_State.sValue.c_str());
- pWnd->SetSel(m_State.nStart, m_State.nEnd);
- }
+ if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) {
+ pWnd->SetText(m_State.sValue.c_str());
+ pWnd->SetSel(m_State.nStart, m_State.nEnd);
+ }
}
-CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue)
-{
- if (bRestoreValue)
- SaveState(pPageView);
+CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue) {
+ if (bRestoreValue)
+ SaveState(pPageView);
- DestroyPDFWindow(pPageView);
+ DestroyPDFWindow(pPageView);
- CPWL_Wnd* pRet = NULL;
+ CPWL_Wnd* pRet = NULL;
- if (bRestoreValue)
- {
- RestoreState(pPageView);
- pRet = GetPDFWindow(pPageView, FALSE);
- }
- else
- pRet = GetPDFWindow(pPageView, TRUE);
+ if (bRestoreValue) {
+ RestoreState(pPageView);
+ pRet = GetPDFWindow(pPageView, FALSE);
+ } else
+ pRet = GetPDFWindow(pPageView, TRUE);
- m_pWidget->UpdateField();
+ m_pWidget->UpdateField();
- return pRet;
+ return pRet;
}
-FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView)
-{
- if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->IsTextFull();
- }
+FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) {
+ if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
+ return pWnd->IsTextFull();
+ }
- return FALSE;
+ return FALSE;
}
-void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd)
-{
- ASSERT(m_pApp != NULL);
+void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
+ ASSERT(m_pApp != NULL);
- ASSERT(pWnd != NULL);
+ ASSERT(pWnd != NULL);
- if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT)
- {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(134);
- pEdit->SetCodePage(936);
+ 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->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);
- }
+ pEdit->SetEditNotify(this);
+ // pUndo->BeginEdit(pDocument);
+ }
}
-void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd)
-{
+void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {}
+FX_BOOL CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-FX_BOOL CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument)
-{
- return FALSE;
+FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument)
-{
- return FALSE;
-}
-
-FX_BOOL CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument)
-{
- return FALSE;
+FX_BOOL CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument) {
+ return FALSE;
}
-void CFFL_TextField::DoCopy(CPDFSDK_Document* pDocument)
-{
+void CFFL_TextField::DoCopy(CPDFSDK_Document* pDocument) {}
-}
+void CFFL_TextField::DoCut(CPDFSDK_Document* pDocument) {}
-void CFFL_TextField::DoCut(CPDFSDK_Document* pDocument)
-{
-}
-
-void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument)
-{
-
-}
-
-void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit)
-{
-}
+void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument) {}
+void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {}
diff --git a/fpdfsdk/src/formfiller/FFL_Utils.cpp b/fpdfsdk/src/formfiller/FFL_Utils.cpp
index 8d2d76d73c..d2ce56ac52 100644
--- a/fpdfsdk/src/formfiller/FFL_Utils.cpp
+++ b/fpdfsdk/src/formfiller/FFL_Utils.cpp
@@ -9,106 +9,91 @@
#include "../../include/formfiller/FormFiller.h"
#include "../../include/formfiller/FFL_Utils.h"
-CPDF_Rect CFFL_Utils::MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2)
-{
- CPDF_Rect rcRet;
+CPDF_Rect CFFL_Utils::MaxRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2) {
+ CPDF_Rect rcRet;
- rcRet.left = std::min(rect1.left, rect2.left);
- rcRet.bottom = std::min(rect1.bottom, rect2.bottom);
- rcRet.right = std::max(rect1.right, rect2.right);
- rcRet.top = std::max(rect1.top, rect2.top);
+ rcRet.left = std::min(rect1.left, rect2.left);
+ rcRet.bottom = std::min(rect1.bottom, rect2.bottom);
+ rcRet.right = std::max(rect1.right, rect2.right);
+ rcRet.top = std::max(rect1.top, rect2.top);
- return rcRet;
+ return rcRet;
}
-CPDF_Rect CFFL_Utils::InflateRect(const CPDF_Rect & crRect,const FX_FLOAT & fSize)
-{
- CPDF_Rect crNew(crRect.left - fSize,
- crRect.bottom - fSize,
- crRect.right + fSize,
- crRect.top + fSize);
- crNew.Normalize();
- return crNew;
+CPDF_Rect CFFL_Utils::InflateRect(const CPDF_Rect& crRect,
+ const FX_FLOAT& fSize) {
+ CPDF_Rect crNew(crRect.left - fSize, crRect.bottom - fSize,
+ crRect.right + fSize, crRect.top + fSize);
+ crNew.Normalize();
+ return crNew;
}
-CPDF_Rect CFFL_Utils::DeflateRect(const CPDF_Rect & crRect,const FX_FLOAT & fSize)
-{
- CPDF_Rect crNew(crRect.left + fSize,
- crRect.bottom + fSize,
- crRect.right - fSize,
- crRect.top - fSize);
- crNew.Normalize();
- return crNew;
+CPDF_Rect CFFL_Utils::DeflateRect(const CPDF_Rect& crRect,
+ const FX_FLOAT& fSize) {
+ CPDF_Rect crNew(crRect.left + fSize, crRect.bottom + fSize,
+ crRect.right - fSize, crRect.top - fSize);
+ crNew.Normalize();
+ return crNew;
}
-FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj)
-{
- if (!pObj) return FALSE;
-
- FX_DWORD dwObjNum = pObj->GetObjNum();
- switch (pObj->GetType())
- {
- case PDFOBJ_ARRAY:
- {
- CPDF_Array* pArray = (CPDF_Array*)pObj;
- for (FX_DWORD i = 0; i < pArray->GetCount(); i ++)
- {
- CPDF_Object* pElement = pArray->GetElementValue(i);
- TraceObject(pElement);
- }
- }
- break;
-
- case PDFOBJ_DICTIONARY:
- {
- CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
-
- FX_POSITION fPos = pDict->GetStartPos();
- CFX_ByteString csKey;
- do
- {
- CPDF_Object* pElement = pDict->GetNextElement(fPos, csKey);
- //TRACE(csKey + "\n");
- if (!pElement) break;
- TraceObject(pElement);
- }while (TRUE);
- }
- break;
-
- case PDFOBJ_STREAM:
- {
- CPDF_Stream* pStream = (CPDF_Stream*)pObj;
- CPDF_Dictionary* pDict = pStream->GetDict();
- TraceObject(pDict);
- }
- break;
-
- case PDFOBJ_REFERENCE:
- {
- CPDF_Object* pDirectObj = pObj->GetDirect();
- TraceObject(pDirectObj);
- }
- break;
-
- case PDFOBJ_BOOLEAN:
- break;
- case PDFOBJ_NUMBER:
- //TRACE("%d\n",(int32_t)pObj);
- break;
- case PDFOBJ_STRING:
- //TRACE(((CPDF_String*)pObj)->GetString() + "\n");
- break;
- case PDFOBJ_NAME:
- //TRACE(((CPDF_Name*)pObj)->GetString() + "\n");
- break;
- case PDFOBJ_NULL:
-// case PDFOBJ_KEYWORD:
-// case PDFOBJ_EOF:
- default:
- break;
- }
- if (dwObjNum == 0) return FALSE;
-
- return TRUE;
+FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj) {
+ if (!pObj)
+ return FALSE;
+
+ FX_DWORD dwObjNum = pObj->GetObjNum();
+ switch (pObj->GetType()) {
+ case PDFOBJ_ARRAY: {
+ CPDF_Array* pArray = (CPDF_Array*)pObj;
+ for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ CPDF_Object* pElement = pArray->GetElementValue(i);
+ TraceObject(pElement);
+ }
+ } break;
+
+ case PDFOBJ_DICTIONARY: {
+ CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
+
+ FX_POSITION fPos = pDict->GetStartPos();
+ CFX_ByteString csKey;
+ do {
+ CPDF_Object* pElement = pDict->GetNextElement(fPos, csKey);
+ // TRACE(csKey + "\n");
+ if (!pElement)
+ break;
+ TraceObject(pElement);
+ } while (TRUE);
+ } break;
+
+ case PDFOBJ_STREAM: {
+ CPDF_Stream* pStream = (CPDF_Stream*)pObj;
+ CPDF_Dictionary* pDict = pStream->GetDict();
+ TraceObject(pDict);
+ } break;
+
+ case PDFOBJ_REFERENCE: {
+ CPDF_Object* pDirectObj = pObj->GetDirect();
+ TraceObject(pDirectObj);
+ } break;
+
+ case PDFOBJ_BOOLEAN:
+ break;
+ case PDFOBJ_NUMBER:
+ // TRACE("%d\n",(int32_t)pObj);
+ break;
+ case PDFOBJ_STRING:
+ // TRACE(((CPDF_String*)pObj)->GetString() + "\n");
+ break;
+ case PDFOBJ_NAME:
+ // TRACE(((CPDF_Name*)pObj)->GetString() + "\n");
+ break;
+ case PDFOBJ_NULL:
+ // case PDFOBJ_KEYWORD:
+ // case PDFOBJ_EOF:
+ default:
+ break;
+ }
+ if (dwObjNum == 0)
+ return FALSE;
+
+ return TRUE;
}
-