summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 19:24:08 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 19:24:08 -0700
commitbdf72c353af5b8a34ef5efdeddfff36d2089a158 (patch)
tree34258c3019152b41bbfd8f3332683dbc25c0c9da /core/include
parent88f0bafb4163d297b51055124d4d35b769905216 (diff)
downloadpdfium-bdf72c353af5b8a34ef5efdeddfff36d2089a158.tar.xz
Merge to XFA: Add new public APIs to find the z-order for links and widgets.
- Implement FPDFLink_GetLinkZOrderAtPoint(). - Implement FPDFPage_FormFieldZOrderAtPoint(). - Mark FPDPage_HasFormFieldAtPoint() as deprecated. - Modify CPDF_LinkList and CPDF_InterForm to support new APIs. - Clean up dead code in CPDF_LinkList and CPDF_InterForm. BUG=chromium:515837 R=jun_fang@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/1278053004 . (cherry picked from commit 24fbf134d43a7ec4226de3db601f0a617bbe428b) Review URL: https://codereview.chromium.org/1295893005 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h58
1 files changed, 16 insertions, 42 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index 6e444149e4..0d8dd3caec 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -8,6 +8,7 @@
#define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_
#include <map>
+#include <vector>
#include "../../../third_party/base/nonstd_unique_ptr.h"
#include "../fpdfapi/fpdf_parser.h"
@@ -32,7 +33,6 @@ class CPDF_FormNotify;
class CPDF_IconFit;
class CPDF_InterForm;
class CPDF_Link;
-class CPDF_LinkList;
class CPDF_LWinParam;
class CPDF_Metadata;
class CPDF_NumberTree;
@@ -358,29 +358,25 @@ class CPDF_FileSpec {
protected:
CPDF_Object* m_pObj;
};
+
class CPDF_LinkList {
public:
- CPDF_LinkList(CPDF_Document* pDoc) { m_pDocument = pDoc; }
-
+ CPDF_LinkList();
~CPDF_LinkList();
- CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y);
-
- int CountLinks(CPDF_Page* pPage);
-
- CPDF_Link GetLink(CPDF_Page* pPage, int index);
-
- CPDF_Document* GetDocument() const { return m_pDocument; }
-
- protected:
- CPDF_Document* m_pDocument;
+ CPDF_Link GetLinkAtPoint(CPDF_Page* pPage,
+ FX_FLOAT pdf_x,
+ FX_FLOAT pdf_y,
+ int* z_order);
- CFX_MapPtrToPtr m_PageMap;
+ private:
+ const std::vector<CPDF_Dictionary*>* GetPageLinks(CPDF_Page* pPage);
- CFX_PtrArray* GetPageLinks(CPDF_Page* pPage);
+ void LoadPageLinks(CPDF_Page* pPage, std::vector<CPDF_Dictionary*>* pList);
- void LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList);
+ std::map<FX_DWORD, std::vector<CPDF_Dictionary*>> m_PageMap;
};
+
class CPDF_Link {
public:
CPDF_Link() : m_pDict(nullptr) {}
@@ -644,29 +640,13 @@ class CPDF_InterForm : public CFX_PrivateData {
CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
- FX_DWORD CountControls(CFX_WideString csFieldName = L"");
-
- CPDF_FormControl* GetControl(FX_DWORD index,
- CFX_WideString csFieldName = L"");
-
- FX_BOOL IsValidFormControl(const void* pControl);
-
- int CountPageControls(CPDF_Page* pPage) const;
-
- CPDF_FormControl* GetPageControl(CPDF_Page* pPage, int index) const;
-
CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage,
FX_FLOAT pdf_x,
- FX_FLOAT pdf_y) const;
+ FX_FLOAT pdf_y,
+ int* z_order) const;
CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) const;
- FX_DWORD CountInternalFields(const CFX_WideString& csFieldName = L"") const;
-
- CPDF_Dictionary* GetInternalField(
- FX_DWORD index,
- const CFX_WideString& csFieldName = L"") const;
-
CPDF_Document* GetDocument() const { return m_pDocument; }
CPDF_Dictionary* GetFormDict() const { return m_pFormDict; }
@@ -740,14 +720,10 @@ class CPDF_InterForm : public CFX_PrivateData {
FX_BOOL ResetForm(FX_BOOL bNotify = FALSE);
- void ReloadForm();
-
CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; }
void SetFormNotify(const CPDF_FormNotify* pNotify);
- int GetPageWithWidget(int iCurPage, FX_BOOL bNext);
-
FX_BOOL IsUpdated() { return m_bUpdated; }
void ClearUpdatedFlag() { m_bUpdated = FALSE; }
@@ -790,7 +766,7 @@ class CPDF_InterForm : public CFX_PrivateData {
CPDF_Dictionary* m_pFormDict;
- CFX_MapPtrToPtr m_ControlMap;
+ std::map<const CPDF_Dictionary*, CPDF_FormControl*> m_ControlMap;
CFieldTree* m_pFieldTree;
@@ -834,8 +810,6 @@ class CPDF_FormField {
FX_DWORD GetFlags() { return m_Flags; }
- CPDF_InterForm* GetInterForm() const { return m_pForm; }
-
CPDF_Dictionary* GetFieldDict() const { return m_pDict; }
void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; }
@@ -1008,7 +982,7 @@ class CPDF_FormControl {
CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; }
- CFX_FloatRect GetRect();
+ CFX_FloatRect GetRect() const;
void DrawControl(CFX_RenderDevice* pDevice,
CFX_AffineMatrix* pMatrix,