summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-21 14:07:23 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-21 14:07:23 -0700
commitbf59a070593d079256161f6ff47148df309668c7 (patch)
tree0c105507a20881f8f025127183510fefb851c3ce /fpdfsdk/include
parent63dfaab17af7121653749bc86d11fc77b5353dca (diff)
downloadpdfium-bf59a070593d079256161f6ff47148df309668c7.tar.xz
XFA: add CPDFDocumentToFPDFDocument()
Abstracts away that master returns CPDF_Documents directly, but XFA wraps them with a CPDFXFA_Document. Tidy dead code along the way. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1415803002 .
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h6
-rw-r--r--fpdfsdk/include/fsdk_baseform.h19
-rw-r--r--fpdfsdk/include/fsdk_define.h4
-rw-r--r--fpdfsdk/include/fsdk_mgr.h5
4 files changed, 19 insertions, 15 deletions
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
index 3c33338b39..0564ed0c4c 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
@@ -215,14 +215,14 @@ class CPDFXFA_Document : public IXFA_DocProvider {
}
}
+ int m_iDocType;
CPDF_Document* m_pPDFDoc;
+ CPDFSDK_Document* m_pSDKDoc;
IXFA_Doc* m_pXFADoc;
IXFA_DocView* m_pXFADocView;
- CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
- CPDFSDK_Document* m_pSDKDoc;
CPDFXFA_App* m_pApp;
IJS_Context* m_pJSContext;
- int m_iDocType;
+ CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
};
#endif // FPDFXFA_DOC_H_
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index da57430397..07d21bbaae 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -66,9 +66,9 @@ typedef struct _PDFSDK_FieldAction {
class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
public:
- IXFA_Widget* GetMixXFAWidget();
+ IXFA_Widget* GetMixXFAWidget() const;
IXFA_Widget* GetGroupMixXFAWidget();
- IXFA_WidgetHandler* GetXFAWidgetHandler();
+ IXFA_WidgetHandler* GetXFAWidgetHandler() const;
FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT);
FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
@@ -114,14 +114,14 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
FX_BOOL GetTextColor(FX_COLORREF& color) const;
FX_FLOAT GetFontSize() const;
- int GetSelectedIndex(int nIndex);
- CFX_WideString GetValue(FX_BOOL bDisplay = TRUE);
+ int GetSelectedIndex(int nIndex) const;
+ CFX_WideString GetValue(FX_BOOL bDisplay = TRUE) const;
CFX_WideString GetDefaultValue() const;
CFX_WideString GetOptionLabel(int nIndex) const;
int CountOptions() const;
- FX_BOOL IsOptionSelected(int nIndex);
+ FX_BOOL IsOptionSelected(int nIndex) const;
int GetTopVisibleIndex() const;
- FX_BOOL IsChecked();
+ FX_BOOL IsChecked() const;
/*
BF_ALIGN_LEFT
BF_ALIGN_MIDDL
@@ -129,7 +129,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
*/
int GetAlignment() const;
int GetMaxLen() const;
- CFX_WideString GetName();
+ CFX_WideString GetName() const;
CFX_WideString GetAlternateName() const;
// Set Properties.
@@ -198,14 +198,13 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
public:
FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
- private:
CPDFSDK_InterForm* m_pInterForm;
FX_BOOL m_bAppModified;
int32_t m_nAppAge;
int32_t m_nValueAge;
- IXFA_Widget* m_hMixXFAWidget;
- IXFA_WidgetHandler* m_pWidgetHandler;
+ mutable IXFA_Widget* m_hMixXFAWidget;
+ mutable IXFA_WidgetHandler* m_pWidgetHandler;
};
class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index e001e751de..2faaf01298 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -87,8 +87,10 @@ class CFPDF_FileStream : public IFX_FileStream {
FX_FILESIZE m_nCurPos;
};
-// Conversions from FPDF_ types.
+// Conversions to/from FPDF_ types.
CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc);
+FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc);
+
CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page);
void DropContext(void* data);
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index 4c0ce1ea27..300ca2287e 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -475,7 +475,10 @@ class CPDFSDK_Document {
~CPDFSDK_Document();
CPDFSDK_InterForm* GetInterForm();
- CPDFXFA_Document* GetDocument() { return m_pDoc; }
+ CPDFXFA_Document* GetDocument() const { return m_pDoc; }
+ CPDF_Document* GetPDFDocument() const {
+ return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr;
+ }
int GetPageViewCount() const { return m_pageMap.size(); }
CPDFSDK_PageView* GetPageView(CPDFXFA_Page* pPDFXFAPage,