summaryrefslogtreecommitdiff
path: root/xfa_test/FormFiller_Test
diff options
context:
space:
mode:
Diffstat (limited to 'xfa_test/FormFiller_Test')
-rw-r--r--xfa_test/FormFiller_Test/BookMarkView.cpp197
-rw-r--r--xfa_test/FormFiller_Test/BookMarkView.h67
-rw-r--r--xfa_test/FormFiller_Test/ChildFrm.cpp112
-rw-r--r--xfa_test/FormFiller_Test/ChildFrm.h64
-rw-r--r--xfa_test/FormFiller_Test/ConvertDlg.cpp65
-rw-r--r--xfa_test/FormFiller_Test/ConvertDlg.h47
-rw-r--r--xfa_test/FormFiller_Test/ExportPage.cpp189
-rw-r--r--xfa_test/FormFiller_Test/ExportPage.h59
-rw-r--r--xfa_test/FormFiller_Test/FX_SplitterWnd.cpp373
-rw-r--r--xfa_test/FormFiller_Test/FX_SplitterWnd.h44
-rw-r--r--xfa_test/FormFiller_Test/FindDlg.cpp73
-rw-r--r--xfa_test/FormFiller_Test/FindDlg.h50
-rw-r--r--xfa_test/FormFiller_Test/GotoPageDlg.cpp65
-rw-r--r--xfa_test/FormFiller_Test/GotoPageDlg.h48
-rw-r--r--xfa_test/FormFiller_Test/JS_ResponseDlg.cpp152
-rw-r--r--xfa_test/FormFiller_Test/JS_ResponseDlg.h64
-rw-r--r--xfa_test/FormFiller_Test/MainFrm.cpp238
-rw-r--r--xfa_test/FormFiller_Test/MainFrm.h56
-rw-r--r--xfa_test/FormFiller_Test/ReaderVC.cpp195
-rw-r--r--xfa_test/FormFiller_Test/ReaderVC.dsp460
-rw-r--r--xfa_test/FormFiller_Test/ReaderVC.h54
-rw-r--r--xfa_test/FormFiller_Test/ReaderVC.rc741
-rw-r--r--xfa_test/FormFiller_Test/ReaderVCDoc.cpp113
-rw-r--r--xfa_test/FormFiller_Test/ReaderVCDoc.h59
-rw-r--r--xfa_test/FormFiller_Test/ReaderVCView.cpp3750
-rw-r--r--xfa_test/FormFiller_Test/ReaderVCView.h375
-rw-r--r--xfa_test/FormFiller_Test/StdAfx.cpp8
-rw-r--r--xfa_test/FormFiller_Test/StdAfx.h99
-rw-r--r--xfa_test/FormFiller_Test/TestJsDlg.cpp58
-rw-r--r--xfa_test/FormFiller_Test/TestJsDlg.h46
-rw-r--r--xfa_test/FormFiller_Test/ZoomDlg.cpp104
-rw-r--r--xfa_test/FormFiller_Test/ZoomDlg.h48
-rw-r--r--xfa_test/FormFiller_Test/res/BigHandCursor.curbin0 -> 326 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/Rd_SelText_Icon.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/Rd_SelText_Icon_Dis.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/ReaderVC.icobin0 -> 1078 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/ReaderVC.rc213
-rw-r--r--xfa_test/FormFiller_Test/res/ReaderVCDoc.icobin0 -> 1078 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/SmallHandCursor.curbin0 -> 326 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/Toolbar.bmpbin0 -> 5590 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/bookmark.bmpbin0 -> 2358 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/bound.curbin0 -> 326 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/point.curbin0 -> 326 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_actual_size.bmpbin0 -> 406 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_bookmark1.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_clockwise.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_counterclockwise.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_first.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_fit_page.bmpbin0 -> 406 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_fit_width.bmpbin0 -> 406 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hand1.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_about2.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_actual_size.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_bookmark1.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_clockwise.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_counterclockwise.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_first.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_first.xpm109
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_fit_page.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_fit_width.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_hand1.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_last.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_next.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_open1.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_prev.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_print.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_search.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_snap_shot.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_zoomin.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_hot_zoomout.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_last.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_next.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_prev.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_print.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_search.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_snap_shot.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_zoomin.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/res/tool_zoomout.bmpbin0 -> 1654 bytes
-rw-r--r--xfa_test/FormFiller_Test/resource.h113
79 files changed, 8308 insertions, 0 deletions
diff --git a/xfa_test/FormFiller_Test/BookMarkView.cpp b/xfa_test/FormFiller_Test/BookMarkView.cpp
new file mode 100644
index 0000000000..283c9a47cc
--- /dev/null
+++ b/xfa_test/FormFiller_Test/BookMarkView.cpp
@@ -0,0 +1,197 @@
+// BookMarkView.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "ChildFrm.h"
+#include "BookMarkView.h"
+#include "ReaderVCDoc.h"
+#include "ReaderVCView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CBookMarkView
+
+IMPLEMENT_DYNCREATE(CBookMarkView, CTreeView)
+
+CBookMarkView::CBookMarkView()
+{
+ m_pFram = NULL;
+ m_pDoc = NULL;
+}
+
+CBookMarkView::~CBookMarkView()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CBookMarkView, CTreeView)
+ //{{AFX_MSG_MAP(CBookMarkView)
+ ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CBookMarkView drawing
+
+void CBookMarkView::OnDraw(CDC* pDC)
+{
+ CReaderVCDoc* pDoc = GetDocument();
+ // TODO: add draw code here
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CBookMarkView diagnostics
+
+#ifdef _DEBUG
+void CBookMarkView::AssertValid() const
+{
+ CTreeView::AssertValid();
+}
+
+void CBookMarkView::Dump(CDumpContext& dc) const
+{
+ CTreeView::Dump(dc);
+}
+
+CReaderVCDoc* CBookMarkView::GetDocument() // non-debug version is inline
+{
+ ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CReaderVCDoc)));
+ return (CReaderVCDoc*)m_pDocument;
+}
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CBookMarkView message handlers
+
+void CBookMarkView::OnInitialUpdate()
+{
+ CTreeView::OnInitialUpdate();
+ CReaderVCDoc* pDoc = GetDocument();
+ if (! m_pFram || !m_pFram->m_pView)
+ return;
+ m_pDoc = m_pFram->m_pView->GetPDFDoc();
+ if(m_pDoc == NULL) return;
+ int num = m_pFram->m_pView->GetTotalPages();
+ CString strName = pDoc->GetTitle();
+ FPDF_BOOKMARK bookmark1 = NULL;
+
+ //////////////////////////////////////////////////////////////////////////
+ //insert items
+
+// CTreeCtrl &treeCtrl = this->GetTreeCtrl();
+// m_hItemRoot = treeCtrl.InsertItem(strName,0,0,TVI_ROOT,TVI_FIRST);
+// treeCtrl.SetItemData(m_hItemRoot,0);
+// bookmark1 = FPDFBookmark_GetFirstChild(m_pDoc, NULL);
+// if (bookmark1 == NULL)//insert the page index to tree
+// {
+// for (int i=0; i<num; i++)
+// {
+// CString str;
+// str.Format(_T("Page%d"), i+1);
+// HTREEITEM hItem = treeCtrl.InsertItem(str);
+// treeCtrl.SetItemData(hItem, i);
+// }
+// }else{
+// while(bookmark1 != NULL) {
+// this->InsertChildItem(bookmark1, m_hItemRoot, treeCtrl);
+// bookmark1 = FPDFBookmark_GetNextSibling(m_pDoc,bookmark1);
+// }
+// }
+// treeCtrl.Expand(m_hItemRoot,TVE_EXPAND);
+//
+// LONG nStyle = ::GetWindowLong(this->m_hWnd, GWL_STYLE);
+// nStyle |= TVS_LINESATROOT;
+// nStyle |= TVS_HASLINES;
+// nStyle |= TVS_HASBUTTONS;
+// ::SetWindowLong(this->m_hWnd, GWL_STYLE, nStyle);
+
+}
+
+void CBookMarkView::InsertChildItem(FPDF_BOOKMARK bookmark, HTREEITEM hItem, CTreeCtrl &treectrl)
+{
+
+// CString strTitle;
+// DWORD dwItemData = 0;
+// WCHAR buffer[1024];
+// CString str;
+// int strlenth = 0;
+// unsigned long pdf_actType = 0;
+// //FPDF_BOOKMARK
+// FPDF_DEST dest = NULL;
+// FPDF_ACTION action = NULL;
+//
+// memset(buffer,0,1024*sizeof(WCHAR));
+// strlenth = FPDFBookmark_GetTitle(bookmark, buffer, 0);
+// int nlen = WideCharToMultiByte(CP_ACP,0,buffer,-1,NULL,NULL,NULL,NULL);
+// char *buffer1 = new char[nlen];
+// memset(buffer1,0,nlen);
+// WideCharToMultiByte(CP_ACP,0,buffer,strlenth,buffer1,nlen,NULL,NULL);
+// buffer1[nlen -1] = '\0';
+// /* int strl = strlen(buffer1);
+// strTitle = buffer;//
+// strTitle = strTitle.Left(strl-1);*/
+// hItem = treectrl.InsertItem(buffer1, 0, 0, hItem, TVI_LAST);
+// action = FPDFBookmark_GetAction(bookmark);
+// if (action != NULL)
+// {
+// pdf_actType = FPDFAction_GetType(action);
+// if (pdf_actType == 1)
+// {
+// dest = FPDFAction_GetDest(m_pDoc, action);
+// dwItemData = FPDFDest_GetPageIndex(m_pDoc, dest);
+// int nZoomMode = FPDFDest_GetZoomMode(dest);
+// if(nZoomMode == 1)
+// {
+// double nStartX = FPDFDest_GetZoomParam(dest, 0);
+// double nStartY = FPDFDest_GetZoomParam(dest, 1);
+// CPoint pos((int)nStartX, (int)nStartY);
+// m_PosMap.SetAt(hItem, pos);
+// }
+// treectrl.SetItemData(hItem, dwItemData);
+//
+// }else{
+// dwItemData = 0;
+// treectrl.SetItemData(hItem, dwItemData);
+// }
+//
+// }else{
+// dest = FPDFBookmark_GetDest(m_pDoc, bookmark);
+// dwItemData = FPDFDest_GetPageIndex(m_pDoc, dest);
+// treectrl.SetItemData(hItem, dwItemData);
+// }
+//
+// bookmark = FPDFBookmark_GetFirstChild(m_pDoc, bookmark);
+// while(bookmark != NULL)
+// {
+// this->InsertChildItem(bookmark, hItem, treectrl);
+// bookmark = FPDFBookmark_GetNextSibling(m_pDoc, bookmark);
+// }
+// delete buffer1;
+}
+
+void CBookMarkView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
+ // TODO: Add your control notification handler code here
+ HTREEITEM hItem;
+ DWORD dwPageIdex= 0;
+ if(m_pDoc == NULL) return;
+ hItem = GetTreeCtrl().GetSelectedItem();
+ dwPageIdex = GetTreeCtrl().GetItemData(hItem);
+ CPoint p;
+ if(0 == m_PosMap.Lookup(hItem, p))
+ {
+ p.x = 0;
+ p.y = 0;
+ }
+ m_pFram->m_pView->LoadPDFPage(m_pDoc, dwPageIdex, p);
+ m_pFram->m_pView->Invalidate();
+ *pResult = 0;
+}
+
diff --git a/xfa_test/FormFiller_Test/BookMarkView.h b/xfa_test/FormFiller_Test/BookMarkView.h
new file mode 100644
index 0000000000..d10964c0ec
--- /dev/null
+++ b/xfa_test/FormFiller_Test/BookMarkView.h
@@ -0,0 +1,67 @@
+#if !defined(AFX_BOOKMARKVIEW_H__B1EB2803_BE21_4768_A54B_2DE1E0FC968A__INCLUDED_)
+#define AFX_BOOKMARKVIEW_H__B1EB2803_BE21_4768_A54B_2DE1E0FC968A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// BookMarkView.h : header file
+//
+
+class CChildFrame;
+class CReaderVCDoc;
+/////////////////////////////////////////////////////////////////////////////
+// CBookMarkView view
+
+class CBookMarkView : public CTreeView
+{
+protected:
+ CBookMarkView(); // protected constructor used by dynamic creation
+ DECLARE_DYNCREATE(CBookMarkView)
+
+// Attributes
+public:
+ CChildFrame *m_pFram;
+ FPDF_DOCUMENT m_pDoc;
+ HTREEITEM m_hItemRoot;
+ CReaderVCDoc* GetDocument();
+// Operations
+public:
+ void InsertChildItem(FPDF_BOOKMARK bookmark, HTREEITEM hItem, CTreeCtrl &treectrl);
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CBookMarkView)
+ public:
+ virtual void OnInitialUpdate();
+ protected:
+ virtual void OnDraw(CDC* pDC); // overridden to draw this view
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ virtual ~CBookMarkView();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+ // Generated message map functions
+protected:
+ //{{AFX_MSG(CBookMarkView)
+ afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+private:
+ CMap<HTREEITEM, HTREEITEM&, CPoint, CPoint&> m_PosMap;
+};
+
+#ifndef _DEBUG // debug version in PDFReaderVCView.cpp
+inline CReaderVCDoc* CBookMarkView::GetDocument()
+{ return (CReaderVCDoc*)m_pDocument; }
+#endif
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_BOOKMARKVIEW_H__B1EB2803_BE21_4768_A54B_2DE1E0FC968A__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ChildFrm.cpp b/xfa_test/FormFiller_Test/ChildFrm.cpp
new file mode 100644
index 0000000000..8d32a72ac7
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ChildFrm.cpp
@@ -0,0 +1,112 @@
+// ChildFrm.cpp : implementation of the CChildFrame class
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+
+#include "ChildFrm.h"
+#include "FX_SplitterWnd.h"
+#include "BookmarkView.h"
+#include "ReaderVCView.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CChildFrame
+
+IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
+
+BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
+ //{{AFX_MSG_MAP(CChildFrame)
+ ON_WM_SIZE()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CChildFrame construction/destruction
+
+CChildFrame::CChildFrame()
+{
+ // TODO: add member initialization code here
+ //m_nPosH = m_nPosV = 0;
+// m_pBkView = NULL;
+ m_pView = NULL;
+// m_bBookmark = FALSE;
+}
+
+CChildFrame::~CChildFrame()
+{
+/* if (m_pBkView != NULL)
+ {
+ delete m_pBkView;
+ m_pBkView = NULL;
+ }
+ if (m_pView != NULL)
+ {
+ delete m_pView;
+ m_pView = NULL;
+ }*/
+}
+
+BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+
+ if( !CMDIChildWnd::PreCreateWindow(cs) )
+ return FALSE;
+ cs.style |= WS_MAXIMIZE | WS_VISIBLE;
+ return TRUE;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CChildFrame diagnostics
+
+#ifdef _DEBUG
+void CChildFrame::AssertValid() const
+{
+ CMDIChildWnd::AssertValid();
+}
+
+void CChildFrame::Dump(CDumpContext& dc) const
+{
+ CMDIChildWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CChildFrame message handlers
+
+
+
+
+
+void CChildFrame::OnSize(UINT nType, int cx, int cy)
+{
+ CMDIChildWnd::OnSize(nType, cx, cy);
+
+
+}
+
+BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
+{
+ if ( !m_wndSplitter.CreateStatic( this, 1, 2 ) ||
+ !m_wndSplitter.CreateView( 0,0,RUNTIME_CLASS(CBookMarkView),CSize(180,0),pContext )||
+ !m_wndSplitter.CreateView( 0,1,pContext->m_pNewViewClass,CSize(0,0),pContext ))
+ {
+ return FALSE;
+ }
+ m_pBkView = (CBookMarkView *)(m_wndSplitter.GetPane(0,0));
+ m_pBkView->m_pFram = this;
+ m_pView = (CReaderVCView*)(m_wndSplitter.GetPane(0,1));
+ m_pView->m_pFram = this;
+ this->SetActiveView( (CView*)m_wndSplitter.GetPane(0,1) );
+
+ return TRUE;
+
+ //return CMDIChildWnd::OnCreateClient(lpcs, pContext);
+}
diff --git a/xfa_test/FormFiller_Test/ChildFrm.h b/xfa_test/FormFiller_Test/ChildFrm.h
new file mode 100644
index 0000000000..dcfc7bd8bc
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ChildFrm.h
@@ -0,0 +1,64 @@
+// ChildFrm.h : interface of the CChildFrame class
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CHILDFRM_H__452F838E_A3F7_4BBF_B4BB_4765F4D394E7__INCLUDED_)
+#define AFX_CHILDFRM_H__452F838E_A3F7_4BBF_B4BB_4765F4D394E7__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+//class CFX_SplitterWnd;
+#include "FX_SplitterWnd.h"
+class CReaderVCView;
+class CBookMarkView;
+//class CFX_SplitterWnd;
+class CChildFrame : public CMDIChildWnd
+{
+ DECLARE_DYNCREATE(CChildFrame)
+public:
+ CChildFrame();
+
+// Attributes
+public:
+ CFX_SplitterWnd m_wndSplitter;
+ CReaderVCView* m_pView;
+ CBookMarkView* m_pBkView;
+// BOOL m_bBookmark;
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CChildFrame)
+ public:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ protected:
+ virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CChildFrame();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CChildFrame)
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+private:
+ //int m_nPosH, m_nPosV;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CHILDFRM_H__452F838E_A3F7_4BBF_B4BB_4765F4D394E7__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ConvertDlg.cpp b/xfa_test/FormFiller_Test/ConvertDlg.cpp
new file mode 100644
index 0000000000..ec31948144
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ConvertDlg.cpp
@@ -0,0 +1,65 @@
+// ConvertDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "ConvertDlg.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CConvertDlg dialog
+
+
+CConvertDlg::CConvertDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CConvertDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CConvertDlg)
+ m_nFlag = -1;
+ //}}AFX_DATA_INIT
+}
+
+
+void CConvertDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CConvertDlg)
+ DDX_Radio(pDX, IDC_RADIO_Stream, m_nFlag);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CConvertDlg, CDialog)
+ //{{AFX_MSG_MAP(CConvertDlg)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CConvertDlg message handlers
+
+BOOL CConvertDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // TODO: Add extra initialization here
+ m_pView = (CReaderVCView *)(((CChildFrame *)((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())->GetActiveView());
+ ASSERT(m_pView);
+ ((CButton *)GetDlgItem(IDC_RADIO_Appearance))->SetCheck(1);
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CConvertDlg::OnOK()
+{
+ // TODO: Add extra validation here
+ UpdateData(TRUE);
+ CDialog::OnOK();
+}
diff --git a/xfa_test/FormFiller_Test/ConvertDlg.h b/xfa_test/FormFiller_Test/ConvertDlg.h
new file mode 100644
index 0000000000..8ef993208a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ConvertDlg.h
@@ -0,0 +1,47 @@
+#if !defined(AFX_CONVERTDLG_H__9BB8EADD_CCDD_4C68_A8A0_C1656653A947__INCLUDED_)
+#define AFX_CONVERTDLG_H__9BB8EADD_CCDD_4C68_A8A0_C1656653A947__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ConvertDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CConvertDlg dialog
+class CReaderVCView;
+class CConvertDlg : public CDialog
+{
+// Construction
+public:
+ CConvertDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CConvertDlg)
+ enum { IDD = IDD_DLG_CONVERT };
+ int m_nFlag;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CConvertDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ CReaderVCView *m_pView;
+ // Generated message map functions
+ //{{AFX_MSG(CConvertDlg)
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CONVERTDLG_H__9BB8EADD_CCDD_4C68_A8A0_C1656653A947__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ExportPage.cpp b/xfa_test/FormFiller_Test/ExportPage.cpp
new file mode 100644
index 0000000000..76287a7d0b
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ExportPage.cpp
@@ -0,0 +1,189 @@
+// ExportPage.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "ExportPage.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CExportPage dialog
+
+
+CExportPage::CExportPage(CWnd* pParent /*=NULL*/)
+ : CDialog(CExportPage::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CExportPage)
+ m_nHeight = 0;
+ m_nPageHeight = 0;
+ m_nRotate = 0;
+ m_nWidth = 0;
+ m_nPageWidth = 0;
+ //}}AFX_DATA_INIT
+ m_bitmap = NULL;
+}
+
+
+void CExportPage::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CExportPage)
+ DDX_Text(pDX, IDC_EDIT_HEIGHT, m_nHeight);
+ DDX_Text(pDX, IDC_EDIT_PAGE_HEIGHT, m_nPageHeight);
+ DDX_Text(pDX, IDC_EDIT_ROTATE, m_nRotate);
+ DDX_Text(pDX, IDC_EDIT_WIDTH, m_nWidth);
+ DDX_Text(pDX, IDC_EDIT_PAGE_WIDTH, m_nPageWidth);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CExportPage, CDialog)
+ //{{AFX_MSG_MAP(CExportPage)
+ ON_BN_CLICKED(IDC_Rander_Page, OnRanderPage)
+ ON_BN_CLICKED(IDC_Save, OnSave)
+ ON_WM_PAINT()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CExportPage message handlers
+
+void CExportPage::OnRanderPage()
+{
+ if (m_pView)
+ {
+ UpdateData(TRUE);
+ m_page=m_pView->GetPage();
+ if (!m_page) return;
+ if (m_nRotate==1 || m_nRotate==3)
+ {
+ int temp;
+ temp=m_nHeight;
+ m_nHeight=m_nWidth;
+ m_nWidth=temp;
+ }
+ m_bitmap=FPDFBitmap_Create(m_nWidth,m_nHeight,FPDFBitmap_BGRx);
+ FPDFBitmap_FillRect(m_bitmap,0,0,m_nWidth,m_nHeight,0xff,0xff,0xff,0xff);
+ FPDF_RenderPageBitmap(m_bitmap,m_page,0,0,200,200,m_nRotate,FPDF_ANNOT);
+ Invalidate();
+ if (m_nRotate==1 || m_nRotate==3)
+ {
+ int temp;
+ temp=m_nHeight;
+ m_nHeight=m_nWidth;
+ m_nWidth=temp;
+ }
+ //FPDFBitmap_Destroy(bitmap);
+ UpdateData(FALSE);
+ }
+
+}
+
+void CExportPage::InitDialogInfo(CReaderVCView *pView)
+{
+ m_pView=pView;
+ if (pView) m_page=pView->GetPage();
+ SetDlgInfo();
+}
+
+void CExportPage::SetDlgInfo()
+{
+ if (!m_page) return;
+ double height,width;
+ width=FPDF_GetPageWidth(m_page);
+ height=FPDF_GetPageHeight(m_page);
+
+ UpdateData(TRUE);
+ m_nPageHeight = (int)height;
+ m_nPageWidth = (int)width;
+ m_nWidth=(int)width/3;
+ m_nHeight=(int)height/3;
+ UpdateData(FALSE);
+}
+
+void CExportPage::OnSave()
+{
+ CFileDialog SavDlg(FALSE,"","",OFN_FILEMUSTEXIST |OFN_HIDEREADONLY,"bmp(*.bmp)|*.bmp||All Files(*.*)|*.*");
+ if (SavDlg.DoModal()==IDOK)
+ {
+ CString strFileName = SavDlg.GetPathName();
+ BITMAPFILEHEADER bitmapFileHeader;
+ BITMAPINFOHEADER bitmapInfoHeader;
+ BITMAP strBitmap;
+ int wBitCount = 32;
+ winbmp.GetBitmap(&strBitmap);
+ DWORD dwBmBitsSize = ((strBitmap.bmWidth * wBitCount+31)/32) * 4 * strBitmap.bmHeight;
+
+ bitmapFileHeader.bfType = 0x4D42;
+ bitmapFileHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + dwBmBitsSize;
+ bitmapFileHeader.bfReserved1 = bitmapFileHeader.bfReserved2 = 0;
+ bitmapFileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
+
+ bitmapInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bitmapInfoHeader.biWidth = strBitmap.bmWidth;
+ bitmapInfoHeader.biHeight = strBitmap.bmHeight;
+ bitmapInfoHeader.biPlanes = 1;
+ bitmapInfoHeader.biBitCount = wBitCount;
+ bitmapInfoHeader.biClrImportant = BI_RGB;
+ bitmapInfoHeader.biSizeImage = 0; //strBitmap.bmWidth * strBitmap.bmHeight;
+ bitmapInfoHeader.biXPelsPerMeter = 0;
+ bitmapInfoHeader.biYPelsPerMeter = 0;
+ bitmapInfoHeader.biClrUsed = 0;
+ bitmapInfoHeader.biCompression = 0;
+
+ char* context = new char[dwBmBitsSize];
+ CWindowDC dc(NULL);
+ GetDIBits(dc.GetSafeHdc(), (HBITMAP)winbmp.m_hObject, 0, bitmapInfoHeader.biHeight, (LPVOID)context,(BITMAPINFO*)&bitmapInfoHeader, DIB_RGB_COLORS);
+
+ CFile file;
+ file.Open(strFileName, CFile::modeCreate|CFile::modeWrite);
+ file.Write(&bitmapFileHeader, sizeof(BITMAPFILEHEADER));
+ file.Write(&bitmapInfoHeader, sizeof(BITMAPINFOHEADER));
+ file.Write(context, dwBmBitsSize);
+
+ file.Close();
+ delete context;
+ }
+}
+
+void CExportPage::OnPaint()
+{
+ CPaintDC dc(this); // device context for painting
+
+ // TODO: Add your message handler code here
+ if(m_bitmap)
+ {
+ // CDC* pDc=GetDC();
+ int bufsize=FPDFBitmap_GetStride(m_bitmap)*m_nHeight;
+ void* bmpbuf=FPDFBitmap_GetBuffer(m_bitmap);
+ CDC MemDC;
+ CDC *pDc = GetDlgItem(IDC_STATIC_BITMAP)->GetDC(); //ID: picture
+ CRect rect;
+ ((CWnd *)GetDlgItem(IDC_STATIC_BITMAP))->GetWindowRect(rect);
+
+ MemDC.CreateCompatibleDC(pDc);
+ if((HBITMAP)winbmp != NULL)
+ winbmp.DeleteObject();
+ if(HBITMAP(winbmp) == NULL)
+ {
+ winbmp.CreateCompatibleBitmap(pDc,m_nWidth,m_nHeight);
+ winbmp.SetBitmapBits(bufsize,bmpbuf);
+ }
+
+ MemDC.SelectObject(&winbmp);
+
+ pDc->BitBlt(0 , 0 , rect.Width(), rect.Height(), &MemDC,0,0,SRCCOPY);
+ //pDc->StretchBlt(0,0,rect.right-rect.left,rect.bottom-rect.top,&MemDC,0,0,m_nWidth,m_nHeight,SRCCOPY);
+ MemDC.DeleteDC();
+ }
+ // Do not call CDialog::OnPaint() for painting messages
+}
diff --git a/xfa_test/FormFiller_Test/ExportPage.h b/xfa_test/FormFiller_Test/ExportPage.h
new file mode 100644
index 0000000000..1742991c76
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ExportPage.h
@@ -0,0 +1,59 @@
+#if !defined(AFX_EXPORTPAGE_H__D9B06547_96CA_4749_88CB_2506D8AF61D6__INCLUDED_)
+#define AFX_EXPORTPAGE_H__D9B06547_96CA_4749_88CB_2506D8AF61D6__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ExportPage.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CExportPage dialog
+class CReaderVCView;
+
+class CExportPage : public CDialog
+{
+// Construction
+public:
+ CBitmap winbmp;
+ FPDF_BITMAP m_bitmap;
+ FPDF_PAGE m_page;
+ CReaderVCView *m_pView;
+ void SetDlgInfo();
+ void InitDialogInfo(CReaderVCView *pView);
+ CExportPage(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CExportPage)
+ enum { IDD = IDD_EXPORT_PAGE };
+ int m_nHeight;
+ int m_nPageHeight;
+ int m_nRotate;
+ int m_nWidth;
+ int m_nPageWidth;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CExportPage)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CExportPage)
+ afx_msg void OnRanderPage();
+ afx_msg void OnSave();
+ afx_msg void OnPaint();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_EXPORTPAGE_H__D9B06547_96CA_4749_88CB_2506D8AF61D6__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/FX_SplitterWnd.cpp b/xfa_test/FormFiller_Test/FX_SplitterWnd.cpp
new file mode 100644
index 0000000000..4024bb5c91
--- /dev/null
+++ b/xfa_test/FormFiller_Test/FX_SplitterWnd.cpp
@@ -0,0 +1,373 @@
+// FX_SplitterWnd.cpp: implementation of the CFX_SplitterWnd class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+//#include "teststatusbar.h"
+#include "FX_SplitterWnd.h"
+
+#include <afxpriv.h>
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CFX_SplitterWnd::CFX_SplitterWnd()
+{
+ m_cxSplitter = m_cySplitter = 4 + 1 + 1;
+ m_cxBorderShare = m_cyBorderShare = 0;
+ m_cxSplitterGap = m_cySplitterGap = 4 + 1 + 1;
+ m_cxBorder = m_cyBorder = 1;
+ m_nHidedCol = -1;
+ m_bBarLocked = FALSE;
+}
+
+CFX_SplitterWnd::~CFX_SplitterWnd()
+{
+
+}
+
+BEGIN_MESSAGE_MAP(CFX_SplitterWnd, CSplitterWnd)
+ //{{AFX_MSG_MAP(CFX_SplitterWnd)
+ ON_WM_LBUTTONDOWN()
+ ON_WM_MOUSEMOVE()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+void CFX_SplitterWnd::OnDrawSplitter(CDC *pDC,ESplitType nType,const CRect &rectArg)
+{
+ if((nType != splitBorder) || (pDC == NULL))
+ {
+ CSplitterWnd::OnDrawSplitter(pDC, nType, rectArg);
+ return;
+ }
+
+ pDC->Draw3dRect(rectArg, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));
+}
+void CFX_SplitterWnd::RecalcLayout()
+{
+ ASSERT_VALID(this);
+ ASSERT(m_nRows > 0 && m_nCols > 0); // must have at least one pane
+
+ CRect rectClient;
+ GetClientRect(rectClient);
+ rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
+
+ CRect rectInside;
+ GetInsideRect(rectInside);
+
+ // layout columns (restrict to possible sizes)
+ LayoutRowCol(m_pColInfo, m_nCols, rectInside.Width(), m_cxSplitterGap);
+ LayoutRowCol(m_pRowInfo, m_nRows, rectInside.Height(), m_cySplitterGap);
+
+ // adjust the panes (and optionally scroll bars)
+
+ // give the hint for the maximum number of HWNDs
+ AFX_SIZEPARENTPARAMS layout;
+ layout.hDWP = ::BeginDeferWindowPos((m_nCols + 1) * (m_nRows + 1) + 1);
+
+ // size of scrollbars
+ int cx = rectClient.right - rectInside.right;
+ int cy = rectClient.bottom - rectInside.bottom;
+
+ // reposition size box
+ if (m_bHasHScroll && m_bHasVScroll)
+ {
+ CWnd* pScrollBar = GetDlgItem(AFX_IDW_SIZE_BOX);
+ ASSERT(pScrollBar != NULL);
+
+ // fix style if necessary
+ BOOL bSizingParent = (GetSizingParent() != NULL);
+ // modifyStyle returns TRUE if style changes
+ if (pScrollBar->ModifyStyle(SBS_SIZEGRIP|SBS_SIZEBOX,
+ bSizingParent ? SBS_SIZEGRIP : SBS_SIZEBOX))
+ pScrollBar->Invalidate();
+ pScrollBar->EnableWindow(bSizingParent);
+
+ // reposition the size box
+ DeferClientPos(&layout, pScrollBar,
+ rectInside.right,
+ rectInside.bottom, cx, cy, TRUE);
+ }
+
+ // reposition scroll bars
+ if (m_bHasHScroll)
+ {
+ int cxSplitterBox = m_cxSplitter;// split box bigger
+ int x = rectClient.left;
+ int y = rectInside.bottom;
+ for (int col = 0; col < m_nCols; col++)
+ {
+ CWnd* pScrollBar = GetDlgItem(AFX_IDW_HSCROLL_FIRST + col);
+ ASSERT(pScrollBar != NULL);
+ int cx = m_pColInfo[col].nCurSize;
+ if (col == 0 && m_nCols < m_nMaxCols)
+ x += cxSplitterBox, cx -= cxSplitterBox;
+ DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE);
+ x += cx + m_cxSplitterGap;
+ }
+ }
+
+ if (m_bHasVScroll)
+ {
+ int cySplitterBox = m_cySplitter;// split box bigger
+ int x = rectInside.right;
+ int y = rectClient.top;
+ for (int row = 0; row < m_nRows; row++)
+ {
+ CWnd* pScrollBar = GetDlgItem(AFX_IDW_VSCROLL_FIRST + row);
+ ASSERT(pScrollBar != NULL);
+ int cy = m_pRowInfo[row].nCurSize;
+ if (row == 0 && m_nRows < m_nMaxRows)
+ y += cySplitterBox, cy -= cySplitterBox;
+ DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE);
+ y += cy + m_cySplitterGap;
+ }
+ }
+
+ //BLOCK: Reposition all the panes
+ {
+ int x = rectClient.left;
+ for (int col = 0; col < m_nCols; col++)
+ {
+ int cx = m_pColInfo[col].nCurSize;
+ int y = rectClient.top;
+ for (int row = 0; row < m_nRows; row++)
+ {
+ int cy = m_pRowInfo[row].nCurSize;
+ CWnd* pWnd = GetPane(row, col);
+ DeferClientPos(&layout, pWnd, x, y, cx, cy, FALSE);
+ y += cy + m_cySplitterGap;
+ }
+ x += cx + m_cxSplitterGap;
+ }
+ }
+
+ // move and resize all the windows at once!
+ if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
+ TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
+
+ // invalidate all the splitter bars (with NULL pDC)
+ DrawAllSplitBars(NULL, rectInside.right, rectInside.bottom);
+}
+
+void CFX_SplitterWnd::DeferClientPos(AFX_SIZEPARENTPARAMS *lpLayout,CWnd *pWnd,int x,int y,int cx,int cy,BOOL bScrollBar)
+{
+ ASSERT(pWnd != NULL);
+ ASSERT(pWnd->m_hWnd != NULL);
+
+ if (bScrollBar)
+ {
+ // if there is enough room, draw scroll bar without border
+ // if there is not enough room, set the WS_BORDER bit so that
+ // we will at least get a proper border drawn
+ BOOL bNeedBorder = (cx <= 1 || cy <= 1);
+ pWnd->ModifyStyle(bNeedBorder ? 0 : 1, bNeedBorder ? 1 : 0);
+ }
+ CRect rect(x, y, x+cx, y+cy);
+
+ // adjust for 3d border (splitter windows have implied border)
+ if ((pWnd->GetExStyle() & WS_EX_CLIENTEDGE) || pWnd->IsKindOf(RUNTIME_CLASS(CSplitterWnd)))
+ {
+ rect.InflateRect(1, 1); // for proper draw CFlatSplitterWnd in view
+// rect.InflateRect(afxData.cxBorder2, afxData.cyBorder2);
+ }
+
+ // first check if the new rectangle is the same as the current
+ CRect rectOld;
+ pWnd->GetWindowRect(rectOld);
+ pWnd->GetParent()->ScreenToClient(&rectOld);
+ if (rect != rectOld)
+ AfxRepositionWindow(lpLayout, pWnd->m_hWnd, rect);
+}
+
+void CFX_SplitterWnd::LayoutRowCol(CSplitterWnd::CRowColInfo *pInfoArray,int nMax,int nSize,int nSizeSplitter)
+{
+ ASSERT(pInfoArray != NULL);
+ ASSERT(nMax > 0);
+ ASSERT(nSizeSplitter > 0);
+
+ CSplitterWnd::CRowColInfo* pInfo;
+ int i;
+
+ if (nSize < 0)
+ nSize = 0; // if really too small, layout as zero size
+
+ // start with ideal sizes
+ for (i = 0, pInfo = pInfoArray; i < nMax-1; i++, pInfo++)
+ {
+ if (pInfo->nIdealSize < pInfo->nMinSize)
+ pInfo->nIdealSize = 0; // too small to see
+ pInfo->nCurSize = pInfo->nIdealSize;
+ }
+ pInfo->nCurSize = INT_MAX; // last row/column takes the rest
+
+ for (i = 0, pInfo = pInfoArray; i < nMax; i++, pInfo++)
+ {
+ ASSERT(nSize >= 0);
+ if (nSize == 0)
+ {
+ // no more room (set pane to be invisible)
+ pInfo->nCurSize = 0;
+ continue; // don't worry about splitters
+ }
+ else if (nSize < pInfo->nMinSize && i != 0)
+ {
+ // additional panes below the recommended minimum size
+ // aren't shown and the size goes to the previous pane
+ pInfo->nCurSize = 0;
+
+ // previous pane already has room for splitter + border
+ // add remaining size and remove the extra border
+ (pInfo-1)->nCurSize += nSize + 2;
+ nSize = 0;
+ }
+ else
+ {
+ // otherwise we can add the second pane
+ ASSERT(nSize > 0);
+ if (pInfo->nCurSize == 0)
+ {
+ // too small to see
+ if (i != 0)
+ pInfo->nCurSize = 0;
+ }
+ else if (nSize < pInfo->nCurSize)
+ {
+ // this row/col won't fit completely - make as small as possible
+ pInfo->nCurSize = nSize;
+ nSize = 0;
+ }
+ else
+ {
+ // can fit everything
+ nSize -= pInfo->nCurSize;
+ }
+ }
+
+ // see if we should add a splitter
+ ASSERT(nSize >= 0);
+ if (i != nMax - 1)
+ {
+ // should have a splitter
+ if (nSize > nSizeSplitter)
+ {
+ nSize -= nSizeSplitter; // leave room for splitter + border
+ ASSERT(nSize > 0);
+ }
+ else
+ {
+ // not enough room - add left over less splitter size
+ pInfo->nCurSize += nSize;
+ if (pInfo->nCurSize > (nSizeSplitter - 2))
+ pInfo->nCurSize -= (nSizeSplitter - 2);
+ nSize = 0;
+ }
+ }
+ }
+ ASSERT(nSize == 0); // all space should be allocated
+}
+
+void CFX_SplitterWnd::HideColumn(int nCol)
+{
+ if ( m_nHidedCol != -1 )
+ return;
+
+ ASSERT_VALID(this);
+ ASSERT(m_nCols > 1);
+ ASSERT(nCol < m_nCols);
+ ASSERT(m_nHidedCol == -1);
+ m_nHidedCol = nCol;
+
+ // if the column has an active window -- change it
+ int rowActive, colActive;
+ if (GetActivePane(&rowActive, &colActive) != NULL &&
+ colActive == nCol)
+ {
+ if (++colActive >= m_nCols)
+ colActive = 0;
+ SetActivePane(rowActive, colActive);
+ }
+
+ // hide all column panes
+ for (int row = 0; row < m_nRows; row++)
+ {
+ CWnd* pPaneHide = GetPane(row, nCol);
+ ASSERT(pPaneHide != NULL);
+ pPaneHide->ShowWindow(SW_HIDE);
+ pPaneHide->SetDlgCtrlID(
+ AFX_IDW_PANE_FIRST + row * 16 + m_nCols);
+
+ for (int col = nCol + 1; col < m_nCols; col++)
+ {
+ CWnd* pPane = GetPane(row, col);
+ ASSERT(pPane != NULL);
+ pPane->SetDlgCtrlID(IdFromRowCol(row, col - 1));
+ }
+ }
+ m_nCols--;
+ m_pColInfo[m_nCols].nCurSize = m_pColInfo[nCol].nCurSize;
+ RecalcLayout();
+}
+
+void CFX_SplitterWnd::ShowColumn()
+{
+ if ( m_nHidedCol == -1 )
+ return;
+
+ ASSERT_VALID(this);
+ ASSERT(m_nCols < m_nMaxCols);
+ ASSERT(m_nHidedCol != -1);
+
+ int colNew = m_nHidedCol;
+ m_nHidedCol = -1;
+ int cxNew = m_pColInfo[m_nCols].nCurSize;
+ m_nCols++; // add a column
+ ASSERT(m_nCols == m_nMaxCols);
+
+ // fill the hided column
+ int col;
+ for (int row = 0; row < m_nRows; row++)
+ {
+ CWnd* pPaneShow = GetDlgItem(
+ AFX_IDW_PANE_FIRST + row * 16 + m_nCols);
+ ASSERT(pPaneShow != NULL);
+ pPaneShow->ShowWindow(SW_SHOWNA);
+
+ for (col = m_nCols - 2; col >= colNew; col--)
+ {
+ CWnd* pPane = GetPane(row, col);
+ ASSERT(pPane != NULL);
+ pPane->SetDlgCtrlID(IdFromRowCol(row, col + 1));
+ }
+
+ pPaneShow->SetDlgCtrlID(IdFromRowCol(row, colNew));
+ }
+
+ // new panes have been created -- recalculate layout
+ for (col = colNew + 1; col < m_nCols; col++)
+ m_pColInfo[col].nIdealSize = m_pColInfo[col - 1].nCurSize;
+ m_pColInfo[colNew].nIdealSize = cxNew;
+
+ RecalcLayout();
+}
+
+void CFX_SplitterWnd::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if (!m_bBarLocked)
+ CSplitterWnd::OnLButtonDown(nFlags, point);
+}
+
+void CFX_SplitterWnd::OnMouseMove(UINT nFlags, CPoint point)
+{
+ if (!m_bBarLocked)
+ CSplitterWnd::OnMouseMove(nFlags, point);
+ else
+ CWnd::OnMouseMove(nFlags, point);
+}
diff --git a/xfa_test/FormFiller_Test/FX_SplitterWnd.h b/xfa_test/FormFiller_Test/FX_SplitterWnd.h
new file mode 100644
index 0000000000..94893c9719
--- /dev/null
+++ b/xfa_test/FormFiller_Test/FX_SplitterWnd.h
@@ -0,0 +1,44 @@
+// FX_SplitterWnd.h: interface for the CFX_SplitterWnd class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FX_SPLITTERWND_H__4BF45CD9_0C9D_4223_9D0E_9ECA148F49FB__INCLUDED_)
+#define AFX_FX_SPLITTERWND_H__4BF45CD9_0C9D_4223_9D0E_9ECA148F49FB__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CFX_SplitterWnd : public CSplitterWnd
+{
+public:
+ CFX_SplitterWnd();
+ virtual ~CFX_SplitterWnd();
+
+public:
+ virtual void OnDrawSplitter(CDC *pDC,ESplitType nType,const CRect &rectArg);
+ virtual void RecalcLayout();
+ static void DeferClientPos(AFX_SIZEPARENTPARAMS *lpLayout,CWnd *pWnd,int x,int y,int cx,int cy,BOOL bScrollBar);
+ static void LayoutRowCol(CSplitterWnd::CRowColInfo *pInfoArray,int nMax,int nSize,int nSizeSplitter);
+ void LockBar(BOOL bState=TRUE){m_bBarLocked=bState;}
+ void HideColumn(int nCol);
+ void ShowColumn();
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CFX_SplitterWnd)
+ //}}AFX_VIRTUAL
+
+ // Generated message map functions
+protected:
+ //{{AFX_MSG(CFX_SplitterWnd)
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+protected:
+ BOOL m_bBarLocked;
+ int m_nHidedCol;
+
+};
+
+#endif // !defined(AFX_FX_SPLITTERWND_H__4BF45CD9_0C9D_4223_9D0E_9ECA148F49FB__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/FindDlg.cpp b/xfa_test/FormFiller_Test/FindDlg.cpp
new file mode 100644
index 0000000000..88548d991f
--- /dev/null
+++ b/xfa_test/FormFiller_Test/FindDlg.cpp
@@ -0,0 +1,73 @@
+// FindDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "FindDlg.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CFindDlg dialog
+
+
+CFindDlg::CFindDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CFindDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CFindDlg)
+ m_bMatchCase = FALSE;
+ m_bWholeWord = FALSE;
+ m_strFindWhat = _T("");
+ m_nDirection = -1;
+ //}}AFX_DATA_INIT
+}
+
+
+void CFindDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CFindDlg)
+ DDX_Check(pDX, IDC_CHECK_MATCHCASE, m_bMatchCase);
+ DDX_Check(pDX, IDC_CHECK_MATCHWHOLE, m_bWholeWord);
+ DDX_Text(pDX, IDC_EDIT1, m_strFindWhat);
+ DDX_Radio(pDX, IDC_RADIO_Down, m_nDirection);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CFindDlg, CDialog)
+ //{{AFX_MSG_MAP(CFindDlg)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CFindDlg message handlers
+
+void CFindDlg::OnOK()
+{
+ // TODO: Add extra validation here
+ UpdateData(TRUE);
+ m_pView->FindText(m_strFindWhat, m_bMatchCase, m_bWholeWord, m_nDirection);
+ //CDialog::OnOK();
+}
+
+BOOL CFindDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // TODO: Add extra initialization here
+ m_pView = (CReaderVCView *)(((CChildFrame *)((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())->GetActiveView());
+ ASSERT(m_pView);
+ ((CButton *)GetDlgItem(IDC_RADIO_Down))->SetCheck(1);
+ ((CButton *)GetDlgItem(IDC_CHECK_MATCHWHOLE))->SetCheck(1);
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
diff --git a/xfa_test/FormFiller_Test/FindDlg.h b/xfa_test/FormFiller_Test/FindDlg.h
new file mode 100644
index 0000000000..18ef88dc96
--- /dev/null
+++ b/xfa_test/FormFiller_Test/FindDlg.h
@@ -0,0 +1,50 @@
+#if !defined(AFX_FINDDLG_H__355AF96B_B487_4503_8658_7F37B397D38A__INCLUDED_)
+#define AFX_FINDDLG_H__355AF96B_B487_4503_8658_7F37B397D38A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// FindDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CFindDlg dialog
+class CReaderVCView;
+class CFindDlg : public CDialog
+{
+// Construction
+public:
+ CFindDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CFindDlg)
+ enum { IDD = IDD_DLG_FIND };
+ BOOL m_bMatchCase;
+ BOOL m_bWholeWord;
+ CString m_strFindWhat;
+ int m_nDirection;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CFindDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ CReaderVCView *m_pView;
+ // Generated message map functions
+ //{{AFX_MSG(CFindDlg)
+ virtual void OnOK();
+ virtual BOOL OnInitDialog();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_FINDDLG_H__355AF96B_B487_4503_8658_7F37B397D38A__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/GotoPageDlg.cpp b/xfa_test/FormFiller_Test/GotoPageDlg.cpp
new file mode 100644
index 0000000000..5c189c8c52
--- /dev/null
+++ b/xfa_test/FormFiller_Test/GotoPageDlg.cpp
@@ -0,0 +1,65 @@
+// GotoPageDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "GotoPageDlg.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CGotoPageDlg dialog
+
+
+CGotoPageDlg::CGotoPageDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CGotoPageDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CGotoPageDlg)
+ m_nPageIndex = 0;
+ //}}AFX_DATA_INIT
+}
+
+
+void CGotoPageDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CGotoPageDlg)
+ DDX_Text(pDX, IDC_EDIT1, m_nPageIndex);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CGotoPageDlg, CDialog)
+ //{{AFX_MSG_MAP(CGotoPageDlg)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CGotoPageDlg message handlers
+
+void CGotoPageDlg::OnOK()
+{
+ // TODO: Add extra validation here
+ if (NULL == m_pView) return;
+ UpdateData(TRUE);
+ m_pView->GotoPage(m_nPageIndex);
+ CDialog::OnOK();
+}
+
+BOOL CGotoPageDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // TODO: Add extra initialization here
+ m_pView = (CReaderVCView *)(((CChildFrame *)((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())->GetActiveView());
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
diff --git a/xfa_test/FormFiller_Test/GotoPageDlg.h b/xfa_test/FormFiller_Test/GotoPageDlg.h
new file mode 100644
index 0000000000..40f6bea1c2
--- /dev/null
+++ b/xfa_test/FormFiller_Test/GotoPageDlg.h
@@ -0,0 +1,48 @@
+#if !defined(AFX_GOTOPAGEDLG_H__674C0708_4B25_4465_A73F_310610F9B991__INCLUDED_)
+#define AFX_GOTOPAGEDLG_H__674C0708_4B25_4465_A73F_310610F9B991__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// GotoPageDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CGotoPageDlg dialog
+class CReaderVCView;
+class CGotoPageDlg : public CDialog
+{
+// Construction
+public:
+ CGotoPageDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CGotoPageDlg)
+ enum { IDD = IDD_DLG_GOTOPAGE };
+ int m_nPageIndex;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CGotoPageDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+private:
+ CReaderVCView *m_pView;
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CGotoPageDlg)
+ virtual void OnOK();
+ virtual BOOL OnInitDialog();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GOTOPAGEDLG_H__674C0708_4B25_4465_A73F_310610F9B991__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/JS_ResponseDlg.cpp b/xfa_test/FormFiller_Test/JS_ResponseDlg.cpp
new file mode 100644
index 0000000000..043efc24c4
--- /dev/null
+++ b/xfa_test/FormFiller_Test/JS_ResponseDlg.cpp
@@ -0,0 +1,152 @@
+// JS_ResponseDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "readervc.h"
+#include "JS_ResponseDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CJS_ResponseDlg dialog
+
+
+CJS_ResponseDlg::CJS_ResponseDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CJS_ResponseDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CJS_ResponseDlg)
+ // NOTE: the ClassWizard will add member initialization here
+ //}}AFX_DATA_INIT
+ m_swTitle =(FPDF_WIDESTRING) L"";
+ m_swQuestion =(FPDF_WIDESTRING) L"";
+ m_swLabel =(FPDF_WIDESTRING) L"";
+ m_swDefault =(FPDF_WIDESTRING) L"";
+ m_swResponse =L"";
+ m_bIsVisible = false;
+ m_pResponseEdit = NULL;
+}
+
+
+void CJS_ResponseDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CJS_ResponseDlg)
+ // NOTE: the ClassWizard will add DDX and DDV calls here
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CJS_ResponseDlg, CDialog)
+ //{{AFX_MSG_MAP(CJS_ResponseDlg)
+ // NOTE: the ClassWizard will add message map macros here
+ ON_BN_CLICKED(ID_JS_OK, OnResOk)
+ ON_BN_CLICKED(ID_JS_CANCEL, OnResCancel)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CJS_ResponseDlg message handlers
+BOOL CJS_ResponseDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ ::SetWindowTextW(this->GetSafeHwnd(), (LPCWSTR)m_swTitle);
+
+ CStatic* pQuestion = (CStatic*)GetDlgItem(IDC_JS_QUESTION);
+ ::SetWindowTextW(pQuestion->GetSafeHwnd(), (LPCWSTR)m_swQuestion);
+
+ CStatic* pLabel = (CStatic*)GetDlgItem(IDC_JS_ANSWER);
+
+ CRect DialogRect;
+ CRect LabelRect;
+ RECT rect;
+ GetWindowRect(&DialogRect);
+ pLabel->GetWindowRect(&LabelRect);
+
+ if(m_swLabel == (FPDF_WIDESTRING)L"")
+ {
+ rect.left = DialogRect.left + 20;
+ pLabel->ShowWindow(SW_HIDE);
+ }
+ else
+ {
+ rect.left = LabelRect.right + 1;
+ ::SetWindowTextW(pLabel->GetSafeHwnd(), (LPCWSTR)m_swLabel);
+ }
+
+ rect.top = LabelRect.top - 3;
+ rect.right = DialogRect.right - 20;
+ rect.bottom = LabelRect.bottom + 2;
+ ScreenToClient(&rect);
+ m_pResponseEdit = new CEdit();
+
+ if(m_bIsVisible)
+ m_pResponseEdit->Create(ES_AUTOVSCROLL | ES_NOHIDESEL | ES_PASSWORD | WS_BORDER, rect, this, IDC_JS_EDIT);
+ else
+ m_pResponseEdit->Create(ES_AUTOVSCROLL | ES_NOHIDESEL | WS_BORDER, rect, this, IDC_JS_EDIT);
+
+ ::SetWindowTextW(m_pResponseEdit->GetSafeHwnd(), (LPCWSTR)m_swDefault);
+ m_pResponseEdit->ShowWindow(SW_SHOW);
+
+ return TRUE;
+}
+
+void CJS_ResponseDlg::OnResOk()
+{
+ m_swResponse = (wchar_t*)malloc(sizeof(wchar_t) * 250);
+ ::GetWindowTextW(m_pResponseEdit->GetSafeHwnd(), m_swResponse, 250);
+
+ if(m_pResponseEdit)
+ {
+ m_pResponseEdit->DestroyWindow();
+ delete m_pResponseEdit;
+ m_pResponseEdit = NULL;
+ }
+ CDialog::OnOK();
+}
+
+void CJS_ResponseDlg::OnResCancel()
+{
+ if(m_pResponseEdit)
+ {
+ m_pResponseEdit->DestroyWindow();
+ delete m_pResponseEdit;
+ m_pResponseEdit = NULL;
+ }
+
+ CDialog::OnCancel();
+}
+
+void CJS_ResponseDlg::SetTitle(FPDF_WIDESTRING swTitle)
+{
+ m_swTitle = swTitle;
+}
+
+void CJS_ResponseDlg::SetQuestion(FPDF_WIDESTRING swQuestion)
+{
+ m_swQuestion = swQuestion;
+}
+
+void CJS_ResponseDlg::SetLabel(FPDF_WIDESTRING swLabel)
+{
+ m_swLabel = swLabel;
+}
+
+void CJS_ResponseDlg::SetDefault(FPDF_WIDESTRING swDefault)
+{
+ m_swDefault = swDefault;
+}
+
+FPDF_WIDESTRING CJS_ResponseDlg::GetResponse()
+{
+ return (FPDF_WIDESTRING)m_swResponse;
+}
+
+void CJS_ResponseDlg::SetIsVisible(FPDF_BOOL bPassword)
+{
+ m_bIsVisible = bPassword;
+}
diff --git a/xfa_test/FormFiller_Test/JS_ResponseDlg.h b/xfa_test/FormFiller_Test/JS_ResponseDlg.h
new file mode 100644
index 0000000000..c3410c49bc
--- /dev/null
+++ b/xfa_test/FormFiller_Test/JS_ResponseDlg.h
@@ -0,0 +1,64 @@
+#if !defined(AFX_JS_RESPONSEDLG_H__AE1575EB_3F0A_46E7_B278_089C74F2B34C__INCLUDED_)
+#define AFX_JS_RESPONSEDLG_H__AE1575EB_3F0A_46E7_B278_089C74F2B34C__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// JS_ResponseDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CJS_ResponseDlg dialog
+
+class CJS_ResponseDlg : public CDialog
+{
+// Construction
+public:
+ CJS_ResponseDlg(CWnd* pParent = NULL); // standard constructor
+ ~CJS_ResponseDlg(){ if(m_swResponse) free(m_swResponse); }
+
+// Dialog Data
+ //{{AFX_DATA(CJS_ResponseDlg)
+ enum { IDD = IDD_DLG_RESPONSE };
+ // NOTE: the ClassWizard will add data members here
+ //}}AFX_DATA
+public:
+ void SetTitle(FPDF_WIDESTRING swTitle);
+ void SetQuestion(FPDF_WIDESTRING swQuestion);
+ void SetDefault(FPDF_WIDESTRING swDefault);
+ void SetLabel(FPDF_WIDESTRING swLabel);
+ void SetIsVisible(FPDF_BOOL bPassword);
+ FPDF_WIDESTRING GetResponse();
+
+private:
+ FPDF_WIDESTRING m_swTitle;
+ FPDF_WIDESTRING m_swQuestion;
+ FPDF_WIDESTRING m_swDefault;
+ FPDF_WIDESTRING m_swLabel;
+ wchar_t* m_swResponse;
+ FPDF_BOOL m_bIsVisible;
+ CEdit* m_pResponseEdit;
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CJS_ResponseDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CJS_ResponseDlg)
+ // NOTE: the ClassWizard will add member functions here
+ virtual BOOL OnInitDialog();
+ afx_msg void OnResOk();
+ afx_msg void OnResCancel();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_JS_RESPONSEDLG_H__AE1575EB_3F0A_46E7_B278_089C74F2B34C__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/MainFrm.cpp b/xfa_test/FormFiller_Test/MainFrm.cpp
new file mode 100644
index 0000000000..b6e59439b6
--- /dev/null
+++ b/xfa_test/FormFiller_Test/MainFrm.cpp
@@ -0,0 +1,238 @@
+// MainFrm.cpp : implementation of the CMainFrame class
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+
+#include "MainFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame
+
+IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
+
+BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
+ //{{AFX_MSG_MAP(CMainFrame)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ // DO NOT EDIT what you see in these blocks of generated code !
+ ON_WM_CREATE()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+static UINT indicators[] =
+{
+ ID_SEPARATOR, // status line indicator
+ ID_INDICATOR_CAPS,
+ ID_INDICATOR_NUM,
+ ID_INDICATOR_SCRL,
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame construction/destruction
+
+CMainFrame::CMainFrame()
+{
+ // TODO: add member initialization code here
+
+}
+
+CMainFrame::~CMainFrame()
+{
+}
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
+ | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
+ !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
+ {
+ TRACE0("Failed to create toolbar\n");
+ return -1; // fail to create
+ }
+
+ if (!m_wndStatusBar.Create(this) ||
+ !m_wndStatusBar.SetIndicators(indicators,
+ sizeof(indicators)/sizeof(UINT)))
+ {
+ TRACE0("Failed to create status bar\n");
+ return -1; // fail to create
+ }
+
+ // TODO: Delete these three lines if you don't want the toolbar to
+ // be dockable
+
+ m_wndToolBar.ModifyStyle(0,TBSTYLE_FLAT | CBRS_TOOLTIPS | TBSTYLE_TRANSPARENT | TBBS_CHECKBOX);
+ m_wndToolBar.GetToolBarCtrl().SetButtonWidth(40,40);
+
+ CImageList ImgList,ImgList1;
+ CBitmap bm;
+ ImgList.Create(22,22,ILC_COLOR8|ILC_MASK, 16, 16);
+ ImgList.SetBkColor(::GetSysColor(15));
+ bm.LoadBitmap(IDB_BITMAP23);//OPEN
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP35);//Print
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP17);//first page
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP24);//prev page
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP22);//next page
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP21);//last page
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP16);//count clockwise
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP15);//clockwise
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP14);//zoom in
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP26);//zoom out
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP13);//actual size
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP18);//fit page
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP19);//fit width
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP36);//search
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP7);//Bookmark
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP25);//snap shot
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP2);//select text
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP20);//hand tool
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP12);//about
+ ImgList.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ m_wndToolBar.GetToolBarCtrl().SetImageList(&ImgList);
+ //m_wndToolBar.GetToolBarCtrl().SetHotImageList(&ImgList);
+ ImgList.Detach();
+
+ ImgList1.Create(22,22,ILC_COLOR8|ILC_MASK, 16, 16);
+ ImgList1.SetBkColor(::GetSysColor(15));
+ bm.LoadBitmap(IDB_BITMAP23);//open
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP30);//printer
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP8);//first page
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP29);//prev page
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP28);//next page
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP27);//last page
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP1);//count clockwise
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP6);//clockwise
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP33);//zoom in
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP34);//zoom out
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP4);//actual size
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP9);//fit page
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP10);//fit width
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP31);//search
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP5);//bookmark
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP32);//snap
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP3);//select text
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP11);//hand tool
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ bm.LoadBitmap(IDB_BITMAP12);//about
+ ImgList1.Add(&bm,RGB(0,255,0));
+ bm.Detach();
+ m_wndToolBar.GetToolBarCtrl().SetDisabledImageList(&ImgList1);
+ ImgList1.Detach();
+
+ m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+ EnableDocking(CBRS_ALIGN_ANY);
+ DockControlBar(&m_wndToolBar);
+
+ return 0;
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if( !CMDIFrameWnd::PreCreateWindow(cs) )
+ return FALSE;
+ // TODO: Modify the Window class or styles here by modifying
+ // the CREATESTRUCT cs
+
+ return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame diagnostics
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+ CMDIFrameWnd::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+ CMDIFrameWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame message handlers
+
diff --git a/xfa_test/FormFiller_Test/MainFrm.h b/xfa_test/FormFiller_Test/MainFrm.h
new file mode 100644
index 0000000000..1b9f128fba
--- /dev/null
+++ b/xfa_test/FormFiller_Test/MainFrm.h
@@ -0,0 +1,56 @@
+// MainFrm.h : interface of the CMainFrame class
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MAINFRM_H__B05284F9_FD96_49A9_B8B2_F77706A9A02B__INCLUDED_)
+#define AFX_MAINFRM_H__B05284F9_FD96_49A9_B8B2_F77706A9A02B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CMainFrame : public CMDIFrameWnd
+{
+ DECLARE_DYNAMIC(CMainFrame)
+public:
+ CMainFrame();
+
+// Attributes
+public:
+ CStatusBar m_wndStatusBar;
+ CToolBar m_wndToolBar;
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CMainFrame)
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CMainFrame();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected: // control bar embedded members
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CMainFrame)
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ // NOTE - the ClassWizard will add and remove member functions here.
+ // DO NOT EDIT what you see in these blocks of generated code!
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_MAINFRM_H__B05284F9_FD96_49A9_B8B2_F77706A9A02B__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ReaderVC.cpp b/xfa_test/FormFiller_Test/ReaderVC.cpp
new file mode 100644
index 0000000000..2d58c25062
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVC.cpp
@@ -0,0 +1,195 @@
+// ReaderVC.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCDoc.h"
+#include "ReaderVCView.h"
+#include "BookmarkView.h"
+
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCApp
+
+BEGIN_MESSAGE_MAP(CReaderVCApp, CWinApp)
+ //{{AFX_MSG_MAP(CReaderVCApp)
+ ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ // DO NOT EDIT what you see in these blocks of generated code!
+ //}}AFX_MSG_MAP
+ // Standard file based document commands
+ ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
+ ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
+ // Standard print setup command
+ ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCApp construction
+
+
+CReaderVCApp::CReaderVCApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+
+
+
+ m_pActiveView = NULL;
+
+
+
+// FPDF_InitFormFillEnviroument(this);
+}
+
+CReaderVCApp::~CReaderVCApp()
+{
+
+
+
+}
+/////////////////////////////////////////////////////////////////////////////
+// The one and only CReaderVCApp object
+
+CReaderVCApp theApp;
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCApp initialization
+extern void SetSampleFontInfo();
+BOOL CReaderVCApp::InitInstance()
+{
+ AfxEnableControlContainer();
+ FPDF_InitLibrary(this->m_hInstance);
+// FPDF_UnlockDLL("SDKRDYX0408","5E5885A8AD61A855485D9F6C85BE82EF7C1F63AC");
+
+ SetSampleFontInfo();
+ // Standard initialization
+ // If you are not using these features and wish to reduce the size
+ // of your final executable, you should remove from the following
+ // the specific initialization routines you do not need.
+
+#ifdef _AFXDLL
+ Enable3dControls(); // Call this when using MFC in a shared DLL
+#else
+ Enable3dControlsStatic(); // Call this when linking to MFC statically
+#endif
+
+ // Change the registry key under which our settings are stored.
+ // TODO: You should modify this string to be something appropriate
+ // such as the name of your company or organization.
+ SetRegistryKey(_T("Local AppWizard-Generated Applications"));
+
+ LoadStdProfileSettings(); // Load standard INI file options (including MRU)
+
+ // Register the application's document templates. Document templates
+ // serve as the connection between documents, frame windows and views.
+
+ CMultiDocTemplate* pDocTemplate;
+ pDocTemplate = new CMultiDocTemplate(
+ IDR_READERTYPE,
+ RUNTIME_CLASS(CReaderVCDoc),
+ RUNTIME_CLASS(CChildFrame), // custom MDI child frame
+ RUNTIME_CLASS(CReaderVCView));
+ AddDocTemplate(pDocTemplate);
+
+ CMultiDocTemplate* pDocTemplate1;
+ pDocTemplate1 = new CMultiDocTemplate(
+ IDR_READERTYPE,
+ RUNTIME_CLASS(CReaderVCDoc),
+ RUNTIME_CLASS(CChildFrame), // custom MDI child frame
+ RUNTIME_CLASS(CBookMarkView));
+ AddDocTemplate(pDocTemplate1);
+ // create main MDI Frame window
+ CMainFrame* pMainFrame = new CMainFrame;
+ if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
+ return FALSE;
+ m_pMainWnd = pMainFrame;
+ // Parse command line for standard shell commands, DDE, file open
+ CCommandLineInfo cmdInfo;
+ cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
+ ParseCommandLine(cmdInfo);
+
+ // Dispatch commands specified on the command line
+ if (!ProcessShellCommand(cmdInfo))
+ return FALSE;
+
+ // The main window has been initialized, so show and update it.
+ pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
+ pMainFrame->UpdateWindow();
+ return TRUE;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ //{{AFX_DATA(CAboutDlg)
+ enum { IDD = IDD_ABOUTBOX };
+ //}}AFX_DATA
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CAboutDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ //{{AFX_MSG(CAboutDlg)
+ afx_msg void OnMetalfile();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+ //{{AFX_DATA_INIT(CAboutDlg)
+ //}}AFX_DATA_INIT
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CAboutDlg)
+ //}}AFX_DATA_MAP
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+ //{{AFX_MSG_MAP(CAboutDlg)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+// App command to run the dialog
+void CReaderVCApp::OnAppAbout()
+{
+ CAboutDlg aboutDlg;
+ aboutDlg.DoModal();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCApp message handlers
+
+
+int CReaderVCApp::ExitInstance()
+{
+ // TODO: Add your specialized code here and/or call the base class
+ FPDF_DestroyLibrary();
+
+ return CWinApp::ExitInstance();
+}
diff --git a/xfa_test/FormFiller_Test/ReaderVC.dsp b/xfa_test/FormFiller_Test/ReaderVC.dsp
new file mode 100644
index 0000000000..8d95e07d81
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVC.dsp
@@ -0,0 +1,460 @@
+# Microsoft Developer Studio Project File - Name="ReaderVC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=ReaderVC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ReaderVC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ReaderVC.mak" CFG="ReaderVC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ReaderVC - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "ReaderVC - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ReaderVC - Win32 Release"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "FPDFSDK_EXPORTS" /FR /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
+# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"../../lib/rel_w32_vc6/ReaderVC.exe"
+
+!ELSEIF "$(CFG)" == "ReaderVC - Win32 Debug"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "FPDFSDK_EXPORTS" /FR /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 Msimg32.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../../lib/dbg_w32_vc6/ReaderVC.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "ReaderVC - Win32 Release"
+# Name "ReaderVC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\BookMarkView.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ChildFrm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ConvertDlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ExportPage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\FindDlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\FX_SplitterWnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\GotoPageDlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\JS_ResponseDlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MainFrm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVC.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVCDoc.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVCView.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestJsDlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZoomDlg.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\BookMarkView.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ChildFrm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ConvertDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ExportPage.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FindDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\FX_SplitterWnd.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\GotoPageDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\JS_ResponseDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MainFrm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVCDoc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReaderVCView.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestJsDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZoomDlg.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\res\BigHandCursor.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap12.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap19.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap2.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap20.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap21.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap22.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap23.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bitmap26.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bookmark.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\bound.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\formOptions.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\point.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\Rd_SelText_Icon.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\Rd_SelText_Icon_Dis.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ReaderVC.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ReaderVC.rc2
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\ReaderVCDoc.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\SmallHandCursor.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_actual_size.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_bookmark1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_clockwise.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_counterclockwise.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_first.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_fit_page.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_fit_width.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hand1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_about2.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_actual_size.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_bookmark1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_clockwise.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_counterclockwise.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_first.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_fit_page.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_fit_width.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_hand1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_last.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_next.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_open1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_prev.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_print.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_search.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_snap_shot.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_zoomin.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_hot_zoomout.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_last.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_next.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_prev.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_print.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_search.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_snap_shot.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_zoomin.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\tool_zoomout.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\Toolbar.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\unknowncolor_gray.bmp
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/xfa_test/FormFiller_Test/ReaderVC.h b/xfa_test/FormFiller_Test/ReaderVC.h
new file mode 100644
index 0000000000..11bcc4354f
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVC.h
@@ -0,0 +1,54 @@
+// ReaderVC.h : main header file for the READERVC application
+//
+
+#if !defined(AFX_READERVC_H__7873A15F_A60F_4C05_9DC6_C3914C224EAA__INCLUDED_)
+#define AFX_READERVC_H__7873A15F_A60F_4C05_9DC6_C3914C224EAA__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+class CReaderVCView;
+
+#include "resource.h" // main symbols
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCApp:
+// See ReaderVC.cpp for the implementation of this class
+//
+
+class CReaderVCApp : public CWinApp
+{
+public:
+ CReaderVCApp();
+ ~CReaderVCApp();
+ CReaderVCView * m_pActiveView;
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CReaderVCApp)
+ public:
+ virtual BOOL InitInstance();
+ virtual int ExitInstance();
+ //}}AFX_VIRTUAL
+
+// Implementation
+ //{{AFX_MSG(CReaderVCApp)
+ afx_msg void OnAppAbout();
+ // NOTE - the ClassWizard will add and remove member functions here.
+ // DO NOT EDIT what you see in these blocks of generated code !
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_READERVC_H__7873A15F_A60F_4C05_9DC6_C3914C224EAA__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ReaderVC.rc b/xfa_test/FormFiller_Test/ReaderVC.rc
new file mode 100644
index 0000000000..bf647aefb6
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVC.rc
@@ -0,0 +1,741 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Chinese (P.R.C.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
+#ifdef _WIN32
+LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
+#pragma code_page(936)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n"
+ "#ifdef _WIN32\r\n"
+ "LANGUAGE 4, 2\r\n"
+ "#pragma code_page(936)\r\n"
+ "#endif //_WIN32\r\n"
+ "#include ""res\\ReaderVC.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""l.chs\\afxres.rc"" // Standard components\r\n"
+ "#include ""l.chs\\afxprint.rc"" // printing/print preview resources\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON DISCARDABLE "res\\ReaderVC.ico"
+IDR_READERTYPE ICON DISCARDABLE "res\\ReaderVCDoc.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
+IDB_BITMAP1 BITMAP DISCARDABLE "res\\tool_counterclockwise.bmp"
+IDB_BITMAP2 BITMAP DISCARDABLE "res\\Rd_SelText_Icon.bmp"
+IDB_BITMAP3 BITMAP DISCARDABLE "res\\Rd_SelText_Icon_Dis.bmp"
+IDB_BITMAP4 BITMAP DISCARDABLE "res\\tool_actual_size.bmp"
+IDB_BITMAP5 BITMAP DISCARDABLE "res\\tool_bookmark1.bmp"
+IDB_BITMAP6 BITMAP DISCARDABLE "res\\tool_clockwise.bmp"
+IDB_BITMAP7 BITMAP DISCARDABLE "res\\tool_hot_bookmark1.bmp"
+IDB_BITMAP8 BITMAP DISCARDABLE "res\\tool_first.bmp"
+IDB_BITMAP9 BITMAP DISCARDABLE "res\\tool_fit_page.bmp"
+IDB_BITMAP10 BITMAP DISCARDABLE "res\\tool_fit_width.bmp"
+IDB_BITMAP11 BITMAP DISCARDABLE "res\\tool_hand1.bmp"
+IDB_BITMAP12 BITMAP DISCARDABLE "res\\tool_hot_about2.bmp"
+IDB_BITMAP13 BITMAP DISCARDABLE "res\\tool_hot_actual_size.bmp"
+IDB_BITMAP14 BITMAP DISCARDABLE "res\\tool_hot_zoomin.bmp"
+IDB_BITMAP15 BITMAP DISCARDABLE "res\\tool_hot_clockwise.bmp"
+IDB_BITMAP16 BITMAP DISCARDABLE "res\\tool_hot_counterclockwise.bmp"
+IDB_BITMAP17 BITMAP DISCARDABLE "res\\tool_hot_first.bmp"
+IDB_BITMAP18 BITMAP DISCARDABLE "res\\tool_hot_fit_page.bmp"
+IDB_BITMAP19 BITMAP DISCARDABLE "res\\tool_hot_fit_width.bmp"
+IDB_BITMAP20 BITMAP DISCARDABLE "res\\tool_hot_hand1.bmp"
+IDB_BITMAP21 BITMAP DISCARDABLE "res\\tool_hot_last.bmp"
+IDB_BITMAP22 BITMAP DISCARDABLE "res\\tool_hot_next.bmp"
+IDB_BITMAP23 BITMAP DISCARDABLE "res\\tool_hot_open1.bmp"
+IDB_BITMAP24 BITMAP DISCARDABLE "res\\tool_hot_prev.bmp"
+IDB_BITMAP26 BITMAP DISCARDABLE "res\\tool_hot_zoomout.bmp"
+IDB_BITMAP27 BITMAP DISCARDABLE "res\\tool_last.bmp"
+IDB_BITMAP28 BITMAP DISCARDABLE "res\\tool_next.bmp"
+IDB_BITMAP29 BITMAP DISCARDABLE "res\\tool_prev.bmp"
+IDB_BITMAP30 BITMAP DISCARDABLE "res\\tool_print.bmp"
+IDB_BITMAP31 BITMAP DISCARDABLE "res\\tool_search.bmp"
+IDB_BITMAP32 BITMAP DISCARDABLE "res\\tool_snap_shot.bmp"
+IDB_BITMAP33 BITMAP DISCARDABLE "res\\tool_zoomin.bmp"
+IDB_BITMAP34 BITMAP DISCARDABLE "res\\tool_zoomout.bmp"
+IDB_BITMAP25 BITMAP DISCARDABLE "res\\tool_hot_snap_shot.bmp"
+IDB_BITMAP35 BITMAP DISCARDABLE "res\\tool_hot_print.bmp"
+IDB_BITMAP36 BITMAP DISCARDABLE "res\\tool_hot_search.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Toolbar
+//
+
+IDR_MAINFRAME TOOLBAR DISCARDABLE 24, 24
+BEGIN
+ BUTTON ID_FILE_OPEN
+ SEPARATOR
+ BUTTON ID_FILE_PRINT
+ SEPARATOR
+ BUTTON ID_DOC_FIRSTPAGE
+ BUTTON ID_DOC_PREPAGE
+ BUTTON ID_DOC_NEXTPAGE
+ BUTTON ID_DOC_LASTPAGE
+ SEPARATOR
+ BUTTON ID_VIEW_COUNTERCLOCKWISE
+ BUTTON ID_VIEW_CLOCKWISE
+ SEPARATOR
+ BUTTON ID_VIEW_ZOOMIN
+ BUTTON ID_VIEW_ZOOMOUT
+ SEPARATOR
+ BUTTON ID_VIEW_ACTUALSIZE
+ BUTTON ID_VIEW_FITPAGE
+ BUTTON ID_VIEW_FITWIDTH
+ SEPARATOR
+ BUTTON ID_EDIT_FIND
+ SEPARATOR
+ BUTTON ID_VIEW_BOOKMARK
+ SEPARATOR
+ BUTTON ID_TOOL_SNAPSHOT
+ BUTTON ID_TOOL_SELECT
+ BUTTON ID_TOOL_HAND
+ BUTTON ID_APP_ABOUT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
+BEGIN
+ "+", ID_VIEW_ZOOMIN, VIRTKEY, CONTROL, NOINVERT
+ "-", ID_VIEW_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT
+ "1", ID_VIEW_ACTUALSIZE, VIRTKEY, CONTROL, NOINVERT
+ "2", ID_VIEW_FITPAGE, VIRTKEY, CONTROL, NOINVERT
+ "3", ID_VIEW_FITWIDTH, VIRTKEY, CONTROL, NOINVERT
+ "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
+ "F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
+ "M", ID_VIEW_ZOOMTO, VIRTKEY, CONTROL, NOINVERT
+ "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
+ "N", ID_DOC_GOTOPAGE, VIRTKEY, SHIFT, CONTROL,
+ NOINVERT
+ "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
+ "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
+ "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
+ "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
+ VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
+ VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
+ VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
+ VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
+ VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
+ VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
+ "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
+ "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About ReaderVC"
+FONT 9, "ËÎÌå"
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
+ LTEXT "Foxit SDK Demo 1.0 version",IDC_STATIC,40,10,126,8,
+ SS_NOPREFIX
+ LTEXT "All rights Reserved",IDC_STATIC,40,25,119,8
+ DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
+END
+
+IDD_DLG_GOTOPAGE DIALOG DISCARDABLE 0, 0, 133, 29
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Goto Page"
+FONT 10, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,91,7,35,14
+ LTEXT "Goto",IDC_STATIC,8,9,16,9
+ EDITTEXT IDC_EDIT1,25,7,64,14,ES_AUTOHSCROLL
+END
+
+IDD_DLG_ZOOMTO DIALOG DISCARDABLE 0, 0, 141, 45
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Zoom To"
+FONT 10, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,38,24,29,14
+ LTEXT "Zoom to",IDC_STATIC,7,9,30,8
+ DEFPUSHBUTTON "Cancel",IDCANCEL,75,24,29,14
+ COMBOBOX IDC_COMBO1,37,7,78,132,CBS_DROPDOWN | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+IDD_DLG_FIND DIALOG DISCARDABLE 0, 0, 222, 70
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Find Text"
+FONT 10, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "&Find Next",IDOK,174,7,41,13
+ PUSHBUTTON "&Cancel",IDCANCEL,175,24,40,13
+ LTEXT "&Find What",IDC_STATIC,7,10,38,10
+ EDITTEXT IDC_EDIT1,46,7,124,16,ES_AUTOHSCROLL
+ CONTROL "Match &Case",IDC_CHECK_MATCHCASE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,30,90,11
+ CONTROL "Match &Whole word only",IDC_CHECK_MATCHWHOLE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,48,97,10
+ GROUPBOX "Direction",IDC_STATIC,104,28,68,32
+ CONTROL "Down",IDC_RADIO_Down,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,109,42,29,10
+ CONTROL "Up",IDC_RADIO_UP,"Button",BS_AUTORADIOBUTTON,146,42,19,
+ 10
+END
+
+IDD_DLG_CONVERT DIALOG DISCARDABLE 0, 0, 128, 74
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Convert mode"
+FONT 10, "System"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,17,55,42,12
+ PUSHBUTTON "Cancel",IDCANCEL,69,55,42,12
+ GROUPBOX "Flags for ConvertText",IDC_STATIC,16,7,95,46
+ CONTROL "Stream order",IDC_RADIO_Stream,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP,30,20,69,8
+ CONTROL "Appearance order",IDC_RADIO_Appearance,"Button",
+ BS_AUTORADIOBUTTON,30,31,69,8
+END
+
+IDD_EXPORT_PAGE DIALOG DISCARDABLE 0, 0, 230, 229
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Export Page"
+FONT 10, "System"
+BEGIN
+ LTEXT "Width",IDC_STATIC,22,16,20,8
+ LTEXT "Height",IDC_STATIC,21,37,22,8
+ LTEXT "Rotate",IDC_STATIC,21,61,22,8
+ LTEXT "Bitmap Width",IDC_STATIC,102,14,45,8
+ LTEXT "Bitmap Height",IDC_STATIC,99,35,47,8
+ PUSHBUTTON "Rander Page ",IDC_Rander_Page,102,58,50,14
+ PUSHBUTTON "Save As...",IDC_Save,158,58,50,14
+ EDITTEXT IDC_EDIT_PAGE_WIDTH,45,14,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_PAGE_HEIGHT,45,35,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_ROTATE,45,59,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_WIDTH,149,13,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_HEIGHT,148,33,40,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_STATIC_BITMAP,"Static",SS_BLACKFRAME,18,87,196,
+ 127
+END
+
+IDD_DLG_RESPONSE DIALOG DISCARDABLE 0, 0, 241, 66
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Dialog"
+FONT 8, "System"
+BEGIN
+ DEFPUSHBUTTON "OK",ID_JS_OK,116,45,50,14
+ PUSHBUTTON "Cancel",ID_JS_CANCEL,184,45,50,14
+ LTEXT "",IDC_JS_QUESTION,7,7,227,12
+ LTEXT "",IDC_JS_ANSWER,7,26,27,12
+END
+
+IDD_TEST_JS DIALOG DISCARDABLE 0, 0, 187, 96
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Dialog"
+FONT 10, "System"
+BEGIN
+ EDITTEXT IDC_EDIT1,7,18,173,33,ES_MULTILINE | ES_AUTOHSCROLL
+ PUSHBUTTON "Run JS",IDC_BUTTON1,130,68,50,14
+END
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080404b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "ReaderVC Microsoft »ù´¡ÀàÓ¦ÓóÌÐò\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "ReaderVC\0"
+ VALUE "LegalCopyright", "°æȨËùÓÐ (C) 2007\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "ReaderVC.EXE\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "ReaderVC Ó¦ÓóÌÐò\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x804, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 228
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 48
+ END
+
+ IDD_DLG_GOTOPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 126
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 22
+ END
+
+ IDD_DLG_ZOOMTO, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 134
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 38
+ END
+
+ IDD_DLG_FIND, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 215
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 63
+ END
+
+ IDD_DLG_CONVERT, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 121
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 67
+ END
+
+ IDD_EXPORT_PAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 223
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 222
+ END
+
+ IDD_DLG_RESPONSE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 234
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 59
+ END
+
+ IDD_TEST_JS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 180
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 89
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Cursor
+//
+
+IDC_CURSOR1 CURSOR DISCARDABLE "res\\SmallHandCursor.cur"
+IDC_CURSOR2 CURSOR DISCARDABLE "res\\BigHandCursor.cur"
+IDC_CURSOR3 CURSOR DISCARDABLE "res\\bound.cur"
+IDC_CURSOR4 CURSOR DISCARDABLE "res\\point.cur"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE PRELOAD DISCARDABLE
+BEGIN
+ IDR_MAINFRAME "ReaderVC"
+ IDR_READERTYPE "\nReader\nReader\n\n\nReaderVC.Document\nReader Document"
+END
+
+STRINGTABLE PRELOAD DISCARDABLE
+BEGIN
+ AFX_IDS_APP_TITLE "ReaderVC"
+ AFX_IDS_IDLEMESSAGE "¾ÍÐ÷"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_INDICATOR_EXT "À©Õ¹Ãû"
+ ID_INDICATOR_CAPS "´óд"
+ ID_INDICATOR_NUM "Êý×Ö"
+ ID_INDICATOR_SCRL "¹ö¶¯"
+ ID_INDICATOR_OVR "¸Äд"
+ ID_INDICATOR_REC "¼Ç¼"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_FILE_NEW "½¨Á¢ÐÂÎĵµ\nн¨"
+ ID_FILE_OPEN "´ò¿ªÒ»¸öÏÖÓÐÎĵµ\n´ò¿ª"
+ ID_FILE_CLOSE "¹Ø±Õ»î¶¯Îĵµ\n¹Ø±Õ"
+ ID_FILE_SAVE "±£´æ»î¶¯Îĵµ\n±£´æ"
+ ID_FILE_SAVE_AS "½«»î¶¯ÎĵµÒÔÒ»¸öÐÂÎļþÃû±£´æ\nÁí´æΪ"
+ ID_FILE_PAGE_SETUP "¸Ä±ä´òÓ¡Ñ¡Ïî\nÒ³ÃæÉèÖÃ"
+ ID_FILE_PRINT_SETUP "¸Ä±ä´òÓ¡»ú¼°´òÓ¡Ñ¡Ïî\n´òÓ¡ÉèÖÃ"
+ ID_FILE_PRINT "´òÓ¡»î¶¯Îĵµ\n´òÓ¡"
+ ID_FILE_PRINT_PREVIEW "ÏÔʾÕûÒ³\n´òÓ¡Ô¤ÀÀ"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_APP_ABOUT "ÏÔʾ³ÌÐòÐÅÏ¢£¬°æ±¾ºÅºÍ°æȨ\n¹ØÓÚ"
+ ID_APP_EXIT "Í˳öÓ¦ÓóÌÐò£»Ìáʾ±£´æÎĵµ\nÍ˳ö"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_FILE_MRU_FILE1 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE2 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE3 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE4 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE5 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE6 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE7 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE8 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE9 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE10 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE11 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE12 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE13 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE14 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE15 "´ò¿ª¸ÃÎĵµ"
+ ID_FILE_MRU_FILE16 "´ò¿ª¸ÃÎĵµ"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_NEXT_PANE "Çл»µ½ÏÂÒ»¸ö´°¸ñ\nÏÂÒ»´°¸ñ"
+ ID_PREV_PANE "Çл»»ØÇ°Ò»¸ö´°¸ñ\nÇ°Ò»´°¸ñ"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_WINDOW_NEW "Ϊ»î¶¯Îĵµ´ò¿ªÁíÒ»¸ö´°¿Ú\nн¨´°¿Ú"
+ ID_WINDOW_ARRANGE "½«Í¼±êÅÅÁÐÔÚ´°¿Úµ×²¿\nÅÅÁÐͼ±ê"
+ ID_WINDOW_CASCADE "ÅÅÁд°¿Ú³ÉÏ໥Öصþ\n²ãµþ´°¿Ú"
+ ID_WINDOW_TILE_HORZ "ÅÅÁд°¿Ú³É»¥²»Öصþ\nƽÆÌ´°¿Ú"
+ ID_WINDOW_TILE_VERT "ÅÅÁд°¿Ú³É»¥²»Öصþ\nƽÆÌ´°¿Ú"
+ ID_WINDOW_SPLIT "½«»î¶¯µÄ´°¿Ú·Ö¸ô³É´°¸ñ\n·Ö¸ô"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_EDIT_CLEAR "ɾ³ý±»Ñ¡¶ÔÏó\nɾ³ý"
+ ID_EDIT_CLEAR_ALL "È«²¿É¾³ý\nÈ«²¿É¾³ý"
+ ID_EDIT_COPY "¸´ÖƱ»Ñ¡¶ÔÏó²¢½«ÆäÖÃÓÚ¼ôÌù°åÉÏ\n¸´ÖÆ"
+ ID_EDIT_CUT "¼ôÇб»Ñ¡¶ÔÏó²¢½«ÆäÖÃÓÚ¼ôÌù°åÉÏ\n¼ôÇÐ"
+ ID_EDIT_FIND "²éÕÒÖ¸¶¨µÄÕýÎÄ\n²éÕÒ"
+ ID_EDIT_PASTE "²åÈë¼ôÌù°åÄÚÈÝ\nÕ³Ìù"
+ ID_EDIT_REPEAT "Öظ´ÉÏÒ»²½²Ù×÷\nÖظ´"
+ ID_EDIT_REPLACE "Óò»Í¬µÄÕýÎÄÌæ»»Ö¸¶¨µÄÕýÎÄ\nÌæ»»"
+ ID_EDIT_SELECT_ALL "Ñ¡ÔñÕû¸öÎĵµ\nÑ¡ÔñÈ«²¿"
+ ID_EDIT_UNDO "³·Ïû×îºóÒ»²½²Ù×÷\n³·Ïû"
+ ID_EDIT_REDO "ÖØÐÂÖ´ÐÐÏÈÇ°Òѳ·ÏûµÄ²Ù×÷\nÖØÐÂÖ´ÐÐ"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ ID_VIEW_TOOLBAR "Show or hide the ToolBar\nShow or hide the ToolBar"
+ ID_VIEW_STATUS_BAR "Show or hide\nShow or hide"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ AFX_IDS_SCSIZE "¸Ä±ä´°¿Ú´óС"
+ AFX_IDS_SCMOVE "¸Ä±ä´°¿ÚλÖÃ"
+ AFX_IDS_SCMINIMIZE "½«´°¿ÚËõС³Éͼ±ê"
+ AFX_IDS_SCMAXIMIZE "°Ñ´°¿Ú·Å´óµ½×î´ó³ß´ç"
+ AFX_IDS_SCNEXTWINDOW "Çл»µ½ÏÂÒ»¸öÎĵµ´°¿Ú"
+ AFX_IDS_SCPREVWINDOW "Çл»µ½ÏÈÇ°µÄÎĵµ´°¿Ú"
+ AFX_IDS_SCCLOSE "¹Ø±Õ»î¶¯µÄ´°¿Ú²¢Ìáʾ±£´æËùÓÐÎĵµ"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ AFX_IDS_SCRESTORE "°Ñ´°¿Ú»Ö¸´µ½Õý³£´óС"
+ AFX_IDS_SCTASKLIST "¼¤»îÈÎÎñ±í"
+ AFX_IDS_MDICHILD "¼¤»î¸Ã´°¿Ú"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ AFX_IDS_PREVIEW_CLOSE "¹Ø±Õ´òÓ¡Ô¤ÀÀģʽ\nÈ¡ÏûÔ¤ÔÄ"
+END
+
+#endif // Chinese (P.R.C.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_READERTYPE MENU PRELOAD DISCARDABLE
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM "&Close", ID_FILE_CLOSE
+ MENUITEM "&Save As...", ID_FILE_SAVE
+ MENUITEM SEPARATOR
+ MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
+ MENUITEM "P&rinter Setup...", ID_FILE_PRINT_SETUP
+ MENUITEM SEPARATOR
+ MENUITEM "Recently File", ID_FILE_MRU_FILE1, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit...\tCtrl+Q", ID_APP_EXIT
+ END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "&Copy Select Text", ID_EDIT_COPY
+ MENUITEM "&Find Text...\tCtrl+F", ID_EDIT_FIND
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "Zoom &In\t\tNum+", ID_VIEW_ZOOMIN
+ MENUITEM "Zoom &Out\t\tNum-", ID_VIEW_ZOOMOUT
+ MENUITEM "Zoom &To...\tCtrl+M", ID_VIEW_ZOOMTO
+ MENUITEM SEPARATOR
+ MENUITEM "&Actual Size\tCtrl+1", ID_VIEW_ACTUALSIZE
+ MENUITEM "Fit &Page\tCtrl+2", ID_VIEW_FITPAGE
+ MENUITEM "Fit &Width\tCtrl+3", ID_VIEW_FITWIDTH
+ MENUITEM SEPARATOR
+ POPUP "&Rotate View"
+ BEGIN
+ MENUITEM "&Clockwise\tShift+Ctrl+Plus", ID_VIEW_CLOCKWISE, HELP
+ MENUITEM "Counterclock&wise\tShift+Ctrl+Minus",
+ ID_VIEW_COUNTERCLOCKWISE
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "&ToolBar", ID_VIEW_TOOLBAR
+ MENUITEM "&StatusBar", ID_VIEW_STATUS_BAR
+ END
+ POPUP "&Document"
+ BEGIN
+ MENUITEM "&First Page \t\tHome", ID_DOC_FIRSTPAGE
+ MENUITEM "P&revious Page\tLeft Arrow", ID_DOC_PREPAGE
+ MENUITEM "&Next Page\tRight Arrow", ID_DOC_NEXTPAGE
+ MENUITEM "&Last Page\tEnd", ID_DOC_LASTPAGE
+ MENUITEM SEPARATOR
+ MENUITEM "&Goto Page...\tShift+Ctrl+N", ID_DOC_GOTOPAGE
+ MENUITEM "", TEST_PRINT_METALFILE
+ END
+ POPUP "&Tool"
+ BEGIN
+ MENUITEM "&Hand Tool", ID_TOOL_HAND
+ MENUITEM "Se&lect Text", ID_TOOL_SELECT
+ MENUITEM "&Snapshot", ID_TOOL_SNAPSHOT
+ MENUITEM "Pdf2txt", ID_TOOL_PDF2TXT
+ MENUITEM "Extract links", ID_TOOL_EXTRACTLINKS
+ MENUITEM "Test JavaScript", IDM_Test_JS
+ END
+ POPUP "&Bitmap"
+ BEGIN
+ MENUITEM "&Export PDF to bitmap", ID_EXPORT_PDF_TO_BITMAP
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "About ReaderVC(&A)...", ID_APP_ABOUT
+ END
+END
+
+IDR_MAINFRAME MENU PRELOAD DISCARDABLE
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM "&Close", ID_FILE_CLOSE
+ MENUITEM "&Save As...", ID_FILE_SAVE
+ MENUITEM SEPARATOR
+ MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
+ MENUITEM "P&rinter Setup...", ID_FILE_PRINT_SETUP
+ MENUITEM SEPARATOR
+ MENUITEM "Recently File", ID_FILE_MRU_FILE1, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit...\tCtrl+Q", ID_APP_EXIT
+ END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM SEPARATOR
+ MENUITEM "&Copy Select Text", ID_EDIT_COPY
+ MENUITEM "&Find Text...\tCtrl+F", ID_EDIT_FIND
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "Zoom &In\t\tNum+", ID_VIEW_ZOOMIN
+ MENUITEM "Zoom &Out\t\tNum-", ID_VIEW_ZOOMOUT
+ MENUITEM "Zoom &To...\tCtrl+M", ID_VIEW_ZOOMTO
+ MENUITEM SEPARATOR
+ MENUITEM "&Actual Size\tCtrl+1", ID_VIEW_ACTUALSIZE
+ MENUITEM "Fit &Page\tCtrl+2", ID_VIEW_FITPAGE
+ MENUITEM "Fit &Width\tCtrl+3", ID_VIEW_FITWIDTH
+ MENUITEM SEPARATOR
+ POPUP "&Rotate View"
+ BEGIN
+ MENUITEM "&Clockwise\tShift+Ctrl+Plus", ID_VIEW_CLOCKWISE, HELP
+ MENUITEM "Counterclock&wise\tShift+Ctrl+Minus",
+ ID_VIEW_COUNTERCLOCKWISE
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "&ToolBar", ID_VIEW_TOOLBAR
+ MENUITEM "&StatusBar", ID_VIEW_STATUS_BAR
+ END
+ POPUP "&Document"
+ BEGIN
+ MENUITEM "&First Page \t\tHome", ID_DOC_FIRSTPAGE
+ MENUITEM "P&revious Page\tLeft Arrow", ID_DOC_PREPAGE
+ MENUITEM "&Next Page\tRight Arrow", ID_DOC_NEXTPAGE
+ MENUITEM "&Last Page\tEnd", ID_DOC_LASTPAGE
+ MENUITEM SEPARATOR
+ MENUITEM "&Goto Page...\tShift+Ctrl+N", ID_DOC_GOTOPAGE
+ MENUITEM "Print MetalFile", TEST_PRINT_METALFILE
+ END
+ POPUP "&Tool"
+ BEGIN
+ MENUITEM "&Hand Tool", ID_TOOL_HAND
+ MENUITEM "Se&lect Text", ID_TOOL_SELECT
+ MENUITEM "&Snapshot", ID_TOOL_SNAPSHOT
+ MENUITEM "Pdf2txt", ID_TOOL_PDF2TXT
+ MENUITEM "Extract links", ID_TOOL_EXTRACTLINKS
+ END
+ POPUP "&Bitmap"
+ BEGIN
+ MENUITEM "&Export PDF to bitmap", ID_EXPORT_PDF_TO_BITMAP
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "About ReaderVC(&A)...", ID_APP_ABOUT
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
+#ifdef _WIN32
+LANGUAGE 4, 2
+#pragma code_page(936)
+#endif //_WIN32
+#include "res\ReaderVC.rc2" // non-Microsoft Visual C++ edited resources
+#include "l.chs\afxres.rc" // Standard components
+#include "l.chs\afxprint.rc" // printing/print preview resources
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/xfa_test/FormFiller_Test/ReaderVCDoc.cpp b/xfa_test/FormFiller_Test/ReaderVCDoc.cpp
new file mode 100644
index 0000000000..e06515d67e
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVCDoc.cpp
@@ -0,0 +1,113 @@
+// ReaderVCDoc.cpp : implementation of the CReaderVCDoc class
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCDoc.h"
+#include "ReaderVCView.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCDoc
+
+IMPLEMENT_DYNCREATE(CReaderVCDoc, CDocument)
+
+BEGIN_MESSAGE_MAP(CReaderVCDoc, CDocument)
+ //{{AFX_MSG_MAP(CReaderVCDoc)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ // DO NOT EDIT what you see in these blocks of generated code!
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCDoc construction/destruction
+
+CReaderVCDoc::CReaderVCDoc()
+{
+ // TODO: add one-time construction code here
+
+}
+
+CReaderVCDoc::~CReaderVCDoc()
+{
+}
+
+BOOL CReaderVCDoc::OnNewDocument()
+{
+ if (!CDocument::OnNewDocument())
+ return FALSE;
+
+ // TODO: add reinitialization code here
+ // (SDI documents will reuse this document)
+
+ return TRUE;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCDoc serialization
+
+void CReaderVCDoc::Serialize(CArchive& ar)
+{
+ if (ar.IsStoring())
+ {
+ // TODO: add storing code here
+ }
+ else
+ {
+ // TODO: add loading code here
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCDoc diagnostics
+
+#ifdef _DEBUG
+void CReaderVCDoc::AssertValid() const
+{
+ CDocument::AssertValid();
+}
+
+void CReaderVCDoc::Dump(CDumpContext& dc) const
+{
+ CDocument::Dump(dc);
+}
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCDoc commands
+
+BOOL CReaderVCDoc::OnOpenDocument(LPCTSTR lpszPathName)
+{
+ if (!CDocument::OnOpenDocument(lpszPathName))
+ return FALSE;
+
+ // TODO: Add your specialized creation code here
+ void* pDoc = FPDF_LoadDocument(lpszPathName, NULL);
+
+ m_strPDFName=lpszPathName;
+ if(NULL == pDoc) return FALSE;
+ POSITION pos = GetFirstViewPosition();
+ int nCount = FPDF_GetPageCount(pDoc);
+ while (pos != NULL)
+ {
+ CView* pView = GetNextView(pos);
+ if(pView->IsKindOf(RUNTIME_CLASS(CReaderVCView)))
+ {
+ CMainFrame* pMFrm = (CMainFrame*)AfxGetMainWnd();
+ CChildFrame* pChildFrm =(CChildFrame*) pMFrm->GetActiveFrame();
+ pChildFrm->SetActiveView(pView, TRUE);
+// FPDFApp_SetDocument(((CReaderVCView*)pView)->GetFPDFApp(), (FPDF_DOCUMENT)pDoc);
+ ((CReaderVCView*)pView)->SetPDFDocument(pDoc, nCount);
+ }
+ }
+ return TRUE;
+}
diff --git a/xfa_test/FormFiller_Test/ReaderVCDoc.h b/xfa_test/FormFiller_Test/ReaderVCDoc.h
new file mode 100644
index 0000000000..5bfc7e17f8
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVCDoc.h
@@ -0,0 +1,59 @@
+ // ReaderVCDoc.h : interface of the CReaderVCDoc class
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_READERVCDOC_H__6E0B9799_0661_4DB3_9E40_FB2D17F0D5EB__INCLUDED_)
+#define AFX_READERVCDOC_H__6E0B9799_0661_4DB3_9E40_FB2D17F0D5EB__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+class CReaderVCDoc : public CDocument
+{
+protected: // create from serialization only
+ CReaderVCDoc();
+ DECLARE_DYNCREATE(CReaderVCDoc)
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CReaderVCDoc)
+ public:
+ virtual BOOL OnNewDocument();
+ virtual void Serialize(CArchive& ar);
+ virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ CString m_strPDFName;
+ virtual ~CReaderVCDoc();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CReaderVCDoc)
+ // NOTE - the ClassWizard will add and remove member functions here.
+ // DO NOT EDIT what you see in these blocks of generated code !
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_READERVCDOC_H__6E0B9799_0661_4DB3_9E40_FB2D17F0D5EB__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ReaderVCView.cpp b/xfa_test/FormFiller_Test/ReaderVCView.cpp
new file mode 100644
index 0000000000..ef0b58bfbb
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVCView.cpp
@@ -0,0 +1,3750 @@
+// ReaderVCView.cpp : implementation of the CReaderVCView class
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCDoc.h"
+#include "ReaderVCView.h"
+
+#include "GotoPageDlg.h"
+#include "ZoomDlg.h"
+#include "FindDlg.h"
+#include "ConvertDlg.h"
+#include "JS_ResponseDlg.h"
+#include "TestJsDlg.h"
+//#include "../../include/pp_event.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCView
+
+IMPLEMENT_DYNCREATE(CReaderVCView, CView)
+
+BEGIN_MESSAGE_MAP(CReaderVCView, CView)
+ //{{AFX_MSG_MAP(CReaderVCView)
+ ON_COMMAND(ID_DOC_FIRSTPAGE, OnDocFirstpage)
+ ON_COMMAND(ID_DOC_GOTOPAGE, OnDocGotopage)
+ ON_COMMAND(ID_DOC_LASTPAGE, OnDocLastpage)
+ ON_COMMAND(ID_DOC_NEXTPAGE, OnDocNextpage)
+ ON_COMMAND(ID_DOC_PREPAGE, OnDocPrepage)
+ ON_COMMAND(ID_VIEW_CLOCKWISE, OnClockwise)
+ ON_COMMAND(ID_VIEW_COUNTERCLOCKWISE, OnCounterclockwise)
+ ON_COMMAND(ID_VIEW_ACTUALSIZE, OnViewActualSize)
+ ON_COMMAND(ID_VIEW_FITPAGE, OnViewFitPage)
+ ON_COMMAND(ID_VIEW_FITWIDTH, OnViewFitWidth)
+ ON_COMMAND(ID_VIEW_ZOOMIN, OnViewZoomIn)
+ ON_COMMAND(ID_VIEW_ZOOMOUT, OnViewZoomOut)
+ ON_COMMAND(ID_VIEW_ZOOMTO, OnViewZoomTo)
+ ON_COMMAND(ID_EDIT_FIND, OnEditFind)
+ ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_MOUSEMOVE()
+ ON_WM_KEYDOWN()
+ ON_COMMAND(ID_TOOL_SNAPSHOT, OnToolSnapshot)
+ ON_COMMAND(ID_TOOL_SELECT, OnToolSelect)
+ ON_COMMAND(ID_TOOL_HAND, OnToolHand)
+ ON_COMMAND(ID_TOOL_PDF2TXT, OnToolPdf2txt)
+ ON_WM_SIZE()
+ ON_WM_HSCROLL()
+ ON_WM_VSCROLL()
+ ON_COMMAND(ID_TOOL_EXTRACTLINKS, OnToolExtractlinks)
+ ON_WM_DESTROY()
+ ON_UPDATE_COMMAND_UI(ID_DOC_FIRSTPAGE, OnUpdateDocFirstpage)
+ ON_UPDATE_COMMAND_UI(ID_DOC_LASTPAGE, OnUpdateDocLastpage)
+ ON_UPDATE_COMMAND_UI(ID_DOC_NEXTPAGE, OnUpdateDocNextpage)
+ ON_UPDATE_COMMAND_UI(ID_DOC_PREPAGE, OnUpdateDocPrepage)
+ ON_UPDATE_COMMAND_UI(ID_TOOL_HAND, OnUpdateToolHand)
+ ON_UPDATE_COMMAND_UI(ID_TOOL_SNAPSHOT, OnUpdateToolSnapshot)
+ ON_UPDATE_COMMAND_UI(ID_TOOL_SELECT, OnUpdateToolSelect)
+ ON_COMMAND(ID_VIEW_BOOKMARK, OnViewBookmark)
+ ON_WM_MOUSEWHEEL()
+ ON_WM_CONTEXTMENU()
+ ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
+ ON_COMMAND(ID_RENDERBITMAP, OnRenderbitmap)
+ ON_COMMAND(ID_EXPORT_PDF_TO_BITMAP, OnExportPdfToBitmap)
+ ON_WM_CHAR()
+ ON_WM_KEYUP()
+ ON_COMMAND(ID_FILE_SAVE, OnFileSave)
+ ON_COMMAND(IDM_Test_JS, OnTestJS)
+ ON_COMMAND(TEST_PRINT_METALFILE, OnPrintMetalfile)
+ //}}AFX_MSG_MAP
+ // Standard printing commands
+ ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
+ ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
+ ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCView construction/destruction
+void Sample_PageToDevice(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page,double page_x,double page_y, int* device_x, int* device_y)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->PageToDeviceImpl(page, page_x, page_y, device_x, device_y);
+ }
+ //((CReaderVCView*)pThis)->PageToDeviceImpl(page, page_x, page_y, device_x, device_y);
+}
+
+void Sample_Invalidate(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->InvalidateImpl(page,left, top, right, bottom);
+ }
+ //((CReaderVCView*)pThis)->InvalidateImpl(page,left, top, right, bottom);
+}
+
+void Sample_OutputSelectedRect(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->OutputSelectedRectImpl(page,left, top, right, bottom);
+ }
+}
+
+void Sample_DeviceToPage(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page,int device_x, int device_y, double* page_x, double* page_y)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->DeviceToPageImpl(page, device_x, device_y, page_x, page_y);
+ }
+ //((CReaderVCView*)pThis)->DeviceToPageImpl(page, device_x, device_y, page_x, page_y);
+}
+/* /* Remove by Amy Lin 20100913, Since we don't this the FFI_SetCaret any more.
+void Sample_SetCaret(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page,double page_x, double page_y, int nWidth, int nHeight)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->SetCaretImpl(page, page_x, page_y, nWidth, nHeight);
+ }
+ //((CReaderVCView*)pThis)->SetCaretImpl(page, page_x, page_y, nWidth, nHeight);
+}
+*/
+void Sample_Release(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->ReleaseImpl();
+ }
+ //((CReaderVCView*)pThis)->ReleaseImpl();
+}
+
+
+int Sample_SetTimer(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->SetTimerImpl(uElapse, lpTimerFunc);
+ }else{
+ return -1;
+ }
+ //return ((CReaderVCView*)pThis)->SetTimerImpl(uElapse, lpTimerFunc);
+}
+
+void Sample_KillTimer(struct _FPDF_FORMFILLINFO* pThis,int nID)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->KillTimerImpl(nID);
+ }
+ //((CReaderVCView*)pThis)->KillTimerImpl(nID);
+}
+
+void Sample_SetCursor(struct _FPDF_FORMFILLINFO* pThis,int nCursorType)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->SetCurorImpl(nCursorType);
+ }
+ //((CReaderVCView*)pThis)->SetCurorImpl(nCursorType);
+}
+
+void Sample_OnChange(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->OnChangeImpl();
+ }
+}
+FPDF_BOOL Sample_IsSHIFTKeyDown(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->IsSHIFTKeyDownImpl();
+ }
+ return FALSE;
+}
+FPDF_BOOL Sample_IsCTRLKeyDown(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->IsCTRLKeyDownImpl();
+ }
+ return FALSE;
+}
+FPDF_BOOL Sample_IsALTKeyDown(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->IsALTKeyDownImpl();
+ }
+ return FALSE;
+}
+FPDF_BOOL Sample_IsINSERTKeyDown(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->IsINSERTKeyDownImpl();
+ }
+ return FALSE;
+}
+
+FPDF_PAGE Sample_GetPage(struct _FPDF_FORMFILLINFO* pThis,FPDF_DOCUMENT document, int nPageIndex)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->GetPageImpl(document,nPageIndex);
+ }
+ return NULL;
+}
+
+FPDF_PAGE Sample_GetCurrentPage(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->GetCurrentPageImpl(document);
+ }
+ return NULL;
+}
+
+int Sample_GetRotation(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->GetRotationImpl(page);
+ }
+ return NULL;
+}
+FPDF_SYSTEMTIME Sample_GetLocalTime(struct _FPDF_FORMFILLINFO* pThis)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ return pView->GetLocalTimeImpl();
+ }
+ return FPDF_SYSTEMTIME();
+}
+
+void SampleRelease(struct _FPDF_SYSFONTINFO* pThis)
+{
+ ((CSampleFontInfo*)pThis)->ReleaseImpl();
+}
+
+void SampleEnumFonts(struct _FPDF_SYSFONTINFO* pThis, void* pMapper)
+{
+ ((CSampleFontInfo*)pThis)->EnumFontsImpl(pMapper);
+}
+
+void* SampleMapFont(struct _FPDF_SYSFONTINFO* pThis, int weight, int bItalic, int charset, int pitch_family,
+ const char* face, int* bExact)
+{
+ return ((CSampleFontInfo*)pThis)->MapFontImpl(weight, bItalic, charset, pitch_family, face, bExact);
+}
+
+unsigned long SampleGetFontData(struct _FPDF_SYSFONTINFO* pThis, void* hFont,
+ unsigned int table, unsigned char* buffer, unsigned long buf_size)
+{
+ return ((CSampleFontInfo*)pThis)->GetFontDataImpl(hFont, table, buffer, buf_size);
+}
+
+unsigned long SampleGetFaceName(struct _FPDF_SYSFONTINFO* pThis, void* hFont, char* buffer, unsigned long buf_size)
+{
+ return ((CSampleFontInfo*)pThis)->GetFaceNameImpl(hFont, buffer, buf_size);
+}
+
+int SampleGetFontCharset(struct _FPDF_SYSFONTINFO* pThis, void* hFont)
+{
+ return ((CSampleFontInfo*)pThis)->GetFontCharsetImpl(hFont);
+}
+
+void SampleDeleteFont(struct _FPDF_SYSFONTINFO* pThis, void* hFont)
+{
+ ((CSampleFontInfo*)pThis)->DeleteFontImpl(hFont);
+}
+
+void SetSampleFontInfo()
+{
+ CSampleFontInfo* pFontInfo = new CSampleFontInfo;
+ pFontInfo->version = 1;
+ pFontInfo->DeleteFont = SampleDeleteFont;
+ pFontInfo->EnumFonts = SampleEnumFonts;
+ pFontInfo->GetFaceName = SampleGetFaceName;
+ pFontInfo->GetFont = NULL;
+ pFontInfo->GetFontCharset = SampleGetFontCharset;
+ pFontInfo->GetFontData = SampleGetFontData;
+ pFontInfo->MapFont = SampleMapFont;
+ pFontInfo->Release = SampleRelease;
+ FPDF_SetSystemFontInfo(pFontInfo);
+}
+
+void Sample_ExecuteNamedAction(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if ( pView )
+ {
+ pView->ExecuteNamedActionImpl(namedAction);
+ }
+
+}
+void CReaderVCView::ExecuteNamedActionImpl(FPDF_BYTESTRING namedaction)
+{
+ if(strcmp("Print", (LPCSTR)namedaction) == 0)
+ OnFilePrint();
+}
+void CReaderVCView::OutputSelectedRectImpl(FPDF_PAGE page, double left, double top, double right, double bottom)
+{
+
+ if(page == m_pPage)
+ {
+
+ int device_left, device_top, device_right, device_bottom;
+
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, left, top, &device_left, &device_top);
+
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, right, bottom, &device_right, &device_bottom);
+
+ CRect rc(device_left,device_top, device_right, device_bottom);
+
+
+
+ m_SelectArray.Add(rc);
+
+
+ }
+}
+
+void Sample_Release(FPDF_LPVOID clientData)
+{
+ if (!clientData) return;
+
+ fclose(((FPDF_FILE*)clientData)->file);
+ delete ((FPDF_FILE*)clientData);
+}
+
+FPDF_DWORD Sample_GetSize(FPDF_LPVOID clientData)
+{
+ if (!clientData) return 0;
+
+ long curPos = ftell(((FPDF_FILE*)clientData)->file);
+ fseek(((FPDF_FILE*)clientData)->file, 0, SEEK_END);
+ long size = ftell(((FPDF_FILE*)clientData)->file);
+ fseek(((FPDF_FILE*)clientData)->file, curPos, SEEK_SET);
+
+ return (FPDF_DWORD)size;
+}
+
+FPDF_RESULT Sample_ReadBlock(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPVOID buffer, FPDF_DWORD size)
+{
+ if (!clientData) return -1;
+
+ fseek(((FPDF_FILE*)clientData)->file, (long)offset, SEEK_SET);
+ size_t readSize = fread(buffer, 1, size, ((FPDF_FILE*)clientData)->file);
+ return readSize == size ? 0 : -1;
+}
+
+FPDF_RESULT Sample_WriteBlock(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPCVOID buffer, FPDF_DWORD size)
+{
+ if (!clientData) return -1;
+
+ fseek(((FPDF_FILE*)clientData)->file, (long)offset, SEEK_SET);
+ //Write data
+ size_t writeSize = fwrite(buffer, 1, size, ((FPDF_FILE*)clientData)->file);
+ return writeSize == size ? 0 : -1;
+}
+
+FPDF_RESULT Sample_Flush(FPDF_LPVOID clientData)
+{
+ if (!clientData) return -1;
+
+ //Flush file
+ fflush(((FPDF_FILE*)clientData)->file);
+
+ return 0;
+}
+
+FPDF_RESULT Sample_Truncate(FPDF_LPVOID clientData, FPDF_DWORD size)
+{
+ return 0;
+}
+
+void Sample_DisplayCaret(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_BOOL bVisible, double left, double top, double right, double bottom)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if (!pView) return;
+
+ HWND hWnd = pView->m_hWnd;
+
+ if (bVisible)
+ {
+ CPoint ltPt;
+ pView->PageToDevice(left, top, ltPt);
+ CPoint rbPt;
+ pView->PageToDevice(right, bottom, rbPt);
+ CRect rcCaret(ltPt, rbPt);
+
+ ::DestroyCaret();
+ ::CreateCaret(hWnd, (HBITMAP)0, rcCaret.Width(), rcCaret.Height());
+ ::SetCaretPos (rcCaret.left, rcCaret.top);
+ ::ShowCaret(hWnd);
+ }
+ else
+ {
+ ::DestroyCaret();
+ ::HideCaret(hWnd);
+ }
+}
+
+int Sample_GetCurrentPageIndex(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document)
+{
+ CReaderVCView* pView =(CReaderVCView*)pThis;
+ if (!pView) return -1;
+
+ return pView->GetCurrentPageIndex();
+}
+
+void Sample_SetCurrentPage(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int iCurPage)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis;
+ if (!pView) return;
+
+ FPDF_DOCUMENT curDoc = pView->GetPDFDoc();
+ if (curDoc != document)
+ return;
+
+ int nPageCount = FPDF_GetPageCount(curDoc);
+ if (nPageCount > iCurPage)
+ {
+ int nCurPageInx = pView->GetCurrentPageIndex();
+ if (nCurPageInx != iCurPage)
+ {
+ pView->GotoPage(nCurPageInx);
+ }
+ }
+}
+
+void Sample_GotoURL(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, FPDF_WIDESTRING wsURL)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis;
+ if (!pView) return;
+
+ wchar_t* pURL = (wchar_t*)wsURL;
+ MessageBoxW(NULL, pURL, NULL, MB_OK);
+}
+
+FPDF_WIDESTRING Sample_GetURL(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis;
+ if (!pView) return NULL;
+
+ if (pView->GetPDFDoc() != document)
+ return NULL;
+
+ //not support in this demo
+
+ return NULL;
+}
+
+void Sample_AddDoRecord(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, FPDF_WIDGET hWidget)
+{
+ //not support
+}
+
+void Sample_PageEvent(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_DWORD eventFlag)
+{
+ //
+}
+
+void Sample_GetPageViewRect(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double* left, double* top, double* right, double* bottom)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis;
+ if (!pView) return;
+
+ if (pView->GetPage() != page)
+ return;
+
+ CRect clientRect;
+ pView->GetClientRect(&clientRect);
+
+ *left = (double)clientRect.left;
+ *right = (double)clientRect.right;
+ *top = (double)clientRect.top;
+ *bottom = (double)clientRect.bottom;
+}
+
+#define WM_XFAMENU_COPY 10000
+
+FPDF_BOOL Sample_PopupMenu(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_WIDGET hWidget, int menuFlag, float x, float y)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis;
+ if (!pView)
+ return FALSE;
+
+ CMenu menu;
+ menu.CreatePopupMenu();
+
+ int nMenuIndex = 0;
+
+ if (menuFlag & FXFA_MEMU_COPY)
+ menu.InsertMenu(nMenuIndex++, MF_BYPOSITION, WM_XFAMENU_COPY, "Copy");
+ //...
+
+ CPoint pt;
+ pView->PageToDevice(x, y, pt);
+
+ UINT nID = menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, pView);
+ switch(nID)
+ {
+ case WM_XFAMENU_COPY:
+ {
+ FPDF_DWORD length = 0;
+ FPDF_Widget_Copy(pView->GetPDFDoc(), hWidget, NULL, &length);
+ if (length > 0)
+ {
+ unsigned short* buffer = (unsigned short*)malloc((length+1)*sizeof(unsigned short));
+ memset(buffer, 0, (length+1)*sizeof(unsigned short));
+ FPDF_Widget_Copy(pView->GetPDFDoc(), hWidget, buffer, &length);
+ free(buffer);
+ }
+ }
+ break;
+ }
+
+ menu.DestroyMenu();
+
+ return TRUE;
+}
+
+FPDF_FILEHANDLER* Sample_OpenFile(struct _FPDF_FORMFILLINFO* pThis, int fileFlag, FPDF_WIDESTRING wsURL)
+{
+ char* pszURL;
+ CString strURL;
+ if (wsURL == NULL) {
+ if (fileFlag == FXFA_FILE_XDP)
+ strURL = "C://temp.xdp";
+ else if(fileFlag == FXFA_FILE_XML)
+ strURL = "C://temp.xml";
+ }
+ else {
+ int iSize;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsURL, -1, NULL, 0, NULL, NULL);
+ pszURL = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsURL, -1, pszURL, iSize, NULL, NULL);
+ CString str(pszURL);
+ strURL = str;
+ }
+
+
+ FILE* file = fopen(strURL, "r");
+ FPDF_FILE* pFileHander = new FPDF_FILE;
+ pFileHander->file = file;
+ pFileHander->fileHandler.clientData = pFileHander;
+ pFileHander->fileHandler.Flush = Sample_Flush;
+ pFileHander->fileHandler.GetSize = Sample_GetSize;
+ pFileHander->fileHandler.ReadBlock = Sample_ReadBlock;
+ pFileHander->fileHandler.Release = Sample_Release;
+ pFileHander->fileHandler.Truncate = Sample_Truncate;
+ pFileHander->fileHandler.WriteBlock = Sample_WriteBlock;
+
+ free(pszURL);
+ return &pFileHander->fileHandler;
+}
+
+FPDF_BOOL Sample_GetFilePath(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* pFileHandler, FPDF_BSTR* path)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis;
+ if (!pView)
+ return NULL;
+
+ CString filePath = pView->GetFilePath();
+ FPDF_BStr_Set(path, filePath.GetBuffer(filePath.GetLength()), filePath.GetLength());
+
+ return TRUE;
+}
+
+void Sample_EmailTo(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, FPDF_WIDESTRING emailTo)
+{
+ MessageBoxW(NULL, (wchar_t*)emailTo, L"Sample_email", MB_OK);
+}
+
+void Sample_UploadTo(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, FPDF_WIDESTRING uploadTo)
+{
+ int iSize;
+ char* pszURL;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)uploadTo, -1, NULL, 0, NULL, NULL);
+ pszURL = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)uploadTo, -1, pszURL, iSize, NULL, NULL);
+ CString strPath(pszURL);
+
+ CString strUploadPath = "C://test";
+ int pos = strPath.ReverseFind('.');
+ if (pos != -1){
+ CString suffix = strPath.Right(strPath.GetLength()-pos);
+ strUploadPath += suffix;
+ }
+
+ FILE* file = fopen(strUploadPath, "r");
+ if (file) {
+ int size = fileHandler->GetSize(fileHandler->clientData);
+ BYTE* buffer = (BYTE*)malloc(size);
+ fileHandler->ReadBlock(fileHandler->clientData, 0, buffer, size);
+ fwrite(buffer, size, 1, file);
+ fflush(file);
+ fclose(file);
+ free(buffer);
+ }
+
+ free(pszURL);
+}
+
+int Sample_GetAppName(struct _FPDF_FORMFILLINFO* pThis, void* appName, int length)
+{
+ if(appName == NULL || length <= 0)
+ {
+ CString name = AfxGetAppName();
+ return name.GetLength();
+ }
+ else
+ {
+ CString name = AfxGetAppName();
+ int len = name.GetLength();
+ if(length > len)
+ length = len;
+ memcpy(appName, name.GetBuffer(name.GetLength()), length);
+ return length;
+ }
+}
+
+int Sample_GetPlatform(struct _FPDF_FORMFILLINFO* pThis, void* platform, int length)
+{
+ if(platform == NULL || length <= 0)
+ {
+ return 3;
+ }
+ else
+ {
+ if(length > 3)
+ length = 3;
+ memcpy(platform, "win", length);
+ return length;
+ }
+}
+
+int Sample_GetDocumentCount(struct _FPDF_FORMFILLINFO* pThis)
+{
+ return 1;
+}
+
+int Sample_GetCurDocumentIndex(struct _FPDF_FORMFILLINFO* pThis)
+{
+ return 0;
+}
+
+FPDF_LPFILEHANDLER Sample_DownloadFromURL(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING URL)
+{
+ int iSize;
+ char* pszURL;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)URL, -1, NULL, 0, NULL, NULL);
+ pszURL = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)URL, -1, pszURL, iSize, NULL, NULL);
+ CString strURL(pszURL);
+
+ CString bsLocal = strURL;
+ CReaderVCView::CreateLocalPath(bsLocal);
+
+ if (strURL.Left(7) == "http://")
+ {
+ CInternetSession sess;
+ CHttpFile *pFile = (CHttpFile*)sess.OpenURL(strURL);
+ int iLength = pFile->GetLength();
+ if (pFile == NULL || iLength < 1) return NULL;
+
+ FILE *pImageFile = fopen(bsLocal, "wb");
+
+ BYTE* pContent = new BYTE[iLength];
+ memset(pContent, 0, iLength);
+ int iRead = pFile->Read(pContent, iLength);
+
+ fwrite(pContent, 1, iLength, pImageFile);
+ free(pContent);
+ fflush(pImageFile);
+ fclose(pImageFile);
+
+ pFile->Close();
+ delete pFile;
+ sess.Close();
+ }
+ else if (strURL.Left(6) == "ftp://")
+ {
+ CInternetSession sess;
+ CFtpConnection* pConnect = sess.GetFtpConnection(bsLocal, "NULL", "NULL");
+ CInternetFile* pFile = pConnect->OpenFile(bsLocal);
+
+ int iLength = pFile->GetLength();
+ if (pFile == NULL || iLength < 1) return NULL;
+ FILE *pImageFile = fopen(bsLocal, "wb");
+
+ BYTE* pContent = new BYTE[iLength];
+ memset(pContent, 0, iLength);
+ int iRead = pFile->Read(pContent, iLength);
+
+ fwrite(pContent, 1, iLength, pImageFile);
+ free(pContent);
+ fflush(pImageFile);
+ fclose(pImageFile);
+
+ pFile->Close();
+ delete pFile;
+ sess.Close();
+ }
+
+ free(pszURL);
+
+ FPDF_FILE* fileWrap = new FPDF_FILE;
+ FILE* file = fopen(bsLocal, "r");
+ fileWrap->file = file;
+ fileWrap->fileHandler.clientData = fileWrap;
+ fileWrap->fileHandler.ReadBlock = Sample_ReadBlock;
+ fileWrap->fileHandler.GetSize = Sample_GetSize;
+ fileWrap->fileHandler.Flush = Sample_Flush;
+ fileWrap->fileHandler.Release = Sample_Release;
+ fileWrap->fileHandler.Truncate = Sample_Truncate;
+ fileWrap->fileHandler.WriteBlock = Sample_WriteBlock;
+
+ return &fileWrap->fileHandler;
+}
+
+FPDF_BOOL Sample_PostRequestURL(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsURL, FPDF_WIDESTRING wsData, FPDF_WIDESTRING wsContentType, FPDF_WIDESTRING wsEncode, FPDF_WIDESTRING wsHeader, FPDF_BSTR* respone)
+{
+ int iSize;
+ char* pszURL;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsURL, -1, NULL, 0, NULL, NULL);
+ pszURL = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsURL, -1, pszURL, iSize, NULL, NULL);
+ CString csURL(pszURL);
+
+ char* pszData;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsData, -1, NULL, 0, NULL, NULL);
+ pszData = (char*)malloc(iSize+1);
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsData, -1, pszData, iSize, NULL, NULL);
+ CString csData(pszData);
+
+ char* pszContentType;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsContentType, -1, NULL, 0, NULL, NULL);
+ pszContentType = (char*)malloc(iSize+1);
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsContentType, -1, pszContentType, iSize, NULL, NULL);
+ CString csContentType(pszContentType);
+
+ char* pszHeader;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsHeader, -1, NULL, 0, NULL, NULL);
+ pszHeader = (char*)malloc(iSize+1);
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsHeader, -1, pszHeader, iSize, NULL, NULL);
+ CString csHeader(pszHeader);
+
+ CString csApp = AfxGetAppName();
+ csApp += L"/1.0";
+ BOOL bRet = FALSE;
+ DWORD dwServiceType = 0, dwFlags = ICU_NO_META;
+ CString csServer, sObject, csUserName, csPassword;
+ INTERNET_PORT nPort = 0;
+
+ bRet = AfxParseURLEx(csURL, dwServiceType, csServer, sObject, nPort, csUserName, csPassword, dwFlags);
+ if (!bRet)
+ return bRet;
+
+ if (dwServiceType != AFX_INET_SERVICE_HTTP && dwServiceType != AFX_INET_SERVICE_HTTPS)
+ return bRet;
+
+ CString csObject = sObject;
+ CString csResponse;
+ bRet = CReaderVCView::HttpDataPost(csData, csApp, csObject, csServer, csUserName, csPassword, nPort,
+ dwServiceType == AFX_INET_SERVICE_HTTPS, csContentType, csHeader, csResponse);
+
+ FPDF_BStr_Init(respone);
+ FPDF_BStr_Set(respone, (FPDF_LPCSTR)csResponse.GetBuffer(csResponse.GetLength()), csResponse.GetLength());
+
+ free(pszURL);
+ free(pszData);
+ free(pszContentType);
+ free(pszHeader);
+
+ return true;
+}
+
+FPDF_BOOL Sample_PutRequestURL(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsURL, FPDF_WIDESTRING wsData, FPDF_WIDESTRING wsEncode)
+{
+ int iSize;
+ char* pszURL;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsURL, -1, NULL, 0, NULL, NULL);
+ pszURL = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsURL, -1, pszURL, iSize, NULL, NULL);
+ CString csURL(pszURL);
+
+ char* pszData;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsData, -1, NULL, 0, NULL, NULL);
+ pszData = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsData, -1, pszData, iSize, NULL, NULL);
+ CString csData(pszData);
+
+ CString csApp = AfxGetAppName();
+ csApp += L"/1.0";
+ BOOL bRet = FALSE;
+ DWORD dwServiceType = 0, dwFlags = ICU_NO_META;
+ CString csServer, sObject, csUserName, csPassword;
+ INTERNET_PORT nPort = 0;
+
+ bRet = AfxParseURLEx(csURL, dwServiceType, csServer, sObject, nPort, csUserName, csPassword, dwFlags);
+ if (!bRet)
+ return bRet;
+
+ if (dwServiceType != AFX_INET_SERVICE_HTTP && dwServiceType != AFX_INET_SERVICE_HTTPS)
+ return bRet;
+
+ CString csObject = sObject;
+
+ bRet = CReaderVCView::HttpDataPut(csData, csApp, csObject, csServer, csUserName, csPassword, nPort, dwServiceType == AFX_INET_SERVICE_HTTPS);
+
+ free(pszData);
+ free(pszURL);
+ return TRUE;
+}
+
+FPDF_BOOL Sample_ShowFileDialog(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsTitle, FPDF_WIDESTRING wsFilter, FPDF_BOOL isOpen, FPDF_STRINGHANDLE pathArr)
+{
+ int iSize;
+ char* pszFilter;
+ iSize = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsFilter, -1, NULL, 0, NULL, NULL);
+ pszFilter = (char*)malloc((iSize+1));
+ WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wsFilter, -1, pszFilter, iSize, NULL, NULL);
+
+ CFileDialog fileOpen(isOpen, NULL,NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST, pszFilter);
+ // fileOpen.m_ofn.Flags|=OFN_ENABLEHOOK|OFN_ALLOWMULTISELECT;
+ if(fileOpen.DoModal()==IDCANCEL)
+ {
+ return FALSE;
+ }
+
+ POSITION pos;
+ pos=fileOpen.GetStartPosition();
+ CString csFile;
+ while(pos!=NULL)
+ {
+ csFile=fileOpen.GetNextPathName(pos);
+ FPDF_StringHandleAddString(pathArr, csFile.GetBuffer(csFile.GetLength()), csFile.GetLength());
+ }
+
+ free(pszFilter);
+ return TRUE;
+}
+
+FPDF_SYSTEMTIME CReaderVCView::GetLocalTimeImpl()
+{
+ FPDF_SYSTEMTIME sys;
+ time_t curTime;
+ time(&curTime);
+ tm* pTm = localtime(&curTime);
+ if(pTm)
+ {
+ sys.wDay = pTm->tm_mday;
+ sys.wDayOfWeek= pTm->tm_wday;
+ sys.wHour = pTm->tm_hour;
+ sys.wMilliseconds = 0;
+ sys.wMinute = pTm->tm_min;
+ sys.wMonth = pTm->tm_mon;
+ sys.wSecond = pTm->tm_sec;
+ sys.wYear = pTm->tm_year + 1900;
+ }
+
+ return sys;
+}
+
+int CReaderVCView::GetRotationImpl(FPDF_PAGE page)
+{
+ return m_nRotateFlag;
+}
+
+FPDF_PAGE CReaderVCView::GetPageImpl(FPDF_DOCUMENT document,int nPageIndex)
+{
+ FPDF_PAGE page = NULL;
+ m_pageMap.Lookup(nPageIndex, page);
+ if(page)
+ return page;
+ page = FPDF_LoadPage(document, nPageIndex);
+ FORM_OnAfterLoadPage(page, m_pApp);
+ m_pageMap.SetAt(nPageIndex, page);
+ return page;
+}
+
+FPDF_PAGE CReaderVCView::GetCurrentPageImpl(FPDF_DOCUMENT document)
+{
+ return m_pPage;
+}
+
+bool CReaderVCView::IsALTKeyDownImpl()
+{
+ return GetKeyState(VK_MENU) < 0;
+}
+bool CReaderVCView::IsINSERTKeyDownImpl()
+{
+ return GetKeyState(VK_INSERT) & 0x01;
+}
+bool CReaderVCView::IsSHIFTKeyDownImpl()
+{
+ return !((GetKeyState(VK_SHIFT)&0x8000) == 0);
+}
+bool CReaderVCView::IsCTRLKeyDownImpl()
+{
+ return GetKeyState(VK_CONTROL) < 0;
+}
+
+void CReaderVCView::OnChangeImpl()
+{
+
+}
+
+CString CReaderVCView::GetFilePath()
+{
+ CReaderVCDoc* pDoc = GetDocument();
+ if(pDoc)
+ {
+ return pDoc->m_strPDFName;
+ }
+ return "";
+}
+
+BOOL CReaderVCView::SubmitFormImpl(void* pBuffer, int nLength, CString strURL)
+{
+ CString tempFDFFile = "D://1.fdf";
+
+ if (pBuffer == NULL || nLength <= 0)
+ {
+ return FALSE;
+ }
+
+ CFile file;
+ if (file.Open(tempFDFFile, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary))
+ {
+ file.Write(pBuffer, nLength);
+ file.Close();
+ }
+
+ return TRUE;
+}
+
+int Sample_appResponse(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Question, FPDF_WIDESTRING Title,
+ FPDF_WIDESTRING Default, FPDF_WIDESTRING cLabel, FPDF_BOOL bPassword, void* response, int length)
+{
+ CReaderVCView* pView = (CReaderVCView*)pThis->m_pFormfillinfo;
+ FPDF_WIDESTRING wsResponse;
+
+ if (pView->m_pwsResponse && response != NULL)
+ {
+ wsResponse = (FPDF_WIDESTRING)pView->m_pwsResponse;
+ length = wcslen((const wchar_t*)wsResponse);
+ memcpy(response, wsResponse, length*sizeof(wchar_t));
+ pView->m_pwsResponse = NULL;
+ }
+ else
+ {
+ CJS_ResponseDlg dlg;
+ dlg.SetTitle(Title);
+ dlg.SetDefault(Default);
+ dlg.SetLabel(cLabel);
+ dlg.SetQuestion(Question);
+ dlg.SetIsVisible(bPassword);
+ int iRet = dlg.DoModal();
+
+ if (iRet == 1)
+ {
+ wsResponse = dlg.GetResponse();
+ length = wcslen((const wchar_t*)wsResponse);
+ pView->m_pwsResponse = new wchar_t[length+1];
+ memset(pView->m_pwsResponse, 0, length*sizeof(wchar_t));
+ memcpy(pView->m_pwsResponse, wsResponse, length*sizeof(wchar_t));
+ pView->m_pwsResponse[length] = L'\0';
+ }
+ }
+
+ return length*sizeof(wchar_t);
+}
+
+int Sample_appalert(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon)
+{
+ int nRet = 0;
+ if(pThis && pThis->m_pFormfillinfo)
+ {
+ CReaderVCView* pView = (CReaderVCView*)pThis->m_pFormfillinfo;
+ int msgType = MB_OK;
+ switch(Type)
+ {
+
+ case 1:
+ msgType = MB_OKCANCEL;
+ break;
+ case 2:
+ msgType = MB_YESNO;
+ break;
+ case 3:
+ msgType = MB_YESNOCANCEL;
+ break;
+ case 0:
+ default:
+ break;
+ }
+ nRet = MessageBoxW(pView->m_hWnd, (const wchar_t*)Msg, (const wchar_t*)Title, msgType);
+ switch(nRet)
+ {
+ case IDOK:
+ return 1;
+ case IDCANCEL:
+ return 2;
+ case IDNO:
+ return 3;
+ case IDYES:
+ return 4;
+ }
+ return nRet;
+ }
+ return nRet;
+}
+
+void Sample_appbeep(struct _IPDF_JsPlatform* pThis, int nType)
+{
+ MessageBeep(nType);
+ //AfxMessageBox("aaaa");
+}
+
+
+CString userSelFilePath;
+int Sample_fieldBrowse(struct _IPDF_JsPlatform* pThis,void* filePath, int length)
+{
+ if(userSelFilePath.IsEmpty())
+ {
+ CFileDialog fd(FALSE, "fdf");
+ if(fd.DoModal() == IDOK)
+ {
+ userSelFilePath = fd.GetPathName();
+
+ if(filePath == NULL || length == 0)
+ return userSelFilePath.GetLength() + 1;
+ else
+ return 0;
+ }
+ else
+ return 0;
+ }
+ else
+ {
+ int nLen = userSelFilePath.GetLength()+1;
+ if(length > nLen)
+ length = nLen;
+ memcpy(filePath, userSelFilePath.GetBuffer(length), length);
+ userSelFilePath.ReleaseBuffer();
+ userSelFilePath = "";
+ return length;
+ }
+}
+int Sample_docGetFilePath(struct _IPDF_JsPlatform* pThis, void* filePath, int length)
+{
+ if(pThis && pThis->m_pFormfillinfo)
+ {
+ CReaderVCView* pView = (CReaderVCView*)pThis->m_pFormfillinfo;
+ CString csFilePath = pView->GetFilePath();
+
+ int nbufflen = csFilePath.GetLength() + 1;
+ if(filePath == NULL || length == 0)
+ return nbufflen;
+
+ if(length > nbufflen)
+ length = nbufflen;
+ memcpy(filePath, csFilePath.GetBuffer(length), length);
+ csFilePath.ReleaseBuffer();
+
+ return length;
+
+ }
+ return 0;
+}
+
+void Sample_docSubmitForm(struct _IPDF_JsPlatform* pThis,void* formData, int length, FPDF_WIDESTRING URL)
+{
+ if(pThis && pThis->m_pFormfillinfo)
+ {
+ CReaderVCView *pView = (CReaderVCView*)pThis->m_pFormfillinfo;
+ if (pView)
+ {
+ pView->SubmitFormImpl(formData, length, "");
+ }
+ }
+}
+
+void Sample_gotoPage(struct _IPDF_JsPlatform* pThis, int nPageNum)
+{
+ if(pThis && pThis->m_pFormfillinfo)
+ {
+ CReaderVCView *pView = (CReaderVCView*)pThis->m_pFormfillinfo;
+ if (pView)
+ {
+ pView->GotoPage(nPageNum);
+ }
+ }
+}
+
+CReaderVCView::CReaderVCView()
+{
+ // TODO: add construction code here
+ m_pFram = NULL;
+ m_pExportPageDlg = NULL;
+ m_pDoc = NULL;
+ m_pPage = NULL;
+ m_nTotalPage = 0;
+ m_nRotateFlag = 0;
+ m_dbScaleFactor = 1.0f;
+ m_nPageIndex = -1;
+ m_dbPageWidth = 0.0f;
+ m_dbPageHeight = 0.0f;
+ m_nStartX = 0;
+ m_nStartY = 0;
+ m_nActualSizeX = 0;
+ m_nActualSizeY = 0;
+
+ //for search text
+ m_pTextPage = NULL;
+ m_FindInfo.m_strFind = _T("");
+ m_FindInfo.m_nFlag = -1;
+ m_FindInfo.m_nDirection = -1;
+ m_FindInfo.m_nStartPageIndex = -1;
+ m_FindInfo.m_nStartCharIndex = -1;
+ m_FindInfo.m_bFirst = TRUE;
+ m_FindInfo.m_pCurFindBuf = NULL;
+ m_pSCHHandle = NULL;
+
+ m_rtFind = NULL;
+ m_nRectNum = 0;
+
+ //for select text
+ m_bSelect = FALSE;
+ m_bHand = TRUE;
+ m_bSnap = FALSE;
+ m_bHasChar = FALSE;
+
+ m_ptLBDown.x = m_ptLBDown.y = 0;
+ m_ptLBUp.x = m_ptLBUp.y = 0;
+ m_ptOld.x = m_ptOld.y = 0;
+
+ m_nStartIndex = m_nEndIndex = m_nOldIndex = -1;
+ m_rtArray.RemoveAll();
+ m_rtOld.left = m_rtOld.right = m_rtOld.bottom = m_rtOld.top = 0;
+
+ m_nPosH = m_nPosV = -1;
+
+ // for links
+ m_pLink = NULL;
+ m_bBookmark = FALSE;
+
+ m_bmp = NULL;
+ m_pwsResponse = NULL;
+
+ this->FFI_Invalidate = Sample_Invalidate;
+ this->Release= Sample_Release;
+ this->FFI_SetTimer = Sample_SetTimer;
+ this->FFI_KillTimer = Sample_KillTimer;
+ this->FFI_GetLocalTime = Sample_GetLocalTime;
+ this->FFI_SetCursor = Sample_SetCursor;
+ this->FFI_OnChange = Sample_OnChange;
+ this->FFI_GetPage = Sample_GetPage;
+ this->FFI_GetCurrentPage = Sample_GetCurrentPage;
+ this->FFI_GetRotation = Sample_GetRotation;
+ this->FFI_OutputSelectedRect = Sample_OutputSelectedRect;
+ this->FFI_ExecuteNamedAction = Sample_ExecuteNamedAction;
+ this->FFI_OutputSelectedRect = NULL;
+ this->FFI_SetTextFieldFocus = NULL;
+ this->FFI_DoGoToAction = NULL;
+ this->FFI_DoURIAction = NULL;
+ this->FFI_DisplayCaret = Sample_DisplayCaret;
+ this->FFI_GetCurrentPageIndex = Sample_GetCurrentPageIndex;
+ this->FFI_SetCurrentPage = Sample_SetCurrentPage;
+ this->FFI_GotoURL = Sample_GotoURL;
+ this->FFI_GetPageViewRect = Sample_GetPageViewRect;
+ this->FFI_PopupMenu = Sample_PopupMenu;
+ this->FFI_OpenFile = Sample_OpenFile;
+ this->FFI_GetFilePath = Sample_GetFilePath;
+ this->FFI_EmailTo = Sample_EmailTo;
+ this->FFI_UploadTo = Sample_UploadTo;
+ this->FFI_GetPlatform = Sample_GetPlatform;
+ this->FFI_GetDocumentCount = Sample_GetDocumentCount;
+ this->FFI_GetCurDocumentIndex = Sample_GetCurDocumentIndex;
+ this->FFI_DownloadFromURL = Sample_DownloadFromURL;
+ this->FFI_PostRequestURL = Sample_PostRequestURL;
+ this->FFI_PutRequestURL = Sample_PutRequestURL;
+ this->FFI_ShowFileDialog = Sample_ShowFileDialog;
+ this->version = 1;
+
+ this->m_pJsPlatform = NULL;
+ this->m_pJsPlatform = new IPDF_JSPLATFORM;
+ memset(m_pJsPlatform, 0, sizeof(IPDF_JSPLATFORM));
+ this->m_pJsPlatform->app_alert = Sample_appalert;
+ this->m_pJsPlatform->app_response = Sample_appResponse;
+ this->m_pJsPlatform->app_beep = Sample_appbeep;
+ this->m_pJsPlatform->Field_browse =Sample_fieldBrowse;
+ this->m_pJsPlatform->Doc_getFilePath = Sample_docGetFilePath;
+ this->m_pJsPlatform->Doc_submitForm = Sample_docSubmitForm;
+ this->m_pJsPlatform->Doc_gotoPage = Sample_gotoPage;
+ this->m_pJsPlatform->m_pFormfillinfo = this;
+
+ m_pApp = NULL;
+}
+
+
+CReaderVCView::~CReaderVCView()
+{
+
+// FPDF_DestroyApp(m_App);
+
+ if(m_pTextPage != NULL)
+ {
+ FPDFText_ClosePage(m_pTextPage);
+ m_pTextPage = NULL;
+ }
+ if (m_pLink != NULL)
+ {
+ FPDFLink_CloseWebLinks(m_pLink);
+ m_pLink = NULL;
+ }
+
+ POSITION pos = m_pageMap.GetStartPosition();
+ while(pos)
+ {
+ int nIndex = 0;
+ FPDF_PAGE page = NULL;
+ m_pageMap.GetNextAssoc(pos, nIndex, page);
+
+ if (page)
+ {
+ FORM_OnBeforeClosePage(page, m_pApp);
+ FPDF_ClosePage(page);
+ }
+ }
+ m_pPage = NULL;
+
+ if (m_pDoc != NULL)
+ {
+ //Should strictly follow the reverse order of initialization .
+ FORM_DoDocumentAAction(m_pApp, FPDFDOC_AACTION_WC);
+ if(m_pApp)
+ FPDFDOC_ExitFormFillEnviroument(m_pApp);
+ FPDF_CloseDocument(m_pDoc);
+ m_pDoc = NULL;
+ }
+ if (m_FindInfo.m_pCurFindBuf != NULL)
+ {
+ delete []m_FindInfo.m_pCurFindBuf;
+ m_FindInfo.m_pCurFindBuf = NULL;
+ }
+ if (m_rtFind != NULL)
+ {
+ delete m_rtFind;
+ m_rtFind = NULL;
+ }
+ if(m_bmp != NULL)
+ {
+ FPDFBitmap_Destroy(m_bmp);
+ }
+
+ if (m_pwsResponse)
+ {
+ delete m_pwsResponse;
+ m_pwsResponse = NULL;
+ }
+
+ if(this->m_pJsPlatform)
+ delete m_pJsPlatform;
+
+ m_mapTimerFuns.RemoveAll();
+// m_formFiledInfo.Release();
+// }
+// m_rtArray.RemoveAll();
+}
+
+BOOL CReaderVCView::PreCreateWindow(CREATESTRUCT& cs)
+{
+ // TODO: Modify the Window class or styles here by modifying
+ // the CREATESTRUCT cs
+ cs.style |= WS_MAXIMIZE | WS_VISIBLE | WS_VSCROLL |WS_HSCROLL;
+ return CView::PreCreateWindow(cs);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCView drawing
+
+void CReaderVCView::OnDraw(CDC* pDC)
+{
+ CReaderVCDoc* pDoc = GetDocument();
+ ASSERT_VALID(pDoc);
+ // TODO: add draw code for native data here
+ DrawPage(m_nRotateFlag, pDC);
+ DrawAllRect(pDC);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCView printing
+
+BOOL CReaderVCView::OnPreparePrinting(CPrintInfo* pInfo)
+{
+ // default preparation
+ return DoPreparePrinting(pInfo);
+}
+
+void CReaderVCView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+ // TODO: add extra initialization before printing
+}
+
+void CReaderVCView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+ // TODO: add cleanup after printing
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCView diagnostics
+
+#ifdef _DEBUG
+void CReaderVCView::AssertValid() const
+{
+ CView::AssertValid();
+}
+
+void CReaderVCView::Dump(CDumpContext& dc) const
+{
+ CView::Dump(dc);
+}
+
+CReaderVCDoc* CReaderVCView::GetDocument() // non-debug version is inline
+{
+ ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CReaderVCDoc)));
+ return (CReaderVCDoc*)m_pDocument;
+}
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CReaderVCView message handlers
+
+BOOL CReaderVCView::LoadPDFPage(FPDF_DOCUMENT doc, int nIndex, CPoint pos)
+{
+ if(NULL == doc) return FALSE;
+ if(nIndex < 0) nIndex = 0;
+ if(nIndex > m_nTotalPage) nIndex = m_nTotalPage;
+
+ FORM_DoPageAAction(m_pPage, m_pApp, FPDFPAGE_AACTION_CLOSE);
+
+ m_pPage = NULL;
+ m_pageMap.Lookup(nIndex, m_pPage);
+ if(!m_pPage)
+ {
+ m_pPage = FPDF_LoadPage(doc, nIndex);
+ FORM_OnAfterLoadPage(m_pPage, m_pApp);
+ m_pageMap.SetAt(nIndex, m_pPage);
+ }
+ if(NULL == m_pPage) return FALSE;
+
+ FORM_DoPageAAction(m_pPage, m_pApp, FPDFPAGE_AACTION_OPEN);
+
+ m_nPageIndex = nIndex;
+ SetPageMetrics(m_pPage);
+
+ if (m_pTextPage != NULL)
+ {
+ FPDFText_ClosePage(m_pTextPage);
+ m_pTextPage = NULL;
+ }
+ m_pTextPage = FPDFText_LoadPage(m_pPage);
+
+
+ CChildFrame *pParent = (CChildFrame *)this->GetParentFrame();
+ if (pParent != NULL)
+ {
+ pParent->SetActiveView(this);
+ SyncScroll();
+ }
+
+ if(pos.x !=0 && pos.y != 0)
+ {
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(m_nActualSizeX * m_dbScaleFactor),
+ (int)(m_nActualSizeY * m_dbScaleFactor), m_nRotateFlag, pos.x, pos.y, &m_nStartX, &m_nStartY);
+ m_nStartX = -m_nStartX + 20;
+ m_nStartY = -m_nStartY + 20;
+
+ int nSizeX = 0;
+ int nSizeY = 0;
+ if (1 == m_nRotateFlag || 3 == m_nRotateFlag)
+ {
+ nSizeX = m_nActualSizeY;
+ nSizeY = m_nActualSizeX;
+ }
+ else
+ {
+ nSizeX = m_nActualSizeX;
+ nSizeY = m_nActualSizeY;
+ }
+ SCROLLINFO scrinfo;
+ GetScrollInfo(SB_VERT, &scrinfo);
+ scrinfo.nMin = 0;
+ scrinfo.nMax =(int) (nSizeY * m_dbScaleFactor + abs(m_nStartY));
+ SetScrollInfo(SB_VERT, &scrinfo);
+ SetScrollPos(SB_VERT, abs(m_nStartY), TRUE);
+
+ GetScrollInfo(SB_HORZ, &scrinfo);
+ scrinfo.nMin = 0;
+ scrinfo.nMax = (int)(nSizeX * m_dbScaleFactor + abs(m_nStartX));
+ SetScrollInfo(SB_HORZ, &scrinfo);
+ SetScrollPos(SB_HORZ, abs(m_nStartX), TRUE);
+ }
+ this->Invalidate(TRUE);
+// FPDFApp_SetPage(m_App, m_pPage);
+ return TRUE;
+
+}
+
+
+void CReaderVCView::InvalidateImpl(FPDF_PAGE page, double left, double top, double right, double bottom)
+{
+ int device_left, device_top, device_right, device_bottom;
+
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, left, top, &device_left, &device_top);
+
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, right, bottom, &device_right, &device_bottom);
+
+ CRect rc(device_left,device_top, device_right, device_bottom);
+// TRACE("left = %d\r\n", device_left);
+// TRACE("top = %d\r\n", device_top);
+// TRACE("right = %d\r\n", device_right);
+// TRACE("bottom = %d\r\n", device_bottom);
+ if(device_right-device_left>5)
+ TRACE("left=%d,top=%d,right=%d,bottom=%d\r\n",device_left,device_top,device_right,device_bottom);
+ ::InvalidateRect(m_hWnd, rc, FALSE);
+}
+
+void CReaderVCView::SetCaretImpl(FPDF_PAGE page,double page_x, double page_y, int nWidth, int nHeight)
+{
+
+}
+
+void CReaderVCView::ReleaseImpl()
+{
+
+}
+CMap<int, int,TimerCallback, TimerCallback> CReaderVCView::m_mapTimerFuns;
+int CReaderVCView::SetTimerImpl(int uElapse, TimerCallback lpTimerFunc)
+{
+ int nTimeID = ::SetTimer(NULL, 0, uElapse, TimerProc);
+ m_mapTimerFuns.SetAt(nTimeID, lpTimerFunc);
+ return nTimeID;
+}
+
+void CReaderVCView::KillTimerImpl(int nID)
+{
+ ::KillTimer(NULL, nID);
+ m_mapTimerFuns.RemoveKey(nID);
+}
+
+void CReaderVCView::SetCurorImpl(int nCursorType)
+{
+ HCURSOR hcur = LoadCursor(NULL, IDC_UPARROW);
+ switch(nCursorType)
+ {
+ case FXCT_ARROW:
+ case FXCT_NESW:
+ case FXCT_NWSE:
+ case FXCT_VBEAM:
+ case FXCT_HBEAM:
+ case FXCT_HAND:
+ // ::SetCursor(hcur);
+ break;
+ }
+}
+
+void CReaderVCView::PageToDeviceImpl(FPDF_PAGE page,double page_x,double page_y, int* device_x, int* device_y)
+{
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, page_x, page_y,device_x, device_y);
+}
+
+void CReaderVCView::DeviceToPageImpl(FPDF_PAGE page,int device_x, int device_y, double* page_x, double* page_y)
+{
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+ FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, device_x, device_y, page_x, page_y);
+
+}
+
+void CReaderVCView::SetPageMetrics(FPDF_PAGE pPage)
+{
+ m_nStartX = 10;
+ m_nStartY = 10;
+ if(NULL==pPage) return;
+ //get pdf page width an height;
+ m_dbPageWidth = FPDF_GetPageWidth(pPage);
+ m_dbPageHeight = FPDF_GetPageHeight(pPage);
+
+ CDC *pDC = GetDC();
+ int ix, iy;
+ ix = pDC->GetDeviceCaps(LOGPIXELSX);
+ iy = pDC->GetDeviceCaps(LOGPIXELSY);
+ m_nActualSizeX = (int)(m_dbPageWidth / 72 * ix + 0.5f);//convert pdf coordinates to device
+ m_nActualSizeY = (int)(m_dbPageHeight / 72 * iy + 0.5f);//convert pdf coordinates to device
+ ReleaseDC(pDC);
+
+}
+
+void CReaderVCView::SetScalFactor(double dbScal)
+{
+ if(dbScal > 64 ) m_dbScaleFactor = 64;
+ if( dbScal < 0) m_dbScaleFactor = 0.08f;
+ m_dbScaleFactor = dbScal;
+}
+void CReaderVCView::DrawPage(int nRotate, CDC *pDC)
+{
+ int nSizeX = m_nActualSizeX;
+ int nSizeY = m_nActualSizeY;
+
+ if (1 == nRotate || 3 == nRotate)
+ {
+ int temp = nSizeX;
+ nSizeX = nSizeY;
+ nSizeY = temp;
+ }
+
+ int nShowSizeX = (int)(nSizeX * m_dbScaleFactor + m_nStartX);
+ int nShowSizeY = (int)(nSizeY * m_dbScaleFactor + m_nStartY);
+
+
+ CRect rc;
+ pDC->GetClipBox(&rc);
+ FPDF_BITMAP bmptemp = FPDFBitmap_Create(rc.Width(), rc.Height(), 0);
+ int nClientWidth = FPDFBitmap_GetWidth(bmptemp);
+ int nClientHeight = FPDFBitmap_GetHeight(bmptemp);
+
+
+ FPDFBitmap_FillRect(bmptemp, 0, 0, nClientWidth, nClientHeight, 255,255,255, 0);
+ FPDF_RenderPageBitmap(bmptemp, m_pPage, m_nStartX-rc.left, m_nStartY-rc.top, (int)(nSizeX * m_dbScaleFactor), (int)(nSizeY * m_dbScaleFactor), nRotate,
+ FPDF_LCD_TEXT | FPDF_NO_NATIVETEXT);
+ FPDF_FFLDraw(m_pApp, bmptemp, m_pPage, m_nStartX-rc.left, m_nStartY-rc.top, (int)(nSizeX * m_dbScaleFactor), (int)(nSizeY * m_dbScaleFactor), nRotate,
+ FPDF_ANNOT | FPDF_LCD_TEXT | FPDF_NO_NATIVETEXT);
+
+ // m_pPage2 = FPDF_LoadPage(m_pDoc, 2);
+ // FPDF_RenderPageBitmap(m_bmp, m_pPage2, m_nStartX+500, m_nStartY, (int)(nSizeX * m_dbScaleFactor), (int)(nSizeY * m_dbScaleFactor), nRotate,
+ // FPDF_LCD_TEXT | FPDF_NO_NATIVETEXT);
+ // FPDF_FFLDraw(m_pApp, m_bmp, m_pPage2, m_nStartX+500, m_nStartY, (int)(nSizeX * m_dbScaleFactor), (int)(nSizeY * m_dbScaleFactor), nRotate,
+ // FPDF_ANNOT | FPDF_LCD_TEXT | FPDF_NO_NATIVETEXT);
+
+ int t = FPDFBitmap_GetStride(bmptemp);
+ int bufsize=FPDFBitmap_GetStride(bmptemp)*nClientHeight;
+ void* bmpbuf=FPDFBitmap_GetBuffer(bmptemp);
+ CDC MemDC;
+
+ CBitmap winbmp;
+ MemDC.CreateCompatibleDC(pDC);
+ if((HBITMAP)winbmp != NULL)
+ winbmp.DeleteObject();
+ if(HBITMAP(winbmp) == NULL)
+ {
+ winbmp.CreateCompatibleBitmap(pDC,nClientWidth,nClientHeight);
+ winbmp.SetBitmapBits(bufsize,bmpbuf);
+ }
+
+ MemDC.SelectObject(&winbmp);
+
+ pDC->BitBlt(rc.left , rc.top , nClientWidth, nClientHeight, &MemDC,0,0,SRCCOPY);
+ MemDC.DeleteDC();
+
+ FPDFBitmap_Destroy(bmptemp);
+
+
+ int size = m_SelectArray.GetSize();
+ for(int i=0; i<size; i++)
+ {
+
+
+ CRect rc = m_SelectArray.GetAt(i);
+
+ CDC memdc;
+ CBitmap bmp,*pOldBitmap;
+ memdc.CreateCompatibleDC(pDC);
+
+ bmp.CreateCompatibleBitmap(pDC,rc.Width(),rc.Height());
+
+ pOldBitmap = memdc.SelectObject(&bmp);
+
+ memdc.FillSolidRect(0,0,rc.Width(),rc.Height(),RGB(0,100,160));
+
+ BLENDFUNCTION bf;
+
+ bf.BlendOp = AC_SRC_OVER;
+
+ bf.BlendFlags = 0;
+
+ bf.SourceConstantAlpha = 0x4f;
+
+ bf.AlphaFormat = 0;
+
+
+
+ BOOL ret=AlphaBlend(pDC->GetSafeHdc(),rc.left,rc.top,rc.Width(),rc.Height(),memdc.GetSafeHdc(),0,0,rc.Width(),rc.Height(),bf);
+
+ memdc.SelectObject(pOldBitmap);
+ memdc.DeleteDC();
+ bmp.DeleteObject();
+
+ }
+ m_SelectArray.RemoveAll();
+
+
+
+
+}
+
+void CReaderVCView::GetNewPageSize(int &nsizeX, int &nsizeY)
+{
+ int nSizeX = m_nActualSizeX;
+ int nSizeY = m_nActualSizeY;
+ if (1 == m_nRotateFlag || 3 == m_nRotateFlag)
+ {
+ int temp = nSizeX;
+ nSizeX = nSizeY;
+ nSizeY = temp;
+ }
+ nsizeX = (int)(nSizeX*m_dbScaleFactor);
+ nsizeY = (int)(nSizeY*m_dbScaleFactor);
+}
+
+void CReaderVCView::OnDocFirstpage()
+{
+
+ if(m_nPageIndex == 0) return;
+ this->m_nPageIndex = 0;
+ this->LoadPDFPage(m_pDoc, 0);
+ DeleteAllRect();
+}
+
+void CReaderVCView::OnDocGotopage()
+{
+ CGotoPageDlg dlg;
+ dlg.DoModal();
+}
+
+void CReaderVCView::OnDocLastpage()
+{
+// FPDF_DOCUMENT doc = FPDF_LoadDocument("d:\\a1.pdf", "");
+// FPDF_PAGE page = FPDF_LoadPage(doc, 0);
+// FPDF_IMAGEOBJECT imgObject = FPDFPageObj_NewImgeObj(doc);
+// long ret = FPDFImageObj_LoadFromFileEx(&page, 1 ,
+// imgObject, "E:\\temp\\temp\\k.gif",TRUE
+// );
+// FPDFImageObj_SetMatrix(imgObject, 240, 0, 0, 160, 1*50, 0 );
+// FPDFPage_InsertObject(page, imgObject);
+// FPDFPage_GenerateContent(page);
+// FPDF_SaveAsFile(doc, "D:\\out.pdf", 0, NULL, 0, NULL, 0);
+// FPDF_ClosePage(page);
+// FPDF_CloseDocument(doc);
+// return;
+
+
+ if(m_nPageIndex == m_nTotalPage -1) return;
+ this->m_nPageIndex = m_nTotalPage -1;
+ LoadPDFPage(m_pDoc, m_nPageIndex);
+ DeleteAllRect();
+}
+
+void CReaderVCView::OnDocNextpage()
+{
+ m_nPageIndex ++ ;
+ m_nPageIndex %= m_nTotalPage;
+ LoadPDFPage(m_pDoc, m_nPageIndex);
+ DeleteAllRect();
+}
+
+void CReaderVCView::OnDocPrepage()
+{
+ m_nPageIndex --;
+ if(m_nPageIndex < 0) m_nPageIndex = m_nTotalPage-1;
+ LoadPDFPage(m_pDoc, m_nPageIndex);
+ DeleteAllRect();
+}
+
+void CReaderVCView::OnClockwise()
+{
+ m_nRotateFlag ++;
+ m_nRotateFlag %= 4;
+ LoadPDFPage(m_pDoc, m_nPageIndex);
+}
+
+void CReaderVCView::OnCounterclockwise()
+{
+ m_nRotateFlag --;
+ if (m_nRotateFlag < 0) m_nRotateFlag = 3;
+ LoadPDFPage(m_pDoc, m_nPageIndex);
+}
+
+BOOL CReaderVCView::SetPDFDocument(FPDF_DOCUMENT pDoc, int nPageNum)
+{
+ if(pDoc == NULL) return FALSE;
+
+ m_pApp = FPDFDOC_InitFormFillEnviroument(pDoc,this);
+ FPDF_LoadXFA(pDoc);
+
+ FORM_DoDocumentJSAction(m_pApp);
+ FORM_DoDocumentOpenAction(m_pApp);
+// FORM_OnAfterLoadDocument(m_pApp);
+ FPDF_SetFormFieldHighlightColor(m_pApp, 0, RGB(0,255, 0));
+ FPDF_SetFormFieldHighlightAlpha(m_pApp, 128);
+
+
+ m_pDoc = pDoc;
+ m_nTotalPage = nPageNum;
+ if(!LoadPDFPage(m_pDoc, 0)) return FALSE;
+
+ return TRUE;
+}
+
+void CReaderVCView::GotoPage(int index)
+{
+ if(index < 0 || index >= m_nTotalPage){MessageBoxA("Invalidate index");}
+ if(index == m_nPageIndex) return;
+ if(!LoadPDFPage(m_pDoc, index)) return;
+ DeleteAllRect();
+}
+
+void CReaderVCView::OnViewActualSize()
+{
+ m_nStartX = m_nStartY = 10;
+ ScalPage(1.0f);
+}
+
+void CReaderVCView::OnViewFitPage()
+{
+ m_nStartX = m_nStartY = 10;
+ CRect rect;
+ GetClientRect(rect);
+ double dbHeight = rect.Height();
+ double dbScal = dbHeight / m_nActualSizeY;
+ ScalPage(dbScal);
+}
+
+void CReaderVCView::OnViewFitWidth()
+{
+ m_nStartX = m_nStartY = 10;
+ CRect rect;
+ GetClientRect(rect);
+ double dbWidth= rect.Width();
+ double dbScal = dbWidth / m_nActualSizeX;
+ ScalPage(dbScal);
+}
+
+void CReaderVCView::OnViewZoomIn()
+{
+ double dbScal = m_dbScaleFactor;
+ dbScal += 0.25f;
+ if(dbScal > 6400.0f) return;
+ ScalPage(dbScal);
+
+}
+
+void CReaderVCView::OnViewZoomOut()
+{
+ double dbScal = m_dbScaleFactor;
+ dbScal -= 0.25f;
+ if(dbScal < 0.25f) return;
+ ScalPage(dbScal);
+}
+
+void CReaderVCView::OnViewZoomTo()
+{
+ CZoomDlg dlg;
+ dlg.DoModal();
+}
+
+void CReaderVCView::ScalPage(double dbScal)
+{
+ SetScalFactor(dbScal);
+ CChildFrame *pParent = (CChildFrame *)this->GetParentFrame();
+ if (pParent != NULL)
+ {
+ pParent->SetActiveView(this);
+ SyncScroll();
+ }
+ Invalidate(TRUE);
+}
+
+void CReaderVCView::OnEditFind()
+{
+ if(m_pTextPage == NULL)
+ {
+ AfxMessageBox("Sorry, the fpdftext.dll may has expired. For keeping on using the dll, please contact sales@foxitsoftware.com.");
+ return;
+ }
+ CFindDlg dlg;
+ dlg.DoModal();
+}
+
+void CReaderVCView::FindText(CString strFind, BOOL bCase, BOOL bWholeword, int Direction)
+{
+ CString str;
+ str = m_FindInfo.m_strFind;
+ int nFlag = 0;
+ if(bCase) { nFlag |= FPDF_MATCHCASE; }
+ if(bWholeword) { nFlag |= FPDF_MATCHWHOLEWORD; }
+
+ if(NULL == m_pTextPage) return;
+
+ if (strFind.Compare(str) != 0 || nFlag != m_FindInfo.m_nFlag)//new search
+ {
+ if (NULL == m_pTextPage) return;
+ if (NULL != m_pSCHHandle)
+ {
+ FPDFText_FindClose(m_pSCHHandle);
+ m_pSCHHandle = NULL;
+ }
+
+ int len = MultiByteToWideChar(CP_ACP, 0, strFind.GetBuffer(0), -1, NULL, NULL);
+ wchar_t *pBuf = new wchar_t[len];
+ memset(pBuf, 0, len*sizeof(wchar_t));
+ MultiByteToWideChar(CP_ACP, 0, strFind.GetBuffer(0), strFind.GetLength(), pBuf, len);
+ pBuf[len-1] = L'\0';
+ m_pSCHHandle = FPDFText_FindStart(m_pTextPage, (FPDF_WIDESTRING)pBuf, nFlag, 0);
+ if(NULL == m_pSCHHandle) return;
+
+ if (m_FindInfo.m_pCurFindBuf != NULL)
+ {
+ delete []m_FindInfo.m_pCurFindBuf;
+ m_FindInfo.m_pCurFindBuf = NULL;
+ }
+ m_FindInfo.m_pCurFindBuf = new wchar_t[len];
+ memset(m_FindInfo.m_pCurFindBuf, 0, len*sizeof(wchar_t));
+ memcpy(m_FindInfo.m_pCurFindBuf, pBuf, len*sizeof(wchar_t));
+
+ delete []pBuf;
+
+
+ //save the find info
+ m_FindInfo.m_strFind = strFind;
+ m_FindInfo.m_nFlag = nFlag;
+ m_FindInfo.m_nDirection = Direction;
+ m_FindInfo.m_nStartPageIndex = m_nPageIndex;
+ m_FindInfo.m_bFirst = TRUE;
+
+
+ }
+ FindNext(Direction);
+}
+
+void CReaderVCView::FindNext(int nDirection)
+{
+ if(NULL == m_pSCHHandle) return;
+ BOOL bResult = FALSE;
+
+ if (nDirection != m_FindInfo.m_nDirection)
+ {
+ m_FindInfo.m_nDirection = nDirection;
+ m_FindInfo.m_bFirst = TRUE;
+ }
+
+ if (0 == nDirection)// find down
+ {
+ bResult = FPDFText_FindNext(m_pSCHHandle);
+ }
+ if (1 == nDirection)
+ {
+ bResult = FPDFText_FindPrev(m_pSCHHandle);
+ }
+
+ while(!bResult){
+
+ if (m_rtFind != NULL)
+ {
+ delete [] m_rtFind;
+ m_rtFind = NULL;
+ }
+
+ if (0 == nDirection)
+ {
+ m_nPageIndex ++;
+ m_nPageIndex %= m_nTotalPage;
+ if(!LoadPDFPage(m_pDoc, m_nPageIndex)) return;
+ if (NULL == m_pTextPage) return;
+ if (NULL != m_pSCHHandle)
+ {
+ FPDFText_FindClose(m_pSCHHandle);
+ m_pSCHHandle = NULL;
+ }
+ m_pSCHHandle = FPDFText_FindStart(m_pTextPage, (FPDF_WIDESTRING)m_FindInfo.m_pCurFindBuf, m_FindInfo.m_nFlag, 0);
+ if(NULL == m_pSCHHandle) break;
+ bResult = FPDFText_FindNext(m_pSCHHandle);
+ if(!bResult && m_nPageIndex == m_FindInfo.m_nStartPageIndex) break;
+ }
+ else
+ {
+ m_nPageIndex --;
+ if (m_nPageIndex < 0) {m_nPageIndex = m_nTotalPage - 1;}
+ if(!LoadPDFPage(m_pDoc, m_nPageIndex)) return;
+ if (NULL == m_pTextPage) return;
+ if (NULL != m_pSCHHandle)
+ {
+ FPDFText_FindClose(m_pSCHHandle);
+ m_pSCHHandle = NULL;
+ }
+ m_pSCHHandle = FPDFText_FindStart(m_pTextPage, (FPDF_WIDESTRING)m_FindInfo.m_pCurFindBuf, m_FindInfo.m_nFlag, 0);
+ if(NULL == m_pSCHHandle) break;
+ bResult = FPDFText_FindPrev(m_pSCHHandle);
+ if(!bResult && m_nPageIndex == m_FindInfo.m_nStartPageIndex) break;
+ }
+ }//end while
+
+ if(!bResult)//find over
+ {
+ FPDFText_FindClose(m_pSCHHandle);
+ m_pSCHHandle = NULL;
+
+ if (m_rtFind != NULL)
+ {
+ delete [] m_rtFind;
+ m_rtFind = NULL;
+ }
+
+ m_FindInfo.m_bFirst = TRUE;
+ m_FindInfo.m_nDirection = -1;
+ m_FindInfo.m_nFlag = -1;
+ m_FindInfo.m_nStartCharIndex = -1;
+ m_FindInfo.m_nStartPageIndex = -1;
+ m_FindInfo.m_pCurFindBuf = NULL;
+ m_FindInfo.m_strFind = _T("");
+
+ MessageBox("Find complete!", "Find Infomation", MB_OK | MB_ICONINFORMATION);
+ return;
+ }
+
+
+
+ int index = FPDFText_GetSchResultIndex(m_pSCHHandle);
+ if (m_nPageIndex == m_FindInfo.m_nStartPageIndex && index == m_FindInfo.m_nStartCharIndex && !m_FindInfo.m_bFirst )
+ {
+ if (NULL != m_pSCHHandle)
+ {
+ FPDFText_FindClose(m_pSCHHandle);
+ m_pSCHHandle = NULL;
+ }
+ MessageBox("Find complete!", "Find Infomation", MB_OK | MB_ICONINFORMATION);
+ return;
+ }else{
+ CDC *pDC = GetDC();
+ DrawAllRect(pDC);//update
+
+ int nCount = FPDFText_GetSchCount(m_pSCHHandle);
+ int nRects = FPDFText_CountRects(m_pTextPage, index, nCount);
+ if (m_rtFind != NULL)
+ {
+ delete [] m_rtFind;
+ m_rtFind = NULL;
+ }
+ m_rtFind = new PDFRect[nRects];
+ m_nRectNum = nRects;
+ for (int i=0; i<nRects; i++)
+ {
+ double left, top, right, bottom;
+ FPDFText_GetRect(m_pTextPage, i, &left, &top, &right, &bottom);
+ m_rtFind[i].m_dbLeft = left;
+ m_rtFind[i].m_dbTop = top;
+ m_rtFind[i].m_dbRight = right;
+ m_rtFind[i].m_dbBottom = bottom;
+ }
+ DrawAllRect(pDC);//draw new rect
+ ReleaseDC(pDC);
+ }
+
+ if (m_FindInfo.m_bFirst)
+ {//find first string, store info;
+ m_FindInfo.m_bFirst = FALSE;
+ m_FindInfo.m_nStartCharIndex = index;
+ m_FindInfo.m_nStartPageIndex = m_nPageIndex;
+ }
+
+}
+
+void CReaderVCView::DrawReverse(CDC *pDC, CRect rect)
+{
+ CRect rt = rect;
+ rect.left = __min(rt.left, rt.right);
+ rect.right = __max(rt.left, rt.right);
+ rect.top = __min(rt.top, rt.bottom);
+ rect.bottom = __max(rt.top, rt.bottom);
+
+ ASSERT(pDC);
+ int bmp_width=abs(rect.Width());
+ int bmp_height=abs(rect.Height());
+ HBITMAP hbmp = CreateCompatibleBitmap(pDC->m_hDC, bmp_width, bmp_height);
+ CDC MemDC;
+ MemDC.CreateCompatibleDC(pDC);
+ HBITMAP holdbmp = (HBITMAP)MemDC.SelectObject(hbmp);
+ // copy screen DC to memory DC
+ BitBlt(MemDC, 0, 0, bmp_width, bmp_height, pDC->m_hDC, rect.left,rect.top, SRCCOPY);
+ MemDC.SelectObject(holdbmp);
+
+ BITMAPINFO bmi;
+ memset(&bmi, 0, sizeof bmi);
+ bmi.bmiHeader.biSize = sizeof bmi.bmiHeader;
+ bmi.bmiHeader.biBitCount = 24;
+ bmi.bmiHeader.biClrImportant = 0;
+ bmi.bmiHeader.biClrUsed = 0;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.bmiHeader.biHeight = bmp_height;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biSizeImage = 0;
+ bmi.bmiHeader.biWidth = bmp_width;
+ bmi.bmiHeader.biXPelsPerMeter = 0;
+ bmi.bmiHeader.biYPelsPerMeter = 0;
+
+ // get bitmap stream
+ int ret = GetDIBits(MemDC, hbmp, 0,bmp_height, NULL, &bmi, DIB_RGB_COLORS);
+
+ int size = bmi.bmiHeader.biSizeImage;
+
+ BYTE* pBits = new BYTE[size];
+ memset(pBits, 0, size);
+ ret = GetDIBits(MemDC, hbmp, 0,bmp_height, pBits, &bmi, DIB_RGB_COLORS);
+ ret = GetLastError();
+ DeleteObject(hbmp);
+ MemDC.DeleteDC();
+ for (int row = 0; row < bmp_height; row ++) {
+ int pitch = (bmp_width * 3 + 3) / 4 * 4;
+ int rowpos = row * pitch;
+ for(int col = 0; col < bmp_width; col ++){
+ int i = rowpos + col * 3;
+ pBits[i] = 255-pBits[i] ;
+ pBits[i + 1] = 255-pBits[i + 1];
+ pBits[i + 2] = 255-pBits[i + 2];
+ }
+ }
+ ret = SetDIBitsToDevice(pDC->m_hDC,rect.left,rect.top,bmp_width, bmp_height,0, 0, 0, bmp_height, pBits, &bmi, DIB_RGB_COLORS);
+ delete []pBits;
+
+}
+
+void CReaderVCView::DrawAllRect(CDC *pDC)
+{
+ int i;
+ int left, top, right, bottom;
+
+ int nSizeX = 0;
+ int nSizeY = 0;
+// int temp = 0;
+ if (1 == m_nRotateFlag || 3 == m_nRotateFlag)
+ {
+ nSizeX = m_nActualSizeY;
+ nSizeY = m_nActualSizeX;
+ }
+ else
+ {
+ nSizeX = m_nActualSizeX;
+ nSizeY = m_nActualSizeY;
+ }
+ ASSERT(pDC);
+ if (m_rtFind != NULL)
+ {
+ for (i=0; i<m_nRectNum; i++)
+ {
+
+ PDFRect rect = m_rtFind[i];
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nSizeX * m_dbScaleFactor),
+ (int)(nSizeY * m_dbScaleFactor), m_nRotateFlag, rect.m_dbLeft, rect.m_dbTop, &left, &top);
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nSizeX * m_dbScaleFactor),
+ (int)(nSizeY * m_dbScaleFactor), m_nRotateFlag, rect.m_dbRight, rect.m_dbBottom, &right, &bottom);
+ CRect rt(left, top, right, bottom);
+ DrawReverse(pDC, rt);
+
+ }
+ }
+
+ if (m_rtArray.GetSize() != 0)
+ {
+ for (i=0; i<m_rtArray.GetSize(); i++)
+ {
+ PDFRect rect = m_rtArray.GetAt(i);
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nSizeX * m_dbScaleFactor),
+ (int)(nSizeY * m_dbScaleFactor), m_nRotateFlag, rect.m_dbLeft, rect.m_dbTop, &left, &top);
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nSizeX * m_dbScaleFactor),
+ (int)(nSizeY * m_dbScaleFactor), m_nRotateFlag, rect.m_dbRight, rect.m_dbBottom, &right, &bottom);
+ CRect rt(left, top, right, bottom);
+ DrawReverse(pDC, rt);
+ }
+ }
+}
+
+void CReaderVCView::DeleteAllRect()
+{
+ CDC *pDC = GetDC();
+ DrawAllRect(pDC);
+ ReleaseDC(pDC);
+
+ if (m_rtFind != NULL)
+ {
+ delete []m_rtFind;
+ m_rtFind = NULL;
+ }
+
+ if (m_rtArray.GetSize() != 0)
+ {
+ m_rtArray.RemoveAll();
+ }
+}
+
+void CReaderVCView::OnFilePrint()
+{
+ CString strDoc = GetDocument()->GetTitle();
+ CPrintDialog dlg(FALSE, PD_PAGENUMS | PD_USEDEVMODECOPIES);
+ dlg.m_pd.nMinPage = dlg.m_pd.nFromPage =1;
+ dlg.m_pd.nMaxPage = dlg.m_pd.nToPage = m_nTotalPage;
+ if (dlg.DoModal() == IDOK)
+ {
+ int from_page, to_page;
+ if (dlg.PrintAll())
+ {
+ from_page = dlg.m_pd.nMinPage;
+ to_page = dlg.m_pd.nMaxPage;
+ }
+ else if (dlg.PrintRange())
+ {
+ from_page = dlg.GetFromPage();
+ to_page = dlg.GetToPage();
+ }
+ else if (dlg.PrintSelection())
+ {
+ from_page = to_page = m_nPageIndex + 1;
+ }
+
+ HDC printDC;
+ DOCINFO docInfo;
+
+ printDC = dlg.CreatePrinterDC();
+ if(NULL == printDC) return;
+ docInfo.cbSize = sizeof(DOCINFO);
+ docInfo.fwType = 0;
+ docInfo.lpszDatatype = NULL;
+ docInfo.lpszOutput = NULL;
+ docInfo.lpszDocName = strDoc;
+
+ if(StartDoc(printDC, &docInfo) <= 0) return;
+ //FPDF_DOCUMENT pDoc = NULL;
+ FPDF_PAGE pPage = NULL;
+ CString str;
+ for (int i=from_page-1; i<to_page; i++)
+ {
+ if(pPage != NULL)
+ {
+ FPDF_ClosePage(pPage);
+ pPage = NULL;
+ }
+ pPage = FPDF_LoadPage(m_pDoc, i);
+ double npagewidth = FPDF_GetPageWidth(m_pPage);
+ double npageheight = FPDF_GetPageHeight(m_pPage);
+
+ int logpixelsx,logpixelsy;
+ //calculate the page size
+ logpixelsx = GetDeviceCaps(printDC,LOGPIXELSX);
+ logpixelsy = GetDeviceCaps(printDC,LOGPIXELSY);
+ int nsizeX = (int)(npagewidth / 72 *logpixelsx + 0.5f);
+ int nsizeY = (int)(npageheight / 72 *logpixelsy + 0.5f);
+
+ if(StartPage(printDC) <= 0)
+ {
+ str.Format("one error occured when start the page %d", i);
+ MessageBox(str);
+ return;
+ }
+
+ //render to print device
+ FPDF_RenderPage(printDC, pPage, m_nStartX, m_nStartY, nsizeX, nsizeY, m_nRotateFlag, 0);
+
+ if(EndPage(printDC) <= 0)
+ {
+ str.Format("one error occured when close the page %d", i);
+ MessageBox(str);
+ return;
+ }
+
+ }//end for
+ EndDoc(printDC);
+ if(!DeleteDC(printDC))// delete printDC
+ MessageBox("can not delete the printer");
+ }
+}
+
+void CReaderVCView::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ // TODO: Add your message handler code here and/or call default
+
+ double page_x = 0;
+ double page_y = 0;
+ DeviceToPage(point, page_x, page_y);
+
+ if(m_pApp)
+ {
+ FPDF_BOOL b= FORM_OnLButtonDown(m_pApp, m_pPage,ComposeFlag(),page_x, page_y);
+ if(b)
+ return;
+ }
+ DeleteAllRect();
+ LoadMyCursor(1);
+ m_ptLBDown = point;
+
+
+ if (m_bSelect)
+ {
+ m_bHasChar = GetCharIndexByPoint(point, m_nStartIndex);
+ CreateCaret(point);
+ }
+ if (m_bHand)
+ {
+ m_nPosH = GetScrollPos(SB_HORZ);//SetScrollPos(SB_VERT, point.y, TRUE);
+ m_nPosV = GetScrollPos(SB_VERT);
+ }
+ CView::OnLButtonDown(nFlags, point);
+}
+
+void CReaderVCView::OnLButtonUp(UINT nFlags, CPoint point)
+{
+
+ // TODO: Add your message handler code here and/or call default
+ double page_x = 0;
+ double page_y = 0;
+ DeviceToPage(point, page_x, page_y);
+
+ if(m_pApp)
+ {
+ if(FORM_OnLButtonUp(m_pApp, m_pPage,ComposeFlag(), page_x, page_y))
+ return;
+ }
+ LoadMyCursor();
+ m_ptLBUp = point;
+ if (m_bSelect || m_bSnap)
+ {
+ CDC *pDC = GetDC();
+ CPen *pOldPen;
+ CPen pen;
+ CBrush *pOldBr;
+ CRect rect;
+ pen.CreatePen(PS_DASH, 2, RGB(255,0,0));
+ pOldPen = pDC->SelectObject(&pen);
+ pOldBr = (CBrush*) (pDC->SelectStockObject(NULL_BRUSH));
+ int nOldRop = pDC->SetROP2(R2_XORPEN);
+ pDC->Rectangle(m_rtOld);
+ pDC->SetROP2(nOldRop);
+ m_rtOld.left = m_rtOld.top = m_rtOld.right = m_rtOld.bottom = 0;
+ ReleaseDC(pDC);
+ }
+
+ if (m_bSnap)
+ {
+ BOOL open = OpenClipboard();
+ if (open)
+ {
+ ::EmptyClipboard();
+ int bmpWidth = abs(point.x - m_ptLBDown.x);
+ int bmpHeight = abs(point.y - m_ptLBDown.y);
+ if (bmpHeight == 0 || bmpWidth == 0)return;
+ CRect bmpRect(m_ptLBDown, point);
+ CClientDC dc(this);
+ CBitmap *pBitmap = new CBitmap();
+ pBitmap->CreateCompatibleBitmap(&dc,bmpWidth,bmpHeight);
+ CDC memDC;
+ memDC.CreateCompatibleDC(&dc);
+ memDC.SelectObject(pBitmap);
+ CBrush whiteBrush(RGB(255,255,255));
+ //memDC.FillRect(bmpRect,&whiteBrush);
+ memDC.BitBlt(0, 0, bmpRect.Width(), bmpRect.Height(),&dc, bmpRect.left, bmpRect.top,SRCCOPY);
+ HBITMAP hBitmap = (HBITMAP) *pBitmap;
+ :: SetClipboardData(CF_BITMAP, hBitmap);
+ ::CloseClipboard();
+ MessageBox("The selected area has been copied to clipboard!");
+ delete pBitmap;
+ }
+ }
+
+ FPDF_LINK hlink=NULL;
+ double pdfx,pdfy;
+
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+
+ FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor),m_nRotateFlag,point.x,point.y,&pdfx,&pdfy);
+ hlink=FPDFLink_GetLinkAtPoint(m_pPage,pdfx,pdfy);
+ if (hlink)
+ {
+ FPDF_ACTION haction=NULL;
+ FPDF_DEST hLinkDest=NULL;
+ haction=FPDFLink_GetAction(hlink);
+ hLinkDest=FPDFLink_GetDest(m_pDoc,hlink);
+ if (haction)
+ {
+ int nActionType=FPDFAction_GetType(haction);
+ switch(nActionType)
+ {
+ case PDFACTION_UNSUPPORTED: // Unsupported action type
+ break;
+ case PDFACTION_GOTO: // Go to a destination within current document
+ {
+ FPDF_LINK hActLinkDest = FPDFAction_GetDest(m_pDoc,haction);
+ if (hActLinkDest)
+ {
+ int nPageIndex=FPDFDest_GetPageIndex(m_pDoc,hActLinkDest);
+ GotoPage(nPageIndex);
+ }
+ }
+ break;
+ case PDFACTION_REMOTEGOTO: // Go to a destination within another document
+
+ // FPDFAction_GetFilePath(...);
+ // .....
+ break;
+ case PDFACTION_URI: // Universal Resource Identifier, including web pages and
+ // other Internet based resources
+ // int nsize= FPDFAction_GetURIPath(m_pDoc,haction);
+ // ...
+ break;
+ case PDFACTION_LAUNCH: // Launch an application or open a file
+ // FPDFAction_GetFilePath(...)
+ break;
+ default :
+ break;
+ }
+ }
+ else if (hLinkDest)
+ {
+ int nPageIndex=FPDFDest_GetPageIndex(m_pDoc,hLinkDest);
+ GotoPage(nPageIndex);
+ }
+ }
+ CView::OnLButtonUp(nFlags, point);
+}
+
+void CReaderVCView::OnMouseMove(UINT nFlags, CPoint point)
+{
+ // TODO: Add your message handler code here and/or call default
+ double page_x = 0;
+ double page_y = 0;
+ DeviceToPage(point, page_x, page_y);
+
+ if(m_pApp)
+ {
+ if(FORM_OnMouseMove(m_pApp, m_pPage,ComposeFlag(), page_x, page_y))
+ return;
+ }
+ if (nFlags == MK_LBUTTON)
+ {
+ LoadMyCursor(1);
+ }else{LoadMyCursor();}
+
+ CDC *pDC = GetDC();
+
+ if (m_bSelect && nFlags == MK_LBUTTON)
+ {
+ if (m_bHasChar)
+ {
+ if (m_ptOld.x == 0 && m_ptOld.y == 0){m_ptOld = m_ptLBDown;}
+
+ int nIndex = 0;
+ if (!GetCharIndexByPoint(point, nIndex)) return;
+ if(nIndex == m_nEndIndex) return;
+
+ DrawAllRect(pDC);//update all rect
+
+ m_nEndIndex = nIndex;
+ GetRects(m_nStartIndex, m_nEndIndex); //get the rect and store into m_rtArray
+ DrawAllRect(pDC);//draw new rect
+ }
+ else
+ {
+ CPen *pOldPen;
+ CPen pen;
+ CBrush *pOldBr;
+ CRect rect;
+ pen.CreatePen(PS_DASH, 2, RGB(255,0,0));
+ pOldPen = pDC->SelectObject(&pen);
+ pOldBr = (CBrush*) (pDC->SelectStockObject(NULL_BRUSH));
+ int nOldRop = pDC->SetROP2(R2_XORPEN);
+ int nModle = pDC->Rectangle(m_rtOld);
+
+
+ DrawAllRect(pDC);//update all rect
+ rect = SelectSegment(m_ptLBDown, point);
+ DrawAllRect(pDC);
+
+ pDC->Rectangle(rect);
+ pDC->SelectObject(pOldBr);
+ pDC->SelectObject(pOldPen);
+ pDC->SetROP2(nModle);
+ m_rtOld = rect;
+ }
+ }
+
+ if (m_bHand && nFlags == MK_LBUTTON)
+ {
+ int curPos, prevPos;
+ //CChildFrame *pFrame = (CChildFrame *) GetParentFrame();
+
+ int dy = m_ptLBDown.y - point.y;
+ prevPos = m_nPosV;
+ curPos = prevPos + dy;
+ prevPos = SetScrollPos(SB_VERT, curPos, TRUE);
+ curPos = GetScrollPos(SB_VERT);
+ int distance;
+ distance = prevPos - curPos;
+ m_nStartY += distance;
+ ScrollWindow(0, distance);
+
+ dy = m_ptLBDown.x - point.x;
+ prevPos = m_nPosH;
+ curPos = prevPos + dy;
+ prevPos = SetScrollPos(SB_HORZ, curPos, TRUE);
+ curPos = GetScrollPos(SB_HORZ);
+ distance = prevPos - curPos;
+ m_nStartX += distance;
+ ScrollWindow(distance, 0);
+
+ }
+ if (m_bSnap && nFlags == MK_LBUTTON)
+ {
+ CPen *pOldPen;
+ CPen pen;
+ CBrush *pOldBr;
+ CRect rect(m_ptLBDown, point);
+ pen.CreatePen(PS_DASH, 2, RGB(255,0,0));
+ pOldPen = pDC->SelectObject(&pen);
+ pOldBr = (CBrush*) (pDC->SelectStockObject(NULL_BRUSH));
+ int nOldRop = pDC->SetROP2(R2_XORPEN);
+ int nModle = pDC->Rectangle(m_rtOld);
+
+ pDC->Rectangle(rect);
+ pDC->SelectObject(pOldBr);
+ pDC->SelectObject(pOldPen);
+ pDC->SetROP2(nModle);
+ m_rtOld = rect;
+
+ }
+
+ FPDF_LINK hlink=NULL;
+ double pdfx,pdfy;
+
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+
+ FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor),m_nRotateFlag,point.x,point.y,&pdfx,&pdfy);
+ hlink=FPDFLink_GetLinkAtPoint(m_pPage,pdfx,pdfy);
+ if (hlink)
+ {
+ HCURSOR hCur = AfxGetApp()->LoadCursor(IDC_CURSOR4);
+ ::SetCursor(hCur);
+ }
+ ReleaseDC(pDC);
+//
+ CView::OnMouseMove(nFlags, point);
+}
+
+void CReaderVCView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ // TODO: Add your message handler code here and/or call default
+// double page_x = 0;
+// double page_y = 0;
+// DeviceToPage(point, page_x, page_y);
+
+ if(m_pApp)
+ {
+ if(FORM_OnKeyDown(m_pApp, m_pPage, nChar, ComposeFlag()))
+ return;
+ }
+ switch(nChar)
+ {
+ case 35:
+ OnDocLastpage();
+ break;
+ case 36:
+ OnDocFirstpage();
+ break;
+ case 37:
+ this->OnDocPrepage();
+ break;
+ case 39:
+ this->OnDocNextpage();
+ break;
+ case 38:
+
+ break;
+ case 40:
+
+ break;
+ default:
+ break;
+ }
+ CView::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+void CReaderVCView::OnToolSnapshot()
+{
+ m_bSnap = TRUE;
+ m_bHand = FALSE;
+ m_bSelect = FALSE;
+ this->HideCaret();
+}
+
+void CReaderVCView::OnToolSelect()
+{
+ if(m_pTextPage == NULL)
+ {
+ AfxMessageBox("Sorry, the fpdftext.dll may has expired. For keeping on using the dll, please contact sales@foxitsoftware.com.");
+ return;
+ }
+ m_bSnap = FALSE;
+ m_bHand = FALSE;
+ m_bSelect = TRUE;
+}
+
+void CReaderVCView::OnToolHand()
+{
+ m_bSnap = FALSE;
+ m_bHand = TRUE;
+ m_bSelect = FALSE;
+ this->HideCaret();
+}
+
+void CReaderVCView::LoadMyCursor(int nflag)
+{
+ HCURSOR hCur;
+ if (nflag == 1)
+ {
+ if (m_bSelect)
+ {
+ hCur = AfxGetApp()->LoadCursor(IDC_CURSOR3);
+ }
+ else if (m_bSnap)
+ {
+ hCur = AfxGetApp()->LoadStandardCursor(IDC_CROSS);
+ }
+ else
+ {
+ hCur = AfxGetApp()->LoadCursor(IDC_CURSOR1);
+ }
+ }
+ else if (m_bHand)
+ {
+ hCur = AfxGetApp()->LoadCursor(IDC_CURSOR2);
+ }
+ else if (m_bSelect)
+ {
+ hCur = AfxGetApp()->LoadCursor(IDC_CURSOR3);
+ }
+ else if (m_bSnap)
+ {
+ hCur = AfxGetApp()->LoadStandardCursor(IDC_CROSS);
+ }else
+ {
+ hCur = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
+ }
+ ::SetCursor(hCur);
+}
+
+BOOL CReaderVCView::DeviceToPage(CPoint pt, double& page_x, double& page_y)
+{
+// if(NULL == m_pTextPage) return FALSE;
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+// switch ( m_nRotateFlag % 4 )
+// {
+// case 0:
+// case 2:
+// {
+// FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, pt.x, pt.y, &page_x, &page_y);
+// break;
+// }
+// case 1:
+// case 3:
+// {
+// FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, m_nActualSizeY * m_dbScaleFactor,
+// m_nActualSizeX * m_dbScaleFactor, m_nRotateFlag, pt.x, pt.y, &page_x, &page_y);
+// break;
+// }
+// }
+
+ FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, pt.x, pt.y, &page_x, &page_y);
+ return TRUE;
+}
+
+BOOL CReaderVCView::PageToDevice(double page_x, double page_y, CPoint& pt)
+{
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+
+ FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, page_x, page_y, (int*)&pt.x, (int*)&pt.y);
+ return TRUE;
+}
+
+BOOL CReaderVCView::GetCharIndexByPoint(CPoint pt, int &nIndex)
+{
+ double page_x = 0.0f;
+ double page_y = 0.0f;
+
+ if(NULL == m_pTextPage) return FALSE;
+ int nActualRangeX = 0;
+ int nActualRangeY = 0;
+ if ( m_nRotateFlag % 2 == 0 )
+ {
+ nActualRangeX = m_nActualSizeX;
+ nActualRangeY = m_nActualSizeY;
+ }else{
+ nActualRangeX = m_nActualSizeY;
+ nActualRangeY = m_nActualSizeX;
+ }
+ FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+ (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, pt.x, pt.y, &page_x, &page_y);
+// FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, pt.x, pt.y, &page_x, &page_y);
+
+ nIndex = FPDFText_GetCharIndexAtPos(m_pTextPage, page_x, page_y, 10, 10);
+ if (-3 == nIndex || -1 == nIndex) return FALSE;
+ return TRUE;
+}
+
+void CReaderVCView::CreateCaret(CPoint pt)
+{
+ double a, b, c, d;
+ int nIndex = 0;
+ int nAcent = 0, nDecent = 0;
+ double orgx = 0.0f, orgy = 0.0f;
+ double fontsize = 0.0f;
+ int left = 0, right = 0;
+ int top = 0, bottom = 0;
+ //double left_char, right_char, top_char, bottom_char;//char bounding box
+ FPDF_FONT pfont = NULL;
+
+ if(!GetCharIndexByPoint(pt, nIndex)) return;
+ fontsize = FPDFText_GetFontSize(m_pTextPage, nIndex);
+// FPDFText_GetOrigin(m_pTextPage, nIndex, &orgx, &orgy);
+// pfont = FPDFText_GetFont(m_pTextPage, nIndex);
+// if(NULL == pfont) return;
+// nAcent = FPDFFont_GetAscent(pfont);
+// nDecent = FPDFFont_GetDescent(pfont);
+// FPDFText_GetMatrix(m_pTextPage, nIndex, &a, &b, &c, &d);
+// nAcent =(int)((nAcent * fontsize / 1000.0f) * d + orgy + 0.5f);
+// nDecent = (int)((nDecent * fontsize / 1000.0f) * d + orgy + 0.5f);
+//
+// int nActualRangeX = 0;
+// int nActualRangeY = 0;
+// if ( m_nRotateFlag % 2 == 0 )
+// {
+// nActualRangeX = m_nActualSizeX;
+// nActualRangeY = m_nActualSizeY;
+// }else{
+// nActualRangeX = m_nActualSizeY;
+// nActualRangeY = m_nActualSizeX;
+// }
+// FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+// (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, orgx, nAcent, &left, &top);
+//
+// FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+// (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, orgx, nDecent, &right, &bottom);
+//
+// // FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// // m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, orgx, nAcent, &left, &top);
+// //
+// // FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// // m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, orgx, nDecent, &right, &bottom);
+//
+// this->CreateSolidCaret(2, abs(top - bottom));
+//
+// /* FPDFText_GetCharBox(m_pTextPage, nIndex, &left_char, &right_char, &bottom_char, &top_char);
+//
+// FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, left_char, top_char, &left, &top);
+// FPDF_PageToDevice(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, right_char, bottom_char, &right, &bottom);*/
+// this->SetCaretPos(CPoint(left, top-2));
+// this->ShowCaret();
+
+
+}
+
+void CReaderVCView::GetRects(int nStart, int nEnd)
+{
+ int temp, nCount;
+ nCount = nEnd - nStart;
+ if (nCount < 0)
+ {
+ temp = nEnd;
+ nEnd = nStart;
+ nStart = temp;
+
+ nCount = abs(nCount);
+ }
+ nCount ++;
+
+ int num = FPDFText_CountRects(m_pTextPage, nStart, nCount);
+ if(num == 0) return;
+
+ if (m_rtArray.GetSize() > 0)
+ {
+ m_rtArray.RemoveAll();
+ }
+ PDFRect rect;
+ for (int i=0; i<num; i++)
+ {
+ FPDFText_GetRect(m_pTextPage, i, &rect.m_dbLeft, &rect.m_dbTop, &rect.m_dbRight, &rect.m_dbBottom);
+ m_rtArray.Add(rect);
+ }
+ return;
+}
+
+CRect CReaderVCView::SelectSegment(CPoint pt_lt, CPoint pt_rb)
+{
+ CRect rect(pt_lt, pt_rb);
+// double left, top, right, bottom;
+// int start_index = 0, nCount = 0;
+// int nRect = 0;
+//
+// int nActualRangeX = 0;
+// int nActualRangeY = 0;
+// if ( m_nRotateFlag % 2 == 0 )
+// {
+// nActualRangeX = m_nActualSizeX;
+// nActualRangeY = m_nActualSizeY;
+// }else{
+// nActualRangeX = m_nActualSizeY;
+// nActualRangeY = m_nActualSizeX;
+// }
+// FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+// (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, rect.left, rect.top, &left, &top);
+// FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, (int)(nActualRangeX * m_dbScaleFactor),
+// (int)(nActualRangeY * m_dbScaleFactor), m_nRotateFlag, rect.right, rect.bottom, &right, &bottom);
+//
+// // FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// // m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, rect.left, rect.top, &left, &top);
+// // FPDF_DeviceToPage(m_pPage, m_nStartX, m_nStartY, m_nActualSizeX * m_dbScaleFactor,
+// // m_nActualSizeY * m_dbScaleFactor, m_nRotateFlag, rect.right, rect.bottom, &right, &bottom);
+//
+// int num = FPDFText_CountBoundedSegments(m_pTextPage, left, top, right, bottom);
+//
+// if (m_rtArray.GetSize() > 0)
+// {
+// m_rtArray.RemoveAll();
+// }
+//
+// CDC *pDC = GetDC();
+// for (int i=0; i<num; i++)
+// {
+// FPDFText_GetBoundedSegment(m_pTextPage, i, &start_index, &nCount);
+// nRect = FPDFText_CountRects(m_pTextPage, start_index, nCount);
+//
+// PDFRect rect_select;
+// for (int j=0; j<num; j++)
+// {
+// FPDFText_GetRect(m_pTextPage, j, &rect_select.m_dbLeft, &rect_select.m_dbTop, &rect_select.m_dbRight, &rect_select.m_dbBottom);
+// m_rtArray.Add(rect_select);
+// }
+// }
+// ReleaseDC(pDC);
+ return rect;
+}
+
+void CReaderVCView::OnToolPdf2txt()
+{
+ // TODO: Add your command handler code here
+ if(m_pTextPage == NULL)
+ {
+ AfxMessageBox("Sorry, the fpdftext.dll may has expired. For keeping on using the dll, please contact sales@foxitsoftware.com.");
+ return;
+ }
+ CConvertDlg condlg;
+ if(condlg.DoModal() == IDOK)
+ {
+ int nFlag=condlg.m_nFlag;
+ CReaderVCDoc *pDoc = this->GetDocument();
+ CString pdfname=pDoc->m_strPDFName;
+ CString strname=pdfname,stem;
+ if (strname.Find(".pdf") != -1 || strname.Find(".PDF") != -1)
+ {
+ int startatr=strname.ReverseFind('\\');
+ stem=strname.Mid(startatr+1,strname.GetLength()-startatr-5);
+ }
+ CString defaultname=stem+".txt";
+
+ char szFilter[] = "Text File(*.txt)|*.txt";
+ CFileDialog dlg(FALSE, ".txt", defaultname, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, NULL);
+
+ if (dlg.DoModal() == IDOK)
+ {
+// CString txtname=dlg.GetPathName();
+// BOOL bFlag=FPDFText_PDFToText(pdfname,txtname,nFlag,NULL);
+// if(! bFlag)
+// MessageBox("Convert Failure!");
+ }
+ }
+}
+
+void CReaderVCView::SyncScroll()
+{
+ CRect rect;
+ GetClientRect(rect);
+
+ int nSizeX = 0;
+ int nSizeY = 0;
+ //int temp = 0;
+
+ if (1 == m_nRotateFlag || 3 == m_nRotateFlag)
+ {
+ nSizeX = m_nActualSizeY;
+ nSizeY = m_nActualSizeX;
+ }
+ else
+ {
+ nSizeX = m_nActualSizeX;
+ nSizeY = m_nActualSizeY;
+ }
+
+ SCROLLINFO scrinfo;
+ scrinfo.cbSize = sizeof(SCROLLINFO);
+ GetScrollInfo(SB_HORZ, &scrinfo);
+ scrinfo.nMin =0;
+ scrinfo.nMax = (int)(nSizeX * m_dbScaleFactor);
+ scrinfo.nPage = (unsigned int)(__min(nSizeX * m_dbScaleFactor, rect.Width()));
+ if (nSizeX * m_dbScaleFactor < rect.Width()){scrinfo.fMask |= SIF_DISABLENOSCROLL;}
+ SetScrollInfo(SB_HORZ, &scrinfo);
+ SetScrollPos(SB_HORZ, 0);
+ //m_nPosH = nPosH;
+
+ GetScrollInfo(SB_VERT, &scrinfo);
+ scrinfo.nMin = 0;
+ scrinfo.nMax = (int)(nSizeY * m_dbScaleFactor);
+ scrinfo.nPage =(unsigned int)( __min(nSizeY * m_dbScaleFactor, rect.Height()));
+ if (nSizeY * m_dbScaleFactor < rect.Height()){scrinfo.fMask |= SIF_DISABLENOSCROLL;}
+ SetScrollInfo(SB_VERT, &scrinfo);
+ SetScrollPos(SB_VERT, 0);
+
+}
+
+void CReaderVCView::OnSize(UINT nType, int cx, int cy)
+{
+ CView::OnSize(nType, cx, cy);
+ SyncScroll();
+ if(m_bmp)
+ {
+ FPDFBitmap_Destroy(m_bmp);
+ m_bmp = NULL;
+ }
+
+ m_bmp = FPDFBitmap_Create(cx, cy, 0);
+
+ // TODO: Add your message handler code here
+}
+
+void CReaderVCView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ // TODO: Add your message handler code here and/or call default
+ int prevPos = GetScrollPos(SB_HORZ);
+ int curPos = prevPos;
+ int nMin, nMax, nPage;
+ GetScrollRange(SB_HORZ, &nMin, &nMax);
+ SCROLLINFO si;
+ GetScrollInfo(SB_HORZ, &si);
+ nPage = si.nPage;
+
+ switch(nSBCode)
+ {
+ case SB_TOP:
+ curPos = nMin;
+ break;
+ case SB_BOTTOM:
+ curPos = nMax;
+ break;
+ case SB_LINEUP:
+ curPos --;
+ break;
+ case SB_LINEDOWN:
+ curPos ++;
+ break;
+ case SB_ENDSCROLL:
+ return;
+ case SB_PAGEDOWN:
+ curPos += nPage;
+ break;
+ case SB_PAGEUP:
+ curPos -= nPage;
+ break;
+ case SB_THUMBPOSITION:
+ curPos = si.nTrackPos;
+ break;
+ case SB_THUMBTRACK:
+ curPos = si.nTrackPos;
+ break;
+ }
+
+ if (curPos < nMin) { curPos = nMin;}
+ if(curPos > nMax){ curPos = nMax;}
+ SetScrollPos(SB_HORZ, curPos);
+
+ int distance;
+ distance = prevPos - curPos;
+ m_nStartX += distance;
+ ScrollWindow(distance, 0);
+ CRect rect;
+ GetClientRect(rect);
+ CRect rtnew(rect.left, rect.top, rect.left+distance, rect.bottom);
+ InvalidateRect(&rtnew);
+
+ CView::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CReaderVCView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ // TODO: Add your message handler code here and/or call default
+ int prevPos = GetScrollPos(SB_VERT);
+ int curPos = prevPos;
+ int nMin, nMax, nPage;
+ GetScrollRange(SB_VERT, &nMin, &nMax);
+ SCROLLINFO si;
+ GetScrollInfo(SB_VERT, &si);
+ nPage = si.nPage;
+
+ switch(nSBCode)
+ {
+ case SB_TOP:
+ curPos = nMin;
+ break;
+ case SB_BOTTOM:
+ curPos = nMax;
+ break;
+ case SB_LINEUP:
+ curPos --;
+ break;
+ case SB_LINEDOWN:
+ curPos ++;
+ break;
+ case SB_ENDSCROLL:
+ return;
+ case SB_PAGEDOWN:
+ curPos += nPage;
+ break;
+ case SB_PAGEUP:
+ curPos -= nPage;
+ break;
+ case SB_THUMBPOSITION:
+ curPos = si.nTrackPos;
+ break;
+ case SB_THUMBTRACK:
+ curPos = si.nTrackPos;
+ break;
+ }
+
+ if (curPos < nMin) { curPos = nMin;}
+ if(curPos > nMax){ curPos = nMax;}
+ SetScrollPos(SB_VERT, curPos);
+
+ int distance;
+ distance = prevPos - curPos;
+ m_nStartY += distance;
+ ScrollWindow(0, distance);
+
+ CRect rect;
+ GetClientRect(rect);
+ CRect rtnew(rect.left, rect.bottom + distance, rect.right, rect.bottom);
+ CRect rtnew2(rect.left, rect.top, rect.right, rect.top + distance);
+ InvalidateRect(&rtnew);
+ InvalidateRect(&rtnew2);
+
+ CView::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CReaderVCView::OnToolExtractlinks()
+{
+ if(m_pTextPage == NULL)
+ {
+ AfxMessageBox("Sorry, the fpdftext.dll may has expired. For keeping on using the dll, please contact sales@foxitsoftware.com.");
+ return;
+ }
+ CString strLink = _T("");
+ wchar_t *pBuf = NULL;
+ if(m_pLink != NULL)
+ {
+ FPDFLink_CloseWebLinks(m_pLink);
+ m_pLink = NULL;
+ }
+ m_pLink = FPDFLink_LoadWebLinks(m_pTextPage);
+ if(m_pLink == NULL) return;
+
+ int nCount = FPDFLink_CountWebLinks(m_pLink);
+ if (nCount == 0) return;
+ if (m_rtArray.GetSize()!=0)
+ {
+ m_rtArray.RemoveAll();
+ }
+ for (int i=0; i<nCount; i++)
+ {
+ int nlen = FPDFLink_GetURL(m_pLink, i, NULL, 0)+1;
+ pBuf = new wchar_t[nlen];
+ memset(pBuf, 0, nlen*sizeof(wchar_t));
+ FPDFLink_GetURL(m_pLink, i, (unsigned short*)pBuf, nlen);
+ pBuf[nlen-1] = L'\0';
+ int n = WideCharToMultiByte(CP_ACP, 0, pBuf, -1, NULL, NULL, NULL, NULL);
+ char *p = new char[n];
+ memset(p, 0, n);
+ WideCharToMultiByte(CP_ACP, 0, pBuf, nlen, p, n, NULL, NULL);
+ p[n-1] = '\0';
+ strLink += p;
+ strLink += "\r\n";
+ delete []pBuf;
+ delete []p;
+ int nRects = FPDFLink_CountRects(m_pLink, i);
+ for (int j=0; j<nRects; j++)
+ {
+ PDFRect rect;
+ FPDFLink_GetRect(m_pLink, i, j,
+ &rect.m_dbLeft, &rect.m_dbTop, &rect.m_dbRight, &rect.m_dbBottom);
+ m_rtArray.Add(rect);
+ }
+ }
+ CDC *pDC = GetDC();
+ DrawAllRect(pDC);
+ ReleaseDC(pDC);
+
+ MessageBox(strLink, "Web Links in this page");
+
+}
+
+void CReaderVCView::OnInitialUpdate()
+{
+ CView::OnInitialUpdate();
+
+ // TODO: Add your specialized code here and/or call the base class
+}
+
+void CReaderVCView::OnDestroy()
+{
+ CView::OnDestroy();
+ // TODO: Add your message handler code here
+}
+
+void CReaderVCView::OnUpdateDocFirstpage(CCmdUI* pCmdUI)
+{
+ if (0 == m_nPageIndex)
+ {
+ pCmdUI->Enable(FALSE);
+ }
+ else
+ {
+ pCmdUI->Enable(TRUE);
+ }
+
+}
+
+void CReaderVCView::OnUpdateDocLastpage(CCmdUI* pCmdUI)
+{
+ if (m_nPageIndex == m_nTotalPage - 1)
+ {
+ pCmdUI->Enable(FALSE);
+ }
+ else
+ {
+ pCmdUI->Enable(TRUE);
+ }
+
+}
+
+void CReaderVCView::OnUpdateDocNextpage(CCmdUI* pCmdUI)
+{
+ if (m_nPageIndex == m_nTotalPage - 1)
+ {
+ pCmdUI->Enable(FALSE);
+ }
+ else
+ {
+ pCmdUI->Enable(TRUE);
+ }
+
+}
+
+void CReaderVCView::OnUpdateDocPrepage(CCmdUI* pCmdUI)
+{
+ if (0 == m_nPageIndex)
+ {
+ pCmdUI->Enable(FALSE);
+ }
+ else
+ {
+ pCmdUI->Enable(TRUE);
+ }
+
+}
+
+void CReaderVCView::OnUpdateToolHand(CCmdUI* pCmdUI)
+{
+ // TODO: Add your command update UI handler code here
+ if (m_bHand)
+ {
+ pCmdUI->SetCheck(1);
+ }
+ else
+ {
+ pCmdUI->SetCheck(0);
+ }
+
+
+}
+
+void CReaderVCView::OnUpdateToolSnapshot(CCmdUI* pCmdUI)
+{
+ if (m_bSnap)
+ {
+ pCmdUI->SetCheck(1);
+ }
+ else
+ {
+ pCmdUI->SetCheck(0);
+ }
+
+}
+
+void CReaderVCView::OnUpdateToolSelect(CCmdUI* pCmdUI)
+{
+ if (m_bSelect)
+ {
+ pCmdUI->SetCheck(1);
+ }
+ else
+ {
+ pCmdUI->SetCheck(0);
+ }
+
+}
+
+void CReaderVCView::OnViewBookmark()
+{
+ // TODO: Add your command handler code here
+ CChildFrame* pParent = (CChildFrame*)GetParentFrame();
+ if(pParent == NULL) return;
+ if (m_bBookmark) {
+ pParent->m_wndSplitter.ShowColumn();
+
+ }else{
+ pParent->m_wndSplitter.HideColumn(0);
+ }
+ m_bBookmark = !m_bBookmark;
+}
+
+
+
+BOOL CReaderVCView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+ ScreenToClient(&pt);
+ // TODO: Add your message handler code here and/or call default
+ double page_x = 0;
+ double page_y = 0;
+ DeviceToPage(pt, page_x, page_y);
+
+ if(m_pApp)
+ {
+// FPDF_BOOL b= FORM_OnMouseWheel(m_pApp, m_pPage,ComposeFlag(),0,zDelta,page_x, page_y);
+// if(b)
+// return TRUE;
+ }
+
+ int curPosY = 0;
+ int prevPosY = 0;
+ int distanceY = 25;
+ if(zDelta > 0)
+ {
+ curPosY = GetScrollPos(SB_VERT);
+ prevPosY = SetScrollPos(SB_VERT, curPosY - distanceY, TRUE);
+ curPosY = GetScrollPos(SB_VERT);
+ distanceY = prevPosY - curPosY;
+ m_nStartY = m_nStartY + distanceY;
+ ScrollWindow(0, distanceY);
+ }
+ else
+ {
+ curPosY = GetScrollPos(SB_VERT);
+ prevPosY = SetScrollPos(SB_VERT, curPosY + distanceY, TRUE);
+ curPosY = GetScrollPos(SB_VERT);
+ distanceY = curPosY - prevPosY;
+ m_nStartY = m_nStartY - distanceY;
+ ScrollWindow(0, -distanceY);
+ }
+ return CView::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+void CReaderVCView::OnContextMenu(CWnd* pWnd, CPoint point)
+{
+
+}
+
+void CReaderVCView::OnEditCopy()
+{
+
+ if(m_pTextPage == NULL)
+ {
+ AfxMessageBox("Sorry, the fpdftext.dll may has expired. For keeping on using the dll, please contact sales@foxitsoftware.com.");
+ return;
+ }
+ long left = 0;
+ long top = 0;
+ long right = 0;
+ long bottom = 0;
+ LPWSTR pBuff = NULL;
+ int buflen = 0;
+ CString csCopyText;
+
+ if(m_rtArray.GetSize() != 0)
+ {
+ for (int i=0; i<m_rtArray.GetSize(); i++)
+ {
+ PDFRect rect = m_rtArray.GetAt(i);
+ buflen = FPDFText_GetBoundedText(m_pTextPage, rect.m_dbLeft, rect.m_dbTop, rect.m_dbRight,
+ rect.m_dbBottom, (unsigned short*)pBuff, 0) + 1;
+ if(buflen == 0)
+ return;
+ pBuff = new wchar_t[2*buflen];
+ memset(pBuff, 0, 2*buflen);
+
+ FPDFText_GetBoundedText(m_pTextPage, rect.m_dbLeft, rect.m_dbTop, rect.m_dbRight,
+ rect.m_dbBottom, (unsigned short*)pBuff, buflen);
+
+ int n = WideCharToMultiByte(CP_ACP, 0, pBuff, -1, NULL, NULL, NULL, NULL);
+ char *p = new char[n];
+ memset(p, 0, n);
+ WideCharToMultiByte(CP_ACP, 0, pBuff, buflen, p, n, NULL, NULL);
+ csCopyText = csCopyText + CString(p);
+ delete[] p;
+ }
+
+ ::OpenClipboard(NULL);
+ ::EmptyClipboard();
+ HANDLE hClip=GlobalAlloc(GMEM_MOVEABLE,csCopyText.GetLength()+1);
+ char* pBuf=(char*)GlobalLock(hClip);
+ strcpy(pBuf,csCopyText);
+ GlobalUnlock(hClip);
+ HANDLE hSuccess = SetClipboardData(CF_TEXT, hClip);
+ if(NULL != hSuccess)
+ AfxMessageBox("copy success!");
+ ::CloseClipboard();
+
+
+ }
+
+}
+
+void CReaderVCView::OnRenderbitmap()
+{
+
+}
+
+void CReaderVCView::OnExportPdfToBitmap()
+{
+ if (!m_pExportPageDlg)
+ {
+ m_pExportPageDlg=new CExportPage;
+ m_pExportPageDlg->Create(IDD_EXPORT_PAGE,this);
+ m_pExportPageDlg->InitDialogInfo(this);
+ m_pExportPageDlg->ShowWindow(SW_SHOW);
+ }
+ else
+ m_pExportPageDlg->ShowWindow(SW_SHOW);
+}
+
+BOOL CReaderVCView::PreTranslateMessage(MSG* pMsg)
+{
+ // TODO: Add your specialized code here and/or call the base class
+// PP_Event event;
+// if(pMsg->message == WM_LBUTTONDOWN)
+// {
+// event.type = PP_Event_Type_MouseDown;
+//
+// int xPos = (int)(WORD)(pMsg->lParam);
+// int yPos = (int)(WORD)((pMsg->lParam >> 16) & 0xFFFF);
+//
+// event.u.mouse.x = xPos;
+// event.u.mouse.y = yPos;
+// FPDF_FormFillEventMsg(m_pPage, event);
+// }
+// if(pMsg->message == WM_LBUTTONUP)
+// {
+// event.type = PP_Event_Type_MouseUp;
+//
+// int xPos = (int)(WORD)(pMsg->lParam);
+// int yPos = (int)(WORD)((pMsg->lParam >> 16) & 0xFFFF);
+//
+// event.u.mouse.x = xPos;
+// event.u.mouse.y = yPos;
+// FPDF_FormFillEventMsg(m_pPage, event);
+// }
+ return CView::PreTranslateMessage(pMsg);
+}
+
+void CReaderVCView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ // TODO: Add your message handler code here and/or call default
+ if(m_pApp)
+ {
+ if(FORM_OnChar(m_pApp, m_pPage, nChar, ComposeFlag()))
+ return ;
+ }
+ CView::OnChar(nChar, nRepCnt, nFlags);
+}
+
+void CReaderVCView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
+{
+ // TODO: Add your specialized code here and/or call the base class
+ ((CReaderVCApp*)AfxGetApp())->m_pActiveView = (CReaderVCView*)pActivateView;
+ CView::OnActivateView(bActivate, pActivateView, pDeactiveView);
+}
+
+void CReaderVCView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ // TODO: Add your message handler code here and/or call default
+ if(m_pApp)
+ FORM_OnKeyUp(m_pApp, m_pPage, nChar, ComposeFlag());
+ CView::OnKeyUp(nChar, nRepCnt, nFlags);
+}
+
+
+int G_WriteBlock( FPDF_FILEWRITE* pThis, const void* pData, unsigned long size);
+class CSDK_FileWrite:public FPDF_FILEWRITE
+{
+public:
+ CSDK_FileWrite()
+ {
+ m_fp = NULL;
+ version = 0;
+ WriteBlock = G_WriteBlock;
+ }
+public:
+ FILE* m_fp;
+};
+int G_WriteBlock( FPDF_FILEWRITE* pThis, const void* pData, unsigned long size)
+{
+ CSDK_FileWrite* pFW = (CSDK_FileWrite*)pThis;
+ return fwrite(pData, sizeof(char), size, pFW->m_fp);
+}
+void CReaderVCView::OnFileSave()
+{
+ // TODO: Add your command handler code here
+ if(m_pDoc != NULL)
+ {
+ CFileDialog dlg(FALSE,"",NULL,NULL,"PDF(*.PDF)|*.PDF||All Files(*.*)|*.*");
+ if (dlg.DoModal() == IDOK)
+ {
+ CString strPDFName = dlg.GetPathName();
+
+ CSDK_FileWrite fw;
+ fw.m_fp = fopen(dlg.GetPathName(), "wb");
+
+ FPDF_SaveAsCopy(m_pDoc, &fw, 0);
+ fclose(fw.m_fp);
+// FPDF_SaveAsFile(m_pDoc, strPDFName.GetBuffer(strPDFName.GetLength()), 0, NULL, 0, NULL, 0);
+ }
+ }
+}
+
+
+
+void CReaderVCView::OnTestJS()
+{
+ // TODO: Add your command handler code here
+ //FPDF_WIDESTRING js = L"run=app.setInterval(\"app.alert(\\\"ok\\\")\");app.setTimeOut(\"app.clearInterval(run)\", 6000);";
+// FPDF_WIDESTRING js = L"app.alert(AFNumber_Keystroke(\'aaaaaaaaa\'))";
+// FPDF_WIDESTRING js = L"app.mailMsg(1)";
+ //FPDF_WIDESTRING js = L"app.setTimeOut(\"app.clearInterval(1)\", 6000);";
+ //FPDF_WIDESTRING js = L"t.1";
+// RunJS(m_pApp, js);
+ CTestJsDlg dlg;
+ dlg.init(m_pApp);
+ dlg.DoModal();
+}
+
+//This function is to simulate the pp event.
+#define PP_EVENT_MODIFIER_SHIFTKEY 1<<0
+#define PP_EVENT_MODIFIER_CONTROLKEY 1<<1
+#define PP_EVENT_MODIFIER_ALTKEY 1<<2
+unsigned int CReaderVCView::ComposeFlag()
+{
+ unsigned int nFlag = 0;
+ if(IsALTpressed())
+ nFlag = nFlag|PP_EVENT_MODIFIER_ALTKEY;
+ if(IsCTRLpressed())
+ nFlag = nFlag|PP_EVENT_MODIFIER_CONTROLKEY;
+ if(IsSHIFTpressed())
+ nFlag = nFlag|PP_EVENT_MODIFIER_SHIFTKEY;
+ return nFlag;
+}
+
+void CReaderVCView::OnPrintMetalfile()
+{
+ FPDF_PAGE page = FPDF_LoadPage(m_pDoc, 0);
+ if (!page) {
+ return;
+ }
+
+ HDC printer_dc = CreateDC("WINSPOOL", "Microsoft XPS Document Writer", NULL,
+ NULL);
+ if (!printer_dc) {
+ printf("Could not create printer DC\n");
+ return;
+ }
+ DOCINFO di = {0};
+ di.cbSize = sizeof(DOCINFO);
+ di.lpszDocName = "Foxit print test";
+ int job_id = StartDoc(printer_dc, &di);
+
+ StartPage(printer_dc);
+
+ SetGraphicsMode(printer_dc, GM_ADVANCED);
+ XFORM xform = {0, 0, 0, 0, 0, 0};
+ xform.eM11 = xform.eM22 = 2;
+ ModifyWorldTransform(printer_dc, &xform, MWT_LEFTMULTIPLY);
+
+ int dc_width = GetDeviceCaps(printer_dc, PHYSICALWIDTH);
+ int dc_height = GetDeviceCaps(printer_dc, PHYSICALHEIGHT);
+ HDC metafile_dc = CreateEnhMetaFile(printer_dc, NULL, NULL, NULL);
+ XFORM xform1 = {0, 0, 0, 0, 0, 0};
+ xform1.eM11 = xform1.eM22 = 0.5;
+ ModifyWorldTransform(metafile_dc, &xform1, MWT_LEFTMULTIPLY);
+ FPDF_RenderPage(metafile_dc, page, 0, 0, dc_width, dc_height, 0, 0);
+
+ HENHMETAFILE emf = CloseEnhMetaFile(metafile_dc);
+
+ ENHMETAHEADER header = {0};
+ GetEnhMetaFileHeader(emf, sizeof(header), &header);
+
+ PlayEnhMetaFile(printer_dc, emf, (RECT *)&header.rclBounds);
+
+ EndPage(printer_dc);
+ EndDoc(printer_dc);
+
+ DeleteEnhMetaFile(emf);
+ DeleteDC(printer_dc);
+
+}
+
+void CReaderVCView::CreateLocalPath(CString &csPath)
+{
+ csPath = "c://test.pdf";
+}
+
+BOOL CReaderVCView::HttpDataPost(CString csData, CString csAppName, CString csObject, CString csServer, CString csUserName, CString csPassword, INTERNET_PORT nPort , BOOL IsHTTPS, CString csContentType, CString csAddHeader, CString &csResponse)
+{
+ DWORD retCode = 0;
+ BOOL bRet = FALSE;
+ TRY
+ {
+ CInternetSession sess(csAppName);
+ CHttpConnection* pConnect = sess.GetHttpConnection(csServer, nPort, csUserName, csPassword);
+ if (pConnect == NULL)
+ return FALSE;
+
+ DWORD dwRequestFlags = INTERNET_FLAG_EXISTING_CONNECT;
+ if ( IsHTTPS == TRUE)
+ dwRequestFlags |= INTERNET_FLAG_SECURE;
+ CHttpFile* pHttpFile = pConnect->OpenRequest(CHttpConnection::HTTP_VERB_POST, csObject, NULL, 1, NULL, NULL, dwRequestFlags);
+ if (pHttpFile != NULL)
+ {
+ CString strData = csData;
+ DWORD dwLength = strData.GetLength();
+
+ CString strHeaders;
+ strHeaders.Format("Content-Type: %s\r\nContent-Length: %d\r\n", csContentType, dwLength);
+ strHeaders += csAddHeader;
+ pHttpFile->AddRequestHeaders(strHeaders);
+ DWORD dwTotalLength = dwLength + strHeaders.GetLength();
+
+resend:
+ bRet = pHttpFile->SendRequestEx(dwTotalLength);
+ pHttpFile->Write(csData, dwLength);
+
+ pHttpFile->QueryInfoStatusCode( retCode );
+ if (HTTP_STATUS_OK == retCode) //succ
+ {
+ char buf[4096] = {0};
+ UINT bytesRead = 0;
+ while( ( bytesRead = pHttpFile->Read( buf, 4095 ) ) > 0 )
+ {
+ buf[bytesRead] = '\0';
+ size_t aLen = strlen( buf ) + 1;
+ int wLen = MultiByteToWideChar( 936, 0, buf, aLen, NULL, 0 );
+
+ LPOLESTR lpw = new WCHAR [wLen];
+ MultiByteToWideChar( 936, 0, buf, aLen, lpw, wLen );
+ csResponse += lpw;
+ delete [] lpw;
+
+ memset( buf, 0, 4096 );
+ }
+ }
+ bRet = pHttpFile->EndRequest();
+ if (bRet)
+ {
+ // Handle any authentication dialogs.
+ if (NeedAuth(pHttpFile))
+ {
+ DWORD dwErr;
+ dwErr = pHttpFile->ErrorDlg(GetDesktopWindow(),
+ bRet ? ERROR_SUCCESS : GetLastError(),
+ FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
+ FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
+ FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
+ NULL);
+ if (dwErr == ERROR_INTERNET_FORCE_RETRY)
+ {
+ goto resend;
+ }
+ else if(dwErr == 0)
+ {
+ bRet = FALSE;
+ }
+ }
+ }
+ pHttpFile->Close();
+ delete pHttpFile;
+ }
+ pConnect->Close();
+ delete pConnect;
+ sess.Close();
+ }
+ CATCH_ALL(e)
+ {
+ return FALSE;
+ }
+ END_CATCH_ALL
+ return bRet;
+}
+
+BOOL CReaderVCView::HttpDataPut(CString csData, CString csAppName, CString csObject, CString csServer, CString csUserName, CString csPassword, INTERNET_PORT nPort, BOOL IsHTTPS)
+{
+ DWORD retCode = 0;
+ BOOL bRet = FALSE;
+ TRY
+ {
+ CInternetSession sess(csAppName);
+ CHttpConnection* pConnect = sess.GetHttpConnection(csServer, nPort, csUserName, csPassword);
+ if (pConnect == NULL)
+ return FALSE;
+
+ DWORD dwRequestFlags=INTERNET_FLAG_EXISTING_CONNECT;
+ if ( IsHTTPS== TRUE)
+ dwRequestFlags |= INTERNET_FLAG_SECURE;
+ CHttpFile* pHttpFile = pConnect->OpenRequest(CHttpConnection::HTTP_VERB_PUT, csObject,NULL,1,NULL,NULL,dwRequestFlags);
+ if (pHttpFile != NULL)
+ {
+resend:
+ CString strData = csData;
+ DWORD dwTotalLength = strData.GetLength();
+
+ bRet = pHttpFile->SendRequestEx(dwTotalLength);
+ pHttpFile->Write(csData, dwTotalLength);
+ bRet = pHttpFile->EndRequest();
+ if (bRet)
+ {
+ // Handle any authentication dialogs.
+ if (NeedAuth(pHttpFile))
+ {
+ DWORD dwErr;
+ dwErr = pHttpFile->ErrorDlg(GetDesktopWindow(),
+ bRet ? ERROR_SUCCESS : GetLastError(),
+ FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
+ FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
+ FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
+ NULL
+ );
+ if (dwErr == ERROR_INTERNET_FORCE_RETRY)
+ {
+ goto resend;
+ }
+ else if(dwErr == 0)
+ {
+ bRet = FALSE;
+ }
+ }
+ }
+ pHttpFile->QueryInfoStatusCode( retCode );
+ if (retCode != HTTP_STATUS_OK)
+ {
+ bRet = FALSE;
+ }
+ else
+ bRet = TRUE;
+
+ pHttpFile->Close();
+ delete pHttpFile;
+ }
+ pConnect->Close();
+ delete pConnect;
+ sess.Close();
+ }
+ CATCH_ALL(e)
+ {
+ return FALSE;
+ }
+ END_CATCH_ALL
+ return bRet;
+}
+
+BOOL CReaderVCView::NeedAuth(CHttpFile *pHttpFile)
+{
+ // Get status code.
+ DWORD dwStatus;
+ DWORD cbStatus = sizeof(dwStatus);
+ pHttpFile->QueryInfo
+ (
+ HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE,
+ &dwStatus,
+ &cbStatus,
+ NULL
+ );
+ // fprintf (stderr, "Status: %d\n", dwStatus);
+ // Look for 401 or 407.
+ DWORD dwFlags;
+ switch (dwStatus)
+ {
+ case HTTP_STATUS_DENIED:
+ dwFlags = HTTP_QUERY_WWW_AUTHENTICATE;
+ break;
+ case HTTP_STATUS_PROXY_AUTH_REQ:
+ dwFlags = HTTP_QUERY_PROXY_AUTHENTICATE;
+ break;
+ default:
+ return FALSE;
+ }
+ // Enumerate the authentication types.
+ BOOL fRet;
+ char szScheme[64];
+ DWORD dwIndex = 0;
+ do
+ {
+ DWORD cbScheme = sizeof(szScheme);
+ fRet = pHttpFile->QueryInfo
+ (dwFlags, szScheme, &cbScheme, &dwIndex);
+
+ //if (fRet)
+ //fprintf (stderr, "Found auth scheme: %s\n", szScheme);
+ }
+ while (fRet);
+ return TRUE;
+} \ No newline at end of file
diff --git a/xfa_test/FormFiller_Test/ReaderVCView.h b/xfa_test/FormFiller_Test/ReaderVCView.h
new file mode 100644
index 0000000000..9e4e71b313
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ReaderVCView.h
@@ -0,0 +1,375 @@
+// ReaderVCView.h : interface of the CReaderVCView class
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_READERVCVIEW_H__9AFC449C_26D0_4906_ABAE_1298871862E2__INCLUDED_)
+#define AFX_READERVCVIEW_H__9AFC449C_26D0_4906_ABAE_1298871862E2__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "ExportPage.h"
+#include "afxtempl.h"
+#include <wininet.h>
+#include <afxinet.h>
+#include <afxctl.h>
+
+typedef struct
+{
+ CString m_strFind;
+ int m_nFlag;
+ int m_nDirection;
+ BOOL m_bFirst;
+ wchar_t *m_pCurFindBuf; //unicode code
+ int m_nStartPageIndex; // the page index for starting find
+ int m_nStartCharIndex; //start index
+}FindInfo;
+
+typedef struct
+{
+ double m_dbLeft;
+ double m_dbTop;
+ double m_dbRight;
+ double m_dbBottom;
+}PDFRect;
+
+#define IsALTpressed() (GetKeyState(VK_MENU) < 0)
+#define IsCTRLpressed() (GetKeyState(VK_CONTROL) < 0)
+#define IsSHIFTpressed() (GetKeyState(VK_SHIFT)&0x8000)
+#define IsINSERTpressed() (GetKeyState(VK_INSERT) & 0x01)
+// void Sample_PageToDevice(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page,double page_x,double page_y, int* device_x, int* device_y);
+//
+// void Sample_Invalidate(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
+//
+// void Sample_DeviceToPage(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page,int device_x, int device_y, double* page_x, double* page_y);
+//
+// void Sample_SetCaret(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page,double page_x, double page_y, int nWidth, int nHeight);
+//
+// void Sample_Release(struct _FPDF_FORMFILLINFO* pThis);
+//
+//
+// int Sample_SetTimer(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc);
+//
+// void Sample_KillTimer(struct _FPDF_FORMFILLINFO* pThis,int nID);
+//
+// void Sample_SetCursor(struct _FPDF_FORMFILLINFO* pThis,int nCursorType);
+//
+// void Sample_OnChange(struct _FPDF_FORMFILLINFO* pThis);
+//
+// FPDF_BOOL Sample_IsSHIFTKeyDown(struct _FPDF_FORMFILLINFO* pThis);
+//
+// FPDF_BOOL Sample_IsCTRLKeyDown(struct _FPDF_FORMFILLINFO* pThis);
+//
+// FPDF_BOOL Sample_IsALTKeyDown(struct _FPDF_FORMFILLINFO* pThis) ;
+//
+// FPDF_BOOL Sample_IsINSERTKeyDown(struct _FPDF_FORMFILLINFO* pThis) ;
+class CReaderVCDoc;
+
+typedef unsigned long FX_DWORD;
+static int CALLBACK FontEnumProc(const LOGFONTA *plf, const TEXTMETRICA *lpntme, FX_DWORD FontType, LPARAM lParam)
+{
+ FPDF_AddInstalledFont((void*)lParam, plf->lfFaceName, plf->lfCharSet);
+ return 1;
+}
+#define FXDWORD_FROM_MSBFIRST2(i) (((unsigned char)(i) << 24) | ((unsigned char)((i) >> 8) << 16) | ((unsigned char)((i) >> 16) << 8) | (unsigned char)((i) >> 24))
+class CSampleFontInfo : public FPDF_SYSFONTINFO
+{
+public:
+ CSampleFontInfo()
+ {
+ m_hDC = CreateDCA("DISPLAY", NULL, NULL, NULL);
+ }
+
+ HDC m_hDC;
+
+ void ReleaseImpl()
+ {
+ DeleteDC(m_hDC);
+ delete this;
+ }
+
+ void EnumFontsImpl(void* pMapper)
+ {
+ LOGFONTA lf;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfFaceName[0] = 0;
+ lf.lfPitchAndFamily = 0;
+ ::EnumFontFamiliesExA(m_hDC, &lf, FontEnumProc, (LPARAM)pMapper, 0);
+ }
+
+ void* MapFontImpl(int weight, int bItalic, int charset, int pitch_family, const char* face, int* bExact)
+ {
+ return ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0,
+ charset, OUT_TT_ONLY_PRECIS, 0, 0, pitch_family, face);
+ }
+
+ unsigned long GetFontDataImpl(void* hFont, unsigned int table, unsigned char* buffer, unsigned long buf_size)
+ {
+ HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
+ buf_size = ::GetFontData(m_hDC, FXDWORD_FROM_MSBFIRST2(table), 0, buffer, buf_size);
+ ::SelectObject(m_hDC, hOldFont);
+ if (buf_size == GDI_ERROR) return 0;
+ return buf_size;
+ }
+
+ unsigned long GetFaceNameImpl(void* hFont, char* buffer, unsigned long buf_size)
+ {
+ HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
+ unsigned long ret = ::GetTextFaceA(m_hDC, buf_size, buffer);
+ ::SelectObject(m_hDC, hOldFont);
+ if (buf_size == GDI_ERROR) return 0;
+ return ret;
+ }
+
+ int GetFontCharsetImpl(void* hFont)
+ {
+ TEXTMETRIC tm;
+ HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
+ ::GetTextMetrics(m_hDC, &tm);
+ ::SelectObject(m_hDC, hOldFont);
+ return tm.tmCharSet;
+ }
+
+ void DeleteFontImpl(void* hFont)
+ {
+ ::DeleteObject(hFont);
+ }
+};
+
+typedef struct _FPDF_FILE
+{
+ FPDF_FILEHANDLER fileHandler;
+ FILE* file;
+}FPDF_FILE;
+
+class CReaderVCView : public CView, public FPDF_FORMFILLINFO
+{
+protected: // create from serialization only
+ CReaderVCView();
+ DECLARE_DYNCREATE(CReaderVCView)
+
+// Attributes
+public:
+ CReaderVCDoc* GetDocument();
+ CChildFrame *m_pFram;
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CReaderVCView)
+ public:
+ virtual void OnDraw(CDC* pDC); // overridden to draw this view
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual void OnInitialUpdate();
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ protected:
+ virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
+ virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
+ virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
+ virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ CExportPage* m_pExportPageDlg;
+ FPDF_PAGE GetPage(){ return m_pPage;}
+ void SyncScroll();
+ CRect SelectSegment(CPoint pt_lt, CPoint pt_rb);
+ void GetRects(int nStart, int nEnd);
+ void CreateCaret(CPoint pt);
+ BOOL GetCharIndexByPoint(CPoint pt, int &nIndex);
+ void LoadMyCursor(int nflag = 0);
+ void DeleteAllRect();
+ void DrawAllRect(CDC *pDC);
+ void DrawReverse(CDC *pDC, CRect rect);
+ void FindNext(int nDirection);
+ void FindText(CString strFind, BOOL bCase, BOOL bWholeword, int Direction);
+ void ScalPage(double dbScal);
+ void GotoPage(int index);
+ BOOL SetPDFDocument(FPDF_DOCUMENT pDoc, int nPageNum);
+ void DrawPage(int nRotate, CDC *pDC);
+ void SetPageMetrics(FPDF_PAGE pPage);
+
+ void SetScalFactor(double dbScal);
+ void GetNewPageSize(int &nsizeX, int &nsizeY);
+ BOOL LoadPDFPage(FPDF_DOCUMENT doc, int nIndex, CPoint pos = CPoint(0,0));
+
+ FPDF_DOCUMENT GetPDFDoc(){ return m_pDoc;}
+ int GetTotalPages(){ return m_nTotalPage;}
+ BOOL DeviceToPage(CPoint pt, double& page_x, double& page_y);
+ BOOL PageToDevice(double page_x, double page_y, CPoint& pt);
+ int GetCurrentPageIndex() { return m_nPageIndex; }
+ static BOOL HttpDataPut(CString csData, CString csAppName, CString csObject, CString csServer,
+ CString csUserName, CString csPassword, INTERNET_PORT nPort, BOOL IsHTTPS);
+ static BOOL NeedAuth(CHttpFile *pHttpFile);
+ static BOOL HttpDataPost(CString csData, CString csAppName, CString csObject, CString csServer, CString csUserName,
+ CString csPassword, INTERNET_PORT nPort , BOOL IsHTTPS, CString csContentType, CString csAddHeader, CString &csResponse);
+ static void CreateLocalPath(CString &csPath);
+
+ virtual ~CReaderVCView();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+public:
+ void PageToDeviceImpl(FPDF_PAGE page,double page_x,double page_y, int* device_x, int* device_y);
+ void DeviceToPageImpl(FPDF_PAGE page,int device_x, int device_y, double* page_x, double* page_y);
+ void InvalidateImpl(FPDF_PAGE page, double left, double top, double right, double bottom);
+ void OutputSelectedRectImpl(FPDF_PAGE page, double left, double top, double right, double bottom);
+ void SetCaretImpl(FPDF_PAGE page,double page_x, double page_y, int nWidth, int nHeight);
+ void ReleaseImpl();
+ int SetTimerImpl(int uElapse, TimerCallback lpTimerFunc);
+ void KillTimerImpl(int nID);
+ FPDF_SYSTEMTIME GetLocalTimeImpl();
+ void SetCurorImpl(int nCursorType);
+ void ExecuteNamedActionImpl(FPDF_BYTESTRING namedaction);
+ void OnChangeImpl();
+ bool IsSHIFTKeyDownImpl();
+ bool IsCTRLKeyDownImpl();
+ bool IsALTKeyDownImpl();
+ bool IsINSERTKeyDownImpl();
+ BOOL SubmitFormImpl(void* pBuffer, int nLength, CString strURL);
+ FPDF_PAGE GetPageImpl(FPDF_DOCUMENT document,int nPageIndex);
+ int GetRotationImpl(FPDF_PAGE page);
+ CString GetFilePath();
+ FPDF_PAGE GetCurrentPageImpl(FPDF_DOCUMENT document);
+// friend FPDF_DOCUMENT _FPDF_GetCurDocument(struct _FPDF_FORMFILLINFO* pThis);
+// friend FPDF_PAGE _FPDF_GetCurPage(struct _FPDF_FORMFILLINFO* pThis);
+private:
+// FPDF_APP m_App;
+// FPDF_FORMFILLINFO m_formFiledInfo;
+private:
+// FPDF_APP GetFPDFApp() {return m_App;}
+ unsigned int ComposeFlag();
+private:
+ CMap<int, int, FPDF_PAGE, FPDF_PAGE> m_pageMap;
+ FPDF_FORMHANDLE m_pApp;
+ FPDF_BITMAP m_bmp;
+ //for render pdf
+ FPDF_DOCUMENT m_pDoc;
+ FPDF_PAGE m_pPage;
+ int m_nTotalPage;
+ int m_nRotateFlag;
+ double m_dbScaleFactor;
+ int m_nPageIndex;
+ double m_dbPageWidth;
+ double m_dbPageHeight;
+ int m_nStartX;
+ int m_nStartY;
+ int m_nActualSizeX;
+ int m_nActualSizeY;
+
+ //for search text
+ FPDF_TEXTPAGE m_pTextPage;
+ FindInfo m_FindInfo;
+ FPDF_SCHHANDLE m_pSCHHandle;
+ PDFRect * m_rtFind;
+ int m_nRectNum;
+
+ //for select text
+ BOOL m_bSelect;
+ BOOL m_bHand;
+ BOOL m_bSnap;
+ BOOL m_bHasChar; //whether can get a char when left button be clicked
+ CPoint m_ptLBDown;
+ CPoint m_ptLBUp;
+ CPoint m_ptOld;
+
+ int m_nStartIndex; //char index
+ int m_nOldIndex;
+ int m_nEndIndex;
+ CArray <PDFRect, PDFRect> m_rtArray;
+ CRect m_rtOld;
+
+ //
+ int m_nPosH;
+ int m_nPosV;
+
+ // for links
+ FPDF_PAGELINK m_pLink;
+
+ BOOL m_bBookmark;
+
+public:
+ wchar_t* m_pwsResponse;
+
+private:
+
+ CArray<CRect, CRect&> m_SelectArray;
+ static CMap<int, int,TimerCallback, TimerCallback> m_mapTimerFuns;
+public:
+ static void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
+ {
+ TimerCallback callback = NULL;
+ m_mapTimerFuns.Lookup(idEvent, callback);
+ if(callback)
+ (*callback)(idEvent);
+ }
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CReaderVCView)
+ afx_msg void OnDocFirstpage();
+ afx_msg void OnDocGotopage();
+ afx_msg void OnDocLastpage();
+ afx_msg void OnDocNextpage();
+ afx_msg void OnDocPrepage();
+ afx_msg void OnClockwise();
+ afx_msg void OnCounterclockwise();
+ afx_msg void OnViewActualSize();
+ afx_msg void OnViewFitPage();
+ afx_msg void OnViewFitWidth();
+ afx_msg void OnViewZoomIn();
+ afx_msg void OnViewZoomOut();
+ afx_msg void OnViewZoomTo();
+ afx_msg void OnEditFind();
+ afx_msg void OnFilePrint();
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg void OnToolSnapshot();
+ afx_msg void OnToolSelect();
+ afx_msg void OnToolHand();
+ afx_msg void OnToolPdf2txt();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ afx_msg void OnToolExtractlinks();
+ afx_msg void OnDestroy();
+ afx_msg void OnUpdateDocFirstpage(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateDocLastpage(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateDocNextpage(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateDocPrepage(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateToolHand(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateToolSnapshot(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateToolSelect(CCmdUI* pCmdUI);
+ afx_msg void OnViewBookmark();
+ afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+ afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
+ afx_msg void OnEditCopy();
+ afx_msg void OnRenderbitmap();
+ afx_msg void OnExportPdfToBitmap();
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg void OnFileSave();
+ afx_msg void OnTestJS();
+ afx_msg void OnPrintMetalfile();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+#ifndef _DEBUG // debug version in ReaderVCView.cpp
+inline CReaderVCDoc* CReaderVCView::GetDocument()
+ { return (CReaderVCDoc*)m_pDocument; }
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_READERVCVIEW_H__9AFC449C_26D0_4906_ABAE_1298871862E2__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/StdAfx.cpp b/xfa_test/FormFiller_Test/StdAfx.cpp
new file mode 100644
index 0000000000..c358cc0c6d
--- /dev/null
+++ b/xfa_test/FormFiller_Test/StdAfx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// ReaderVC.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
+
diff --git a/xfa_test/FormFiller_Test/StdAfx.h b/xfa_test/FormFiller_Test/StdAfx.h
new file mode 100644
index 0000000000..7df16092d5
--- /dev/null
+++ b/xfa_test/FormFiller_Test/StdAfx.h
@@ -0,0 +1,99 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__2BC4C1DE_4165_4967_AC3E_AE2EA2A4D2FD__INCLUDED_)
+#define AFX_STDAFX_H__2BC4C1DE_4165_4967_AC3E_AE2EA2A4D2FD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxdisp.h> // MFC Automation classes
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxinet.h>
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+#include "../../include/fpdfview.h"
+#include "../../include/fpdfdoc.h"
+#include "../../include/fpdftext.h"
+#include "../../include/fpdfformfill.h"
+#include "../../include/fpdf_sysfontinfo.h"
+#include "../../include/fpdfsave.h"
+#include <afxcview.h>
+#include "afxtempl.h"
+
+#include "../../include/fpdfedit.h"
+
+#ifdef _DEBUG
+ #pragma comment(lib, "../../lib/dbg_w32_vc10/formfiller[dbg,w32,vc10].lib")
+ #pragma comment(lib, "../../lib/dbg_w32_vc10/fpdfsdk[dbg,w32,vc10].lib")
+ #pragma comment(lib, "../../lib/dbg_w32_vc10/fxedit[dbg,w32,vc10].lib")
+ #pragma comment(lib, "../../lib/dbg_w32_vc10/javascript[dbg,w32,vc10].lib")
+ #pragma comment(lib, "../../lib/dbg_w32_vc10/jsapi[dbg,w32,vc10].lib")
+ #pragma comment(lib, "../../lib/dbg_w32_vc10/pdfwindow[dbg,w32,vc10].lib")
+// #pragma comment(lib, "../../lib/dbg_w32_vc10/foxitopenpdf.lib")
+
+// #pragma comment(lib, "../../../../../../v8/build/Debug/lib/icui18n.lib")
+// #pragma comment(lib, "../../../../../../v8/build/Debug/lib/icuuc.lib")
+// #pragma comment(lib, "../../../../../../v8/build/Debug/lib/v8_base.ia32.lib")
+// #pragma comment(lib, "../../../../../../v8/build/Debug/lib/v8_nosnapshot.ia32.lib")
+// #pragma comment(lib, "../../../../../../v8/build/Debug/lib/v8_snapshot.lib")
+ #pragma comment(lib, "../../../v8/build/Debug/lib/icui18n.lib")
+ #pragma comment(lib, "../../../v8/build/Debug/lib/icuuc.lib")
+ #pragma comment(lib, "../../../v8/build/Debug/lib/v8_base.ia32.lib")
+ #pragma comment(lib, "../../../v8/build/Debug/lib/v8_nosnapshot.ia32.lib")
+ #pragma comment(lib, "../../../v8/build/Debug/lib/v8_snapshot.lib")
+
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fxcrt[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fxge[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fpdfdoc[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fpdfapi[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fxcodec[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fpdftext[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fdrm[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fxmath[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fxbarcode[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxcore/lib/dbg/x86_vc10/fxhal[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fxjse/lib/dbg/x86_vc10/fxjse_bare[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fwl/lib/dbg/x86_vc10/fwlbasewidget[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fwl/lib/dbg/x86_vc10/fwlcore[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fwl/lib/dbg/x86_vc10/fwltheme[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fwl/lib/dbg/x86_vc10/fwllightwidget[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fxgraphics/lib/dbg/x86_vc10/fxgraphics[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fgas/lib/dbg/x86_vc10/fgas[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fee/lib/dbg/x86_vc10/fees[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fee/lib/dbg/x86_vc10/fx_wordbreaks[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fdp/lib/dbg/x86_vc10/fde[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fdp/lib/dbg/x86_vc10/fdetto[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fdp/lib/dbg/x86_vc10/fdexml[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fdp/lib/dbg/x86_vc10/fdecss[dbg_x86_vc10].lib")
+
+ #pragma comment(lib, "../../../fxlib/fxfa/lib/dbg/x86_vc10/fxfa_app[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxfa/lib/dbg/x86_vc10/fxfa_fm2js[dbg_x86_vc10].lib")
+ #pragma comment(lib, "../../../fxlib/fxfa/lib/dbg/x86_vc10/fxfa_parser[dbg_x86_vc10].lib")
+
+#else
+ #pragma comment(lib, "../../lib/rel_w32_vc6/fpdfsdk.lib")
+#endif
+//#pragma comment(lib, "../../lib/fpdfsdk.dll")
+
+//#include "fpdfsdk_ext_wh.h"
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__2BC4C1DE_4165_4967_AC3E_AE2EA2A4D2FD__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/TestJsDlg.cpp b/xfa_test/FormFiller_Test/TestJsDlg.cpp
new file mode 100644
index 0000000000..30fb3a2efb
--- /dev/null
+++ b/xfa_test/FormFiller_Test/TestJsDlg.cpp
@@ -0,0 +1,58 @@
+// TestJsDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "readervc.h"
+#include "TestJsDlg.h"
+#include "../../include/fpdfformfill.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CTestJsDlg dialog
+
+
+CTestJsDlg::CTestJsDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CTestJsDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CTestJsDlg)
+ m_js = _T("");
+ //}}AFX_DATA_INIT
+}
+
+
+void CTestJsDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CTestJsDlg)
+ DDX_Text(pDX, IDC_EDIT1, m_js);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CTestJsDlg, CDialog)
+ //{{AFX_MSG_MAP(CTestJsDlg)
+ ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CTestJsDlg message handlers
+
+void CTestJsDlg::OnButton1()
+{
+ // TODO: Add your control notification handler code here
+ UpdateData(TRUE);
+ LPCTSTR lpStr = m_js.GetBuffer(m_js.GetLength());
+ int nLen = MultiByteToWideChar(CP_ACP, 0, lpStr, m_js.GetLength(), NULL, 0);
+ wchar_t* pbuf = new wchar_t[nLen+1];
+ MultiByteToWideChar(CP_ACP, 0, lpStr, m_js.GetLength(), pbuf, nLen);
+ pbuf[nLen] = 0;
+ m_js.ReleaseBuffer();
+// RunJS(m_handle,pbuf);
+ delete[] pbuf;
+}
diff --git a/xfa_test/FormFiller_Test/TestJsDlg.h b/xfa_test/FormFiller_Test/TestJsDlg.h
new file mode 100644
index 0000000000..b642937abe
--- /dev/null
+++ b/xfa_test/FormFiller_Test/TestJsDlg.h
@@ -0,0 +1,46 @@
+#if !defined(AFX_TESTJSDLG_H__084897F0_A03A_4D55_BDA2_98D40FB98A4F__INCLUDED_)
+#define AFX_TESTJSDLG_H__084897F0_A03A_4D55_BDA2_98D40FB98A4F__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// TestJsDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CTestJsDlg dialog
+
+class CTestJsDlg : public CDialog
+{
+// Construction
+public:
+ CTestJsDlg(CWnd* pParent = NULL); // standard constructor
+ void init(void* handle) {m_handle = handle;}
+// Dialog Data
+ //{{AFX_DATA(CTestJsDlg)
+ enum { IDD = IDD_TEST_JS };
+ CString m_js;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CTestJsDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ void * m_handle;
+ // Generated message map functions
+ //{{AFX_MSG(CTestJsDlg)
+ afx_msg void OnButton1();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TESTJSDLG_H__084897F0_A03A_4D55_BDA2_98D40FB98A4F__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/ZoomDlg.cpp b/xfa_test/FormFiller_Test/ZoomDlg.cpp
new file mode 100644
index 0000000000..65a19fe6f9
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ZoomDlg.cpp
@@ -0,0 +1,104 @@
+// ZoomDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ReaderVC.h"
+#include "ZoomDlg.h"
+
+#include "MainFrm.h"
+#include "ChildFrm.h"
+#include "ReaderVCView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CZoomDlg dialog
+
+
+CZoomDlg::CZoomDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CZoomDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CZoomDlg)
+ // NOTE: the ClassWizard will add member initialization here
+ //}}AFX_DATA_INIT
+}
+
+
+void CZoomDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CZoomDlg)
+ // NOTE: the ClassWizard will add DDX and DDV calls here
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CZoomDlg, CDialog)
+ //{{AFX_MSG_MAP(CZoomDlg)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CZoomDlg message handlers
+
+void CZoomDlg::OnCancel()
+{
+ // TODO: Add extra cleanup here
+
+ CDialog::OnCancel();
+}
+
+void CZoomDlg::OnOK()
+{
+ // TODO: Add extra validation here
+ CComboBox *pCmb = (CComboBox *)GetDlgItem(IDC_COMBO1);
+ int i = pCmb->GetCurSel();
+ int nScal = pCmb->GetItemData(i);
+ double dbScal = nScal / 100.0f;
+ m_pView->ScalPage(dbScal);
+ CDialog::OnOK();
+}
+
+BOOL CZoomDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // TODO: Add extra initialization here
+ m_pView = (CReaderVCView *)(((CChildFrame *)((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())->GetActiveView());
+ CComboBox *pCmb = (CComboBox *)GetDlgItem(IDC_COMBO1);
+ pCmb->AddString("-----25%-----");
+ pCmb->SetItemData(0, 25);
+ pCmb->AddString("-----50%-----");
+ pCmb->SetItemData(1, 50);
+ pCmb->AddString("-----75%-----");
+ pCmb->SetItemData(3, 75);
+ pCmb->AddString("-----100%----");
+ pCmb->SetItemData(3, 100);
+ pCmb->AddString("-----125%----");
+ pCmb->SetItemData(4, 125);
+ pCmb->AddString("-----200%----");
+ pCmb->SetItemData(5, 200);
+ pCmb->AddString("-----300%----");
+ pCmb->SetItemData(6, 300);
+ pCmb->AddString("-----400%----");
+ pCmb->SetItemData(7, 400);
+ pCmb->AddString("-----600%----");
+ pCmb->SetItemData(8, 600);
+ pCmb->AddString("-----800%----");
+ pCmb->SetItemData(9, 800);
+ pCmb->AddString("-----1200%----");
+ pCmb->SetItemData(10, 1200);
+ pCmb->AddString("-----1600%---");
+ pCmb->SetItemData(11, 160);
+ pCmb->AddString("-----3200%---");
+ pCmb->SetItemData(12, 3200);
+ pCmb->AddString("-----6400%----");
+ pCmb->SetItemData(13, 6400);
+ this->SetDlgItemTextA(IDC_COMBO1, "Select Zoom Factor");
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
diff --git a/xfa_test/FormFiller_Test/ZoomDlg.h b/xfa_test/FormFiller_Test/ZoomDlg.h
new file mode 100644
index 0000000000..15521c605e
--- /dev/null
+++ b/xfa_test/FormFiller_Test/ZoomDlg.h
@@ -0,0 +1,48 @@
+#if !defined(AFX_ZOOMDLG_H__B244E9E1_5278_4244_9D19_7307E1B76C15__INCLUDED_)
+#define AFX_ZOOMDLG_H__B244E9E1_5278_4244_9D19_7307E1B76C15__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ZoomDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CZoomDlg dialog
+class CReaderVCView;
+class CZoomDlg : public CDialog
+{
+// Construction
+public:
+ CZoomDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CZoomDlg)
+ enum { IDD = IDD_DLG_ZOOMTO };
+ // NOTE: the ClassWizard will add data members here
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CZoomDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ CReaderVCView *m_pView;
+ // Generated message map functions
+ //{{AFX_MSG(CZoomDlg)
+ virtual void OnCancel();
+ virtual void OnOK();
+ virtual BOOL OnInitDialog();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_ZOOMDLG_H__B244E9E1_5278_4244_9D19_7307E1B76C15__INCLUDED_)
diff --git a/xfa_test/FormFiller_Test/res/BigHandCursor.cur b/xfa_test/FormFiller_Test/res/BigHandCursor.cur
new file mode 100644
index 0000000000..c03bff08bd
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/BigHandCursor.cur
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/Rd_SelText_Icon.bmp b/xfa_test/FormFiller_Test/res/Rd_SelText_Icon.bmp
new file mode 100644
index 0000000000..0a2b2f4858
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/Rd_SelText_Icon.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/Rd_SelText_Icon_Dis.bmp b/xfa_test/FormFiller_Test/res/Rd_SelText_Icon_Dis.bmp
new file mode 100644
index 0000000000..6e0e6742c3
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/Rd_SelText_Icon_Dis.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/ReaderVC.ico b/xfa_test/FormFiller_Test/res/ReaderVC.ico
new file mode 100644
index 0000000000..7eef0bcbe6
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/ReaderVC.ico
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/ReaderVC.rc2 b/xfa_test/FormFiller_Test/res/ReaderVC.rc2
new file mode 100644
index 0000000000..c81833479a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/ReaderVC.rc2
@@ -0,0 +1,13 @@
+//
+// READERVC.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/xfa_test/FormFiller_Test/res/ReaderVCDoc.ico b/xfa_test/FormFiller_Test/res/ReaderVCDoc.ico
new file mode 100644
index 0000000000..2a1f1ae6ef
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/ReaderVCDoc.ico
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/SmallHandCursor.cur b/xfa_test/FormFiller_Test/res/SmallHandCursor.cur
new file mode 100644
index 0000000000..7bdff73ab3
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/SmallHandCursor.cur
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/Toolbar.bmp b/xfa_test/FormFiller_Test/res/Toolbar.bmp
new file mode 100644
index 0000000000..9598028a77
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/Toolbar.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/bookmark.bmp b/xfa_test/FormFiller_Test/res/bookmark.bmp
new file mode 100644
index 0000000000..c4a109cc7c
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/bookmark.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/bound.cur b/xfa_test/FormFiller_Test/res/bound.cur
new file mode 100644
index 0000000000..acb7f7a4bf
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/bound.cur
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/point.cur b/xfa_test/FormFiller_Test/res/point.cur
new file mode 100644
index 0000000000..deed42a4ed
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/point.cur
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_actual_size.bmp b/xfa_test/FormFiller_Test/res/tool_actual_size.bmp
new file mode 100644
index 0000000000..ae66eec0b5
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_actual_size.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_bookmark1.bmp b/xfa_test/FormFiller_Test/res/tool_bookmark1.bmp
new file mode 100644
index 0000000000..f8097551a9
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_bookmark1.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_clockwise.bmp b/xfa_test/FormFiller_Test/res/tool_clockwise.bmp
new file mode 100644
index 0000000000..2dc70bf8ca
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_clockwise.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_counterclockwise.bmp b/xfa_test/FormFiller_Test/res/tool_counterclockwise.bmp
new file mode 100644
index 0000000000..3b35661051
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_counterclockwise.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_first.bmp b/xfa_test/FormFiller_Test/res/tool_first.bmp
new file mode 100644
index 0000000000..30601ae878
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_first.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_fit_page.bmp b/xfa_test/FormFiller_Test/res/tool_fit_page.bmp
new file mode 100644
index 0000000000..04eaeb9240
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_fit_page.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_fit_width.bmp b/xfa_test/FormFiller_Test/res/tool_fit_width.bmp
new file mode 100644
index 0000000000..bd21478aba
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_fit_width.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hand1.bmp b/xfa_test/FormFiller_Test/res/tool_hand1.bmp
new file mode 100644
index 0000000000..9b15294df1
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hand1.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_about2.bmp b/xfa_test/FormFiller_Test/res/tool_hot_about2.bmp
new file mode 100644
index 0000000000..af274d42fa
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_about2.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_actual_size.bmp b/xfa_test/FormFiller_Test/res/tool_hot_actual_size.bmp
new file mode 100644
index 0000000000..6465e2158f
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_actual_size.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_bookmark1.bmp b/xfa_test/FormFiller_Test/res/tool_hot_bookmark1.bmp
new file mode 100644
index 0000000000..f73dd35999
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_bookmark1.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_clockwise.bmp b/xfa_test/FormFiller_Test/res/tool_hot_clockwise.bmp
new file mode 100644
index 0000000000..d48f3aab48
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_clockwise.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_counterclockwise.bmp b/xfa_test/FormFiller_Test/res/tool_hot_counterclockwise.bmp
new file mode 100644
index 0000000000..3539366bce
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_counterclockwise.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_first.bmp b/xfa_test/FormFiller_Test/res/tool_hot_first.bmp
new file mode 100644
index 0000000000..266018a79a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_first.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_first.xpm b/xfa_test/FormFiller_Test/res/tool_hot_first.xpm
new file mode 100644
index 0000000000..f89ac29059
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_first.xpm
@@ -0,0 +1,109 @@
+/* XPM */
+static char *tool_hot_first[] = {
+/* columns rows colors chars-per-pixel */
+"24 24 79 1",
+" c #3c659e",
+". c #3e689e",
+"X c #3b65a0",
+"o c #3e69a3",
+"O c #42679d",
+"+ c #466b9e",
+"@ c #4c6c9c",
+"# c #466ea3",
+"$ c #486da2",
+"% c #4473aa",
+"& c #4c74a6",
+"* c #4874ab",
+"= c #4b7aaf",
+"- c #4f7cb1",
+"; c #5072a3",
+": c #5678a7",
+"> c #527caf",
+", c #5c7da8",
+"< c green",
+"1 c #5d80ab",
+"2 c #5785b4",
+"3 c #5d88b6",
+"4 c #6487b0",
+"5 c #648db6",
+"6 c #678fba",
+"7 c #6c8eb5",
+"8 c #6593be",
+"9 c #6e90b5",
+"0 c #6e96bc",
+"q c #738aab",
+"w c #7b8da9",
+"e c #738cb0",
+"r c #7294b7",
+"t c #729abd",
+"y c #7a93b6",
+"u c #7e98ba",
+"i c #6694c0",
+"p c #759cc1",
+"a c #7c9fc3",
+"s c #74a1c6",
+"d c #76a4ca",
+"f c #7aa1c3",
+"g c #7ba7c9",
+"h c #7fa9cb",
+"j c #7faed0",
+"k c #8694ac",
+"l c #879db6",
+"z c #8a9db6",
+"x c #939daf",
+"c c #959fb1",
+"v c #8aa1b9",
+"b c #9ca4b3",
+"n c #a6acb6",
+"m c #b2b5ba",
+"M c #b8babd",
+"N c #87afcd",
+"B c #89b2cf",
+"V c #84b4d3",
+"C c #88b6d5",
+"Z c #91abc7",
+"A c #97b1cd",
+"S c #90bdda",
+"D c #a8b6cb",
+"F c #92c2dd",
+"G c #9cc8e0",
+"H c #a0c0d7",
+"J c #a6cfe6",
+"K c #a6d3e8",
+"L c #aad5ea",
+"P c #b0cfe2",
+"I c #b9dbeb",
+"U c #cac8c4",
+"Y c #c3dfed",
+"T c #c5e1ef",
+"R c #cbe2ef",
+"E c #d5e4ef",
+"W c #d2e7f2",
+"Q c #e8f6fa",
+"! c #feffff",
+/* pixels */
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<zlvz<<<<<<<<<<D<<<<<",
+"<<<<7NKp<<<<<<<<<k,<<<<<",
+"<<<<rCLa<<<<<<<<wNN<<<<<",
+"<<<<9hGt<<<<<<MqBKf<<<<<",
+"<<<<7gF0<<<<<nePJS0<<<<<",
+"<<<<7sV5<<<<xuWICV5<<<<<",
+"<<<<40d><<UkZQYVjd1<<<<<",
+"<<<<138><<kA!RVVd8><<<<<",
+"<<<<:>3&<<nyETVd83&<<<<<",
+"<<<<;*-$<<<mqHSi2>#<<<<<",
+"<<<<&#*+<<<<<q68-*#<<<<<",
+"<<<<@o%+<<<<<Uw&=%#<<<<<",
+"<<<<+X%+<<<<<<<k#%#<<<<<",
+"<<<<OX%.<<<<<<<<c+ <<<<<",
+"<<<<@ +@<<<<<<<<<b@<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<",
+"<<<<<<<<<<<<<<<<<<<<<<<<"
+};
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_fit_page.bmp b/xfa_test/FormFiller_Test/res/tool_hot_fit_page.bmp
new file mode 100644
index 0000000000..062cfcd90a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_fit_page.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_fit_width.bmp b/xfa_test/FormFiller_Test/res/tool_hot_fit_width.bmp
new file mode 100644
index 0000000000..07028eed44
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_fit_width.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_hand1.bmp b/xfa_test/FormFiller_Test/res/tool_hot_hand1.bmp
new file mode 100644
index 0000000000..d9d4a13a6a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_hand1.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_last.bmp b/xfa_test/FormFiller_Test/res/tool_hot_last.bmp
new file mode 100644
index 0000000000..9e63f72541
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_last.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_next.bmp b/xfa_test/FormFiller_Test/res/tool_hot_next.bmp
new file mode 100644
index 0000000000..494058444e
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_next.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_open1.bmp b/xfa_test/FormFiller_Test/res/tool_hot_open1.bmp
new file mode 100644
index 0000000000..353fade330
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_open1.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_prev.bmp b/xfa_test/FormFiller_Test/res/tool_hot_prev.bmp
new file mode 100644
index 0000000000..e83f29e338
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_prev.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_print.bmp b/xfa_test/FormFiller_Test/res/tool_hot_print.bmp
new file mode 100644
index 0000000000..e25ef8075a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_print.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_search.bmp b/xfa_test/FormFiller_Test/res/tool_hot_search.bmp
new file mode 100644
index 0000000000..a86b8d46da
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_search.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_snap_shot.bmp b/xfa_test/FormFiller_Test/res/tool_hot_snap_shot.bmp
new file mode 100644
index 0000000000..1552272429
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_snap_shot.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_zoomin.bmp b/xfa_test/FormFiller_Test/res/tool_hot_zoomin.bmp
new file mode 100644
index 0000000000..48cb3c958d
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_zoomin.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_hot_zoomout.bmp b/xfa_test/FormFiller_Test/res/tool_hot_zoomout.bmp
new file mode 100644
index 0000000000..02c37e468a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_hot_zoomout.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_last.bmp b/xfa_test/FormFiller_Test/res/tool_last.bmp
new file mode 100644
index 0000000000..4ac5be89fc
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_last.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_next.bmp b/xfa_test/FormFiller_Test/res/tool_next.bmp
new file mode 100644
index 0000000000..b77cc70dde
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_next.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_prev.bmp b/xfa_test/FormFiller_Test/res/tool_prev.bmp
new file mode 100644
index 0000000000..c2b2e377ec
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_prev.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_print.bmp b/xfa_test/FormFiller_Test/res/tool_print.bmp
new file mode 100644
index 0000000000..257f650adb
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_print.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_search.bmp b/xfa_test/FormFiller_Test/res/tool_search.bmp
new file mode 100644
index 0000000000..aad8b91f03
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_search.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_snap_shot.bmp b/xfa_test/FormFiller_Test/res/tool_snap_shot.bmp
new file mode 100644
index 0000000000..419efe4547
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_snap_shot.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_zoomin.bmp b/xfa_test/FormFiller_Test/res/tool_zoomin.bmp
new file mode 100644
index 0000000000..ddcf4c2ed8
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_zoomin.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/res/tool_zoomout.bmp b/xfa_test/FormFiller_Test/res/tool_zoomout.bmp
new file mode 100644
index 0000000000..6fbd1de184
--- /dev/null
+++ b/xfa_test/FormFiller_Test/res/tool_zoomout.bmp
Binary files differ
diff --git a/xfa_test/FormFiller_Test/resource.h b/xfa_test/FormFiller_Test/resource.h
new file mode 100644
index 0000000000..fab1e6b28a
--- /dev/null
+++ b/xfa_test/FormFiller_Test/resource.h
@@ -0,0 +1,113 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by ReaderVC.rc
+//
+#define IDD_ABOUTBOX 100
+#define IDR_MAINFRAME 128
+#define IDR_READERTYPE 129
+#define IDD_DLG_GOTOPAGE 130
+#define IDD_DLG_ZOOMTO 131
+#define IDD_DLG_FIND 132
+#define IDC_CURSOR1 133
+#define IDC_CURSOR2 134
+#define IDC_CURSOR3 135
+#define IDC_CURSOR4 136
+#define IDB_BITMAP1 215
+#define IDB_BITMAP2 216
+#define IDB_BITMAP3 217
+#define IDB_BITMAP4 218
+#define IDB_BITMAP5 219
+#define IDB_BITMAP6 220
+#define IDB_BITMAP7 221
+#define IDB_BITMAP8 222
+#define IDB_BITMAP9 223
+#define IDB_BITMAP10 224
+#define IDB_BITMAP11 225
+#define IDB_BITMAP12 226
+#define IDB_BITMAP13 227
+#define IDB_BITMAP14 228
+#define IDB_BITMAP15 229
+#define IDB_BITMAP16 230
+#define IDB_BITMAP17 231
+#define IDB_BITMAP18 232
+#define IDB_BITMAP19 233
+#define IDB_BITMAP20 234
+#define IDB_BITMAP21 235
+#define IDB_BITMAP22 236
+#define IDB_BITMAP23 237
+#define IDB_BITMAP24 238
+#define IDB_BITMAP26 240
+#define IDB_BITMAP27 241
+#define IDB_BITMAP28 242
+#define IDB_BITMAP29 243
+#define IDB_BITMAP30 244
+#define IDB_BITMAP31 245
+#define IDB_BITMAP32 246
+#define IDB_BITMAP33 247
+#define IDB_BITMAP34 248
+#define IDB_BITMAP25 249
+#define IDB_BITMAP35 250
+#define IDB_BITMAP36 251
+#define IDD_DLG_CONVERT 252
+#define IDD_EXPORT_PAGE 253
+#define IDD_DLG_RESPONSE 255
+#define IDD_TEST_JS 256
+#define IDC_EDIT1 1000
+#define IDC_COMBO1 1002
+#define IDC_CHECK_MATCHCASE 1003
+#define IDC_CHECK_MATCHWHOLE 1004
+#define IDC_RADIO_Down 1005
+#define IDC_RADIO_UP 1006
+#define IDC_RADIO_Stream 1007
+#define IDC_RADIO_Appearance 1008
+#define IDC_Rander_Page 1009
+#define IDC_Save 1010
+#define IDC_EDIT_PAGE_HEIGHT 1011
+#define IDC_EDIT_ROTATE 1012
+#define IDC_EDIT_WIDTH 1013
+#define IDC_EDIT_HEIGHT 1014
+#define IDC_EDIT_PAGE_WIDTH 1015
+#define IDC_STATIC_BITMAP 1016
+#define ID_JS_OK 1017
+#define ID_JS_CANCEL 1018
+#define IDC_JS_QUESTION 1019
+#define IDC_JS_ANSWER 1020
+#define IDC_BUTTON1 1021
+#define ID_VIEW_ZOOMIN 32772
+#define ID_VIEW_ZOOMOUT 32773
+#define ID_VIEW_ZOOMTO 32774
+#define ID_VIEW_ACTUALSIZE 32775
+#define ID_VIEW_FITPAGE 32776
+#define ID_VIEW_FITWIDTH 32777
+#define ID_DOC_FIRSTPAGE 32778
+#define ID_DOC_PREPAGE 32779
+#define ID_DOC_NEXTPAGE 32780
+#define ID_DOC_LASTPAGE 32781
+#define ID_DOC_GOTOPAGE 32782
+#define ID_VIEW_CLOCKWISE 32784
+#define ID_VIEW_COUNTERCLOCKWISE 32785
+#define ID_TOOL_HAND 32788
+#define ID_TOOL_SELECT 32789
+#define ID_TOOL_SNAPSHOT 32790
+#define ID_TOOL_PDF2TXT 32791
+#define ID_TOOL_EXTRACTLINKS 32792
+#define ID_DOC_EDITGOTO 32793
+#define ID_VIEW_BOOKMARK 32794
+#define ID_TOOL_PAGETOTEXT 32795
+#define ID_RENDERBITMAP 32799
+#define ID_EXPORT_PDF_TO_BITMAP 32800
+#define IDM_Test_JS 32801
+#define IDC_JS_EDIT 32802
+#define TEST_PRINT_METALFILE 32803
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 257
+#define _APS_NEXT_COMMAND_VALUE 32803
+#define _APS_NEXT_CONTROL_VALUE 1022
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif