Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ |
| 8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "../../core/include/fpdftext/fpdf_text.h" | 12 #include "../../core/include/fpdftext/fpdf_text.h" |
| 13 #include "../../public/fpdf_formfill.h" | 13 #include "../../public/fpdf_formfill.h" |
| 14 #include "../../public/fpdf_fwlevent.h" // cross platform keycode and events def ine. | 14 #include "../../public/fpdf_fwlevent.h" // cross platform keycode and events def ine. |
| 15 #include "fsdk_common.h" | 15 #include "fsdk_common.h" |
| 16 #include "fsdk_define.h" | 16 #include "fsdk_define.h" |
| 17 #include "fx_systemhandler.h" | 17 #include "fx_systemhandler.h" |
| 18 #include "fsdk_baseannot.h" | 18 #include "fsdk_baseannot.h" |
| 19 #include "fsdk_baseform.h" | 19 #include "fsdk_baseform.h" |
| 20 #include "fsdk_annothandler.h" | 20 #include "fsdk_annothandler.h" |
| 21 #include "fsdk_actionhandler.h" | 21 #include "fsdk_actionhandler.h" |
| 22 #include "javascript/IJavaScript.h" | 22 #include "javascript/IJavaScript.h" |
| 23 | 23 |
| 24 class CFFL_IFormFiller; | |
| 25 class CJS_RuntimeFactory; | |
| 26 class CPDFSDK_ActionHandler; | |
| 27 class CPDFSDK_Annot; | |
| 24 class CPDFSDK_Document; | 28 class CPDFSDK_Document; |
| 29 class CPDFSDK_InterForm; | |
| 25 class CPDFSDK_PageView; | 30 class CPDFSDK_PageView; |
| 26 class CPDFSDK_Annot; | |
| 27 class CFFL_IFormFiller; | |
| 28 class CPDFSDK_Widget; | 31 class CPDFSDK_Widget; |
| 29 class IFX_SystemHandler; | 32 class IFX_SystemHandler; |
| 30 class CPDFSDK_ActionHandler; | |
| 31 class CJS_RuntimeFactory; | |
| 32 | 33 |
| 33 class CPDFDoc_Environment final | 34 class CPDFDoc_Environment final |
| 34 { | 35 { |
| 35 public: | 36 public: |
| 36 » CPDFDoc_Environment(CPDF_Document * pDoc); | 37 CPDFDoc_Environment(CPDF_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo); |
| 37 » ~CPDFDoc_Environment(); | 38 ~CPDFDoc_Environment(); |
| 38 | 39 |
| 39 » int RegAppHandle(FPDF_FORMFILLINFO* pFFinfo); | 40 void FFI_Invalidate(FPDF_PAGE page, double left, double top, double right, d ouble bottom) |
|
Tom Sepez
2015/07/16 18:01:27
Note to self: RegAppHandle removed, now part of ct
| |
| 40 | 41 { |
| 41 » void FFI_Invalidate(FPDF_PAGE page, double left, double top, double righ t, double bottom) | 42 if (m_pInfo && m_pInfo->FFI_Invalidate) |
| 42 » { | 43 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); |
| 43 » » if (m_pInfo && m_pInfo->FFI_Invalidate) | 44 } |
| 44 » » { | 45 |
| 45 » » » m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); | 46 void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, double right, double bottom) |
| 46 » » } | 47 { |
| 47 » } | 48 if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) |
| 48 » void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, dou ble right, double bottom) | 49 m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bot tom); |
| 49 » { | 50 } |
| 50 » » if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) | 51 |
| 51 » » { | 52 void FFI_SetCursor(int nCursorType) |
| 52 » » » m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top , right, bottom); | 53 { |
| 53 » » } | 54 if (m_pInfo && m_pInfo->FFI_SetCursor) |
| 54 » } | 55 m_pInfo->FFI_SetCursor(m_pInfo, nCursorType); |
| 55 | 56 } |
| 56 » void FFI_SetCursor(int nCursorType) | 57 |
| 57 » { | 58 int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc) |
| 58 » » if (m_pInfo && m_pInfo->FFI_SetCursor) | 59 { |
| 59 » » { | 60 if (m_pInfo && m_pInfo->FFI_SetTimer) |
| 60 » » » m_pInfo->FFI_SetCursor(m_pInfo, nCursorType); | 61 return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc); |
| 61 » » } | 62 return -1; |
| 62 » } | 63 } |
| 63 | 64 |
| 64 » int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc) | 65 void FFI_KillTimer(int nTimerID) |
| 65 » { | 66 { |
| 66 » » if (m_pInfo && m_pInfo->FFI_SetTimer) | 67 if (m_pInfo && m_pInfo->FFI_KillTimer) |
| 67 » » { | 68 m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); |
| 68 » » » return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFu nc); | 69 } |
| 69 » » } | 70 |
| 70 » » return -1; | 71 FX_SYSTEMTIME FFI_GetLocalTime() const |
| 71 » } | 72 { |
| 72 | 73 FX_SYSTEMTIME fxtime; |
| 73 » void FFI_KillTimer(int nTimerID) | 74 if (m_pInfo && m_pInfo->FFI_GetLocalTime) |
| 74 » { | 75 { |
| 75 » » if (m_pInfo && m_pInfo->FFI_KillTimer) | 76 FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo); |
| 76 » » { | 77 fxtime.wDay = systime.wDay; |
| 77 » » » m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); | 78 fxtime.wDayOfWeek = systime.wDayOfWeek; |
| 78 » » } | 79 fxtime.wHour = systime.wHour; |
| 79 » } | 80 fxtime.wMilliseconds = systime.wMilliseconds; |
| 80 » FX_SYSTEMTIME FFI_GetLocalTime() | 81 fxtime.wMinute = systime.wMinute; |
| 81 » { | 82 fxtime.wMonth = systime.wMonth; |
| 82 » » FX_SYSTEMTIME fxtime; | 83 fxtime.wSecond = systime.wSecond; |
| 83 » » if(m_pInfo && m_pInfo->FFI_GetLocalTime) | 84 fxtime.wYear = systime.wYear; |
| 84 » » { | 85 } |
| 85 » » » FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pI nfo); | 86 return fxtime; |
| 86 » » » fxtime.wDay = systime.wDay; | 87 } |
| 87 » » » fxtime.wDayOfWeek = systime.wDayOfWeek; | 88 |
| 88 » » » fxtime.wHour = systime.wHour; | 89 void FFI_OnChange() |
| 89 » » » fxtime.wMilliseconds = systime.wMilliseconds; | 90 { |
| 90 » » » fxtime.wMinute = systime.wMinute; | 91 if (m_pInfo && m_pInfo->FFI_OnChange) |
| 91 » » » fxtime.wMonth = systime.wMonth; | 92 m_pInfo->FFI_OnChange(m_pInfo); |
| 92 » » » fxtime.wSecond = systime.wSecond; | 93 } |
| 93 » » » fxtime.wYear = systime.wYear; | 94 |
| 94 » » } | 95 FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) const |
| 95 » » return fxtime; | 96 { |
| 96 » } | 97 return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; |
| 97 | 98 } |
| 98 » void FFI_OnChange() | 99 |
| 99 » { | 100 FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) const |
| 100 » » if(m_pInfo && m_pInfo->FFI_OnChange) | 101 { |
| 101 » » { | 102 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; |
| 102 » » » m_pInfo->FFI_OnChange(m_pInfo); | 103 } |
| 103 » » } | 104 |
| 104 » } | 105 FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) const |
| 105 | 106 { |
| 106 » FX_BOOL»FFI_IsSHIFTKeyDown(FX_DWORD nFlag) | 107 return (nFlag & FWL_EVENTFLAG_AltKey) != 0; |
| 107 » { | 108 } |
| 108 | 109 |
| 109 » » return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; | 110 FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) const |
| 110 » } | 111 { |
| 111 » FX_BOOL»FFI_IsCTRLKeyDown(FX_DWORD nFlag) | 112 return FALSE; |
| 112 » { | 113 } |
| 113 | 114 |
| 114 » » return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; | 115 int JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, FX_UINT Type, FX _UINT Icon); |
| 115 » } | 116 int JS_appResponse(const FX_WCHAR* Question, const FX_WCHAR* Title, const FX _WCHAR* Default, |
| 116 » FX_BOOL»FFI_IsALTKeyDown(FX_DWORD nFlag) | 117 const FX_WCHAR* cLabel, FPDF_BOOL bPassword, void* respon se, int length); |
| 117 » { | 118 |
| 118 | 119 void JS_appBeep(int nType) |
| 119 » » return (nFlag & FWL_EVENTFLAG_AltKey) != 0; | 120 { |
| 120 » } | 121 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_bee p) |
| 121 » FX_BOOL»FFI_IsINSERTKeyDown(FX_DWORD nFlag) | 122 m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); |
| 122 » { | 123 } |
| 123 » » return FALSE; | |
| 124 » } | |
| 125 | |
| 126 » int JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, FX_UINT Type , FX_UINT Icon) | |
| 127 » { | |
| 128 » » if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> app_alert) | |
| 129 » » { | |
| 130 » » » CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encod e(); | |
| 131 » » » CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_E ncode(); | |
| 132 » » » FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer( bsMsg.GetLength()); | |
| 133 » » » FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuf fer(bsTitle.GetLength()); | |
| 134 » » » int ret = m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_p JsPlatform, pMsg, pTitle, Type, Icon); | |
| 135 » » » bsMsg.ReleaseBuffer(); | |
| 136 » » » bsTitle.ReleaseBuffer(); | |
| 137 » » » return ret; | |
| 138 » » } | |
| 139 » » return -1; | |
| 140 » } | |
| 141 | |
| 142 » int JS_appResponse(const FX_WCHAR* Question, const FX_WCHAR* Title, cons t FX_WCHAR* Default, const FX_WCHAR* cLabel, FPDF_BOOL bPassword, void* response , int length) | |
| 143 » { | |
| 144 » » if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform- >app_response) | |
| 145 » » { | |
| 146 » » » CFX_ByteString bsQuestion = CFX_WideString(Question).UTF 16LE_Encode(); | |
| 147 » » » CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_E ncode(); | |
| 148 » » » CFX_ByteString bsDefault = CFX_WideString(Default).UTF16 LE_Encode(); | |
| 149 » » » CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_ Encode(); | |
| 150 » » » FPDF_WIDESTRING pQuestion = (FPDF_WIDESTRING)bsQuestion. GetBuffer(bsQuestion.GetLength()); | |
| 151 » » » FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuf fer(bsTitle.GetLength()); | |
| 152 » » » FPDF_WIDESTRING pDefault = (FPDF_WIDESTRING)bsDefault.Ge tBuffer(bsDefault.GetLength()); | |
| 153 » » » FPDF_WIDESTRING pLabel = (FPDF_WIDESTRING)bsLabel.GetBuf fer(bsLabel.GetLength()); | |
| 154 » » » int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo-> m_pJsPlatform, pQuestion, pTitle, | |
| 155 » » » » pDefault, pLabel, bPassword, response, length); | |
| 156 » » » bsQuestion.ReleaseBuffer(); | |
| 157 » » » bsTitle.ReleaseBuffer(); | |
| 158 » » » bsDefault.ReleaseBuffer(); | |
| 159 » » » bsLabel.ReleaseBuffer(); | |
| 160 » » » return ret; | |
| 161 » » } | |
| 162 » » return -1; | |
| 163 » } | |
| 164 | |
| 165 » void JS_appBeep(int nType) | |
| 166 » { | |
| 167 » » if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> app_beep) | |
| 168 » » { | |
| 169 » » » m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); | |
| 170 » » } | |
| 171 » } | |
| 172 | 124 |
| 173 CFX_WideString JS_fieldBrowse(); | 125 CFX_WideString JS_fieldBrowse(); |
| 174 | |
| 175 CFX_WideString JS_docGetFilePath(); | 126 CFX_WideString JS_docGetFilePath(); |
| 176 | 127 |
| 177 » void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL) | 128 void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL); |
| 178 » { | 129 void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI, |
| 179 » » if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_submitForm) | 130 const FX_WCHAR* To, const FX_WCHAR* Subject, |
| 180 » » { | 131 const FX_WCHAR* CC, const FX_WCHAR* BCC, |
| 181 » » » CFX_ByteString bsDestination = CFX_WideString(URL).UTF16 LE_Encode(); | 132 const FX_WCHAR* Msg); |
| 182 » » » FPDF_WIDESTRING pDestination = (FPDF_WIDESTRING)bsDestin ation.GetBuffer(bsDestination.GetLength()); | 133 |
| 183 » » » m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPla tform, formData, length, pDestination); | 134 void JS_docprint(FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent, |
| 184 » » » bsDestination.ReleaseBuffer(); | 135 FPDF_BOOL bShrinkToFit, FPDF_BOOL bPrintAsImage, |
| 185 » » } | 136 FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations) |
| 186 » } | 137 { |
| 187 | 138 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_pri nt) |
| 188 » void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,const FX_W CHAR* To, const FX_WCHAR* Subject, const FX_WCHAR* CC, const FX_WCHAR* BCC, cons t FX_WCHAR* Msg) | 139 m_pInfo->m_pJsPlatform->Doc_print( |
| 189 » { | 140 m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, bSilent, bShrinkToFit , |
| 190 » » if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_mail) | 141 bPrintAsImage, bReverse, bAnnotations); |
| 191 » » { | 142 } |
| 192 » » » CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode( ); | 143 |
| 193 » » » CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_En code(); | 144 void JS_docgotoPage(int nPageNum) |
| 194 » » » CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encod e(); | 145 { |
| 195 » » » CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16 LE_Encode(); | 146 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_got oPage) |
| 196 » » » CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encod e(); | 147 m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNu m); |
| 197 » » » FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bs To.GetLength()); | 148 } |
| 198 » » » FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bs CC.GetLength()); | 149 |
| 199 » » » FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer( bsBcc.GetLength()); | 150 FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) |
| 200 » » » FPDF_WIDESTRING pSubject = (FPDF_WIDESTRING)bsSubject.Ge tBuffer(bsSubject.GetLength()); | 151 { |
| 201 » » » FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer( bsMsg.GetLength()); | 152 if (m_pInfo && m_pInfo->FFI_GetPage) |
| 202 » » » m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform, mailData, length, bUI, pTo, pSubject, | 153 return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex); |
| 203 » » » » pCC, pBcc, pMsg); | 154 return NULL; |
| 204 » » » bsTo.ReleaseBuffer(); | 155 } |
| 205 » » » bsCC.ReleaseBuffer(); | 156 |
| 206 » » » bsBcc.ReleaseBuffer(); | 157 FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) |
| 207 » » » bsSubject.ReleaseBuffer(); | 158 { |
| 208 » » » bsMsg.ReleaseBuffer(); | 159 if (m_pInfo && m_pInfo->FFI_GetCurrentPage) |
| 209 » » } | 160 return m_pInfo->FFI_GetCurrentPage(m_pInfo, document); |
| 210 » } | 161 return NULL; |
| 211 | 162 } |
| 212 » void JS_docprint(FPDF_BOOL bUI , int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations) | 163 |
| 213 » { | 164 int FFI_GetRotation(FPDF_PAGE page) |
| 214 » » if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_print) | 165 { |
| 215 » » { | 166 if (m_pInfo && m_pInfo->FFI_GetRotation) |
| 216 » » » m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform , bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotation s); | 167 return m_pInfo->FFI_GetRotation(m_pInfo, page); |
| 217 » » } | 168 return 0; |
| 218 » } | 169 } |
| 219 » void JS_docgotoPage(int nPageNum) | 170 |
| 220 » { | 171 void FFI_ExecuteNamedAction(const FX_CHAR* namedAction) |
| 221 » » if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_gotoPage) | 172 { |
| 222 » » { | 173 if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) |
| 223 » » » m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatf orm, nPageNum); | 174 m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); |
| 224 » » } | 175 } |
| 225 » } | 176 |
| 226 | 177 void FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DW ORD nTextLen, FX_BOOL bFocus) |
| 227 » FPDF_PAGE» FFI_GetPage(FPDF_DOCUMENT document,int nPageIndex) | 178 { |
| 228 » { | 179 if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) |
| 229 » » if(m_pInfo && m_pInfo->FFI_GetPage) | 180 m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus) ; |
| 230 » » { | 181 } |
| 231 » » » return m_pInfo->FFI_GetPage(m_pInfo, document, nPageInde x); | 182 |
| 232 » » } | 183 void FFI_DoURIAction(const FX_CHAR* bsURI) |
| 233 » » return NULL; | 184 { |
| 234 » } | 185 if (m_pInfo && m_pInfo->FFI_DoURIAction) |
| 235 | 186 m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); |
| 236 » FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) | 187 } |
| 237 » { | 188 |
| 238 » » if(m_pInfo && m_pInfo->FFI_GetCurrentPage) | 189 void FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int si zeOfArray) |
| 239 » » { | 190 { |
| 240 » » » return m_pInfo->FFI_GetCurrentPage(m_pInfo, document); | 191 if (m_pInfo && m_pInfo->FFI_DoGoToAction) |
| 241 » » } | 192 m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray); |
| 242 » » return NULL; | 193 } |
| 243 » } | 194 |
| 244 | 195 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } |
| 245 » int » FFI_GetRotation(FPDF_PAGE page) | 196 void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } |
| 246 » { | 197 CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } |
| 247 » » if(m_pInfo && m_pInfo->FFI_GetRotation) | 198 CPDF_Document* GetPDFDocument() const { return m_pPDFDoc; } |
| 248 » » { | 199 CFX_ByteString GetAppName() const { return ""; } |
| 249 » » » return m_pInfo->FFI_GetRotation(m_pInfo, page); | 200 IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler; } |
| 250 » » } | 201 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo;} |
| 251 » » return 0; | 202 CJS_RuntimeFactory* GetRuntimeFactory() const { return m_pJSRuntimeFactory; } |
| 252 » } | 203 |
| 253 » void» FFI_ExecuteNamedAction(const FX_CHAR* namedAction) | 204 CFFL_IFormFiller* GetIFormFiller(); // Creates if not present. |
| 254 » { | 205 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. |
| 255 » » if(m_pInfo && m_pInfo->FFI_ExecuteNamedAction) | 206 IFXJS_Runtime* GetJSRuntime(); // Creates if not present. |
| 256 » » { | 207 CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. |
| 257 » » » m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); | |
| 258 » » } | |
| 259 » } | |
| 260 » void» FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, FX_BOOL bFocus) | |
| 261 » { | |
| 262 » » if(m_pInfo && m_pInfo->FFI_SetTextFieldFocus) | |
| 263 » » { | |
| 264 » » » m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nText Len, bFocus); | |
| 265 » » } | |
| 266 » } | |
| 267 | |
| 268 » void» FFI_DoURIAction(const FX_CHAR* bsURI) | |
| 269 » { | |
| 270 » » if(m_pInfo && m_pInfo->FFI_DoURIAction) | |
| 271 » » { | |
| 272 » » » m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); | |
| 273 » » } | |
| 274 » } | |
| 275 | |
| 276 » void» FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int sizeOfArray) | |
| 277 » { | |
| 278 » » if(m_pInfo && m_pInfo->FFI_DoGoToAction) | |
| 279 » » { | |
| 280 » » » m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray); | |
| 281 » » } | |
| 282 » } | |
| 283 | |
| 284 » FX_BOOL»» » » IsJSInitiated(); | |
| 285 | |
| 286 » void» » » » SetCurrentDoc(CPDFSDK_Document* pFXDoc) {m_pSDKDoc = pFXDoc;} | |
| 287 » CPDFSDK_Document*» GetCurrentDoc(); | |
| 288 » CPDF_Document*» » GetPDFDocument() {return m_pPDFDoc;} | |
| 289 | |
| 290 » CFX_ByteString» » GetAppName() {return "";} | |
| 291 | |
| 292 » CFFL_IFormFiller*» GetIFormFiller(); | |
| 293 » IFX_SystemHandler*» GetSysHandler() {return m_pSysHandler;} | |
| 294 | |
| 295 » CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); | |
| 296 » IFXJS_Runtime*» GetJSRuntime(); | |
| 297 » CPDFSDK_ActionHandler* GetActionHander(); | |
| 298 » FPDF_FORMFILLINFO* GetFormFillInfo() {return m_pInfo;} | |
| 299 | 208 |
| 300 private: | 209 private: |
| 301 » CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr; | 210 CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr; |
| 302 » CPDFSDK_ActionHandler*» m_pActionHandler; | 211 CPDFSDK_ActionHandler* m_pActionHandler; |
| 303 » IFXJS_Runtime*» m_pJSRuntime; | 212 IFXJS_Runtime* m_pJSRuntime; |
| 304 » FPDF_FORMFILLINFO*» m_pInfo; | 213 FPDF_FORMFILLINFO* const m_pInfo; |
| 305 » CPDFSDK_Document* m_pSDKDoc; | 214 CPDFSDK_Document* m_pSDKDoc; |
| 306 » CPDF_Document* m_pPDFDoc; | 215 CPDF_Document* const m_pPDFDoc; |
| 307 | 216 CFFL_IFormFiller* m_pIFormFiller; |
| 308 » CFFL_IFormFiller* m_pIFormFiller; | 217 IFX_SystemHandler* m_pSysHandler; |
| 309 » IFX_SystemHandler* m_pSysHandler; | 218 CJS_RuntimeFactory* m_pJSRuntimeFactory; |
| 310 | |
| 311 public: | |
| 312 » CJS_RuntimeFactory* m_pJSRuntimeFactory; | |
| 313 }; | 219 }; |
| 314 | 220 |
| 315 | |
| 316 | |
| 317 class CPDFSDK_InterForm; | |
| 318 class CPDFSDK_Document | 221 class CPDFSDK_Document |
| 319 { | 222 { |
| 320 public: | 223 public: |
| 321 » CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv); | 224 CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv); |
| 322 » ~CPDFSDK_Document(); | 225 ~CPDFSDK_Document(); |
| 323 | 226 |
| 324 » CPDFSDK_InterForm*» » GetInterForm() ; | 227 CPDFSDK_InterForm* GetInterForm() ; |
| 325 » CPDF_Document*» » » GetDocument() {return m_pDoc;} | 228 CPDF_Document* GetDocument() {return m_pDoc;} |
| 326 | 229 |
| 327 » CPDFSDK_PageView*» » GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE); | 230 CPDFSDK_PageView* GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRU E); |
| 328 » CPDFSDK_PageView*» » GetPageView(int nIndex); | 231 CPDFSDK_PageView* GetPageView(int nIndex); |
| 329 » CPDFSDK_PageView*» » GetCurrentView(); | 232 CPDFSDK_PageView* GetCurrentView(); |
| 330 » void» » » » » ReMovePageView(CPDF_Page* pPDFPa ge); | 233 void ReMovePageView(CPDF_Page* pPDFPage); |
| 331 » void» » » » » UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); | 234 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_An not* pAnnot); |
| 332 | 235 |
| 333 » CPDFSDK_Annot*» » » GetFocusAnnot(); | 236 CPDFSDK_Annot* GetFocusAnnot(); |
| 334 | 237 |
| 335 » IFXJS_Runtime *»» » GetJsRuntime(); | 238 IFXJS_Runtime * GetJsRuntime(); |
| 336 | 239 |
| 337 » FX_BOOL»» » » » SetFocusAnnot(CPDFSDK_Annot* pAn not, FX_UINT nFlag = 0); | 240 FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0); |
| 338 » FX_BOOL»» » » » KillFocusAnnot(FX_UINT nFlag = 0 ); | 241 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0); |
| 339 | 242 |
| 340 » FX_BOOL»» » » » ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_Document* pDstDoc); | 243 FX_BOOL ExtractPages(const CFX_WordArray &arrExtraPages, CPD F_Document* pDstDoc); |
| 341 » FX_BOOL»» » » » InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages); | 244 FX_BOOL InsertPages(int nInsertAt, const CPDF_Document* pSrc Doc, const CFX_WordArray &arrSrcPages); |
| 342 » FX_BOOL»» » » » ReplacePages(int nPage, const CP DF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages); | 245 FX_BOOL ReplacePages(int nPage, const CPDF_Document* pSrcDoc , const CFX_WordArray &arrSrcPages); |
| 343 | 246 |
| 344 » void» » » » » OnCloseDocument(); | 247 void OnCloseDocument(); |
| 345 | 248 |
| 346 » int» » » » » » GetPageCount() {return m _pDoc->GetPageCount();} | 249 int GetPageCount() {return m_pDoc->GetPageCount();} |
| 347 » FX_BOOL»» » » » GetPermissions(int nFlag); | 250 FX_BOOL GetPermissions(int nFlag); |
| 348 » FX_BOOL»» » » » GetChangeMark() {return m_bChang eMask;} | 251 FX_BOOL GetChangeMark() {return m_bChangeMask;} |
| 349 » void» » » » » SetChangeMark() {m_bChangeMask = TRUE;} | 252 void SetChangeMark() {m_bChangeMask = TRUE;} |
| 350 » void» » » » » ClearChangeMark() {m_bChangeMask = FALSE;} | 253 void ClearChangeMark() {m_bChangeMask= FALSE;} |
| 351 » CFX_WideString» » » GetPath() ; | 254 CFX_WideString GetPath() ; |
| 352 » CPDF_Page*» » » » GetPage(int nIndex); | 255 CPDF_Page* GetPage(int nIndex); |
| 353 » CPDFDoc_Environment *» GetEnv() {return m_pEnv; } | 256 CPDFDoc_Environment * GetEnv() {return m_pEnv; } |
| 354 » void» » » » ProcJavascriptFun(); | 257 void ProcJavascriptFun(); |
| 355 » FX_BOOL»» » » » ProcOpenAction(); | 258 FX_BOOL ProcOpenAction(); |
| 356 » CPDF_OCContext*»» » GetOCContext(); | 259 CPDF_OCContext* GetOCContext(); |
| 357 private: | 260 private: |
| 358 std::map<CPDF_Page*, CPDFSDK_PageView*> m_pageMap; | 261 std::map<CPDF_Page*, CPDFSDK_PageView*> m_pageMap; |
| 359 CPDF_Document* m_pDoc; | 262 CPDF_Document* m_pDoc; |
| 360 CPDFSDK_InterForm* m_pInterForm; | 263 CPDFSDK_InterForm* m_pInterForm; |
| 361 CPDFSDK_Annot* m_pFocusAnnot; | 264 CPDFSDK_Annot* m_pFocusAnnot; |
| 362 CPDFDoc_Environment* m_pEnv; | 265 CPDFDoc_Environment* m_pEnv; |
| 363 CPDF_OCContext* m_pOccontent; | 266 CPDF_OCContext* m_pOccontent; |
| 364 FX_BOOL m_bChangeMask; | 267 FX_BOOL m_bChangeMask; |
| 365 }; | 268 }; |
| 366 class CPDFSDK_PageView final | 269 class CPDFSDK_PageView final |
| 367 { | 270 { |
| 368 public: | 271 public: |
| 369 » CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page); | 272 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page); |
| 370 » ~CPDFSDK_PageView(); | 273 ~CPDFSDK_PageView(); |
| 371 » void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic e,CPDF_RenderOptions* pOptions) ; | 274 void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CP DF_RenderOptions* pOptions) ; |
| 372 » CPDF_Annot*» » » » » » GetPDFAnnotAtPoi nt(FX_FLOAT pageX, FX_FLOAT pageY); | 275 CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
| 373 » CPDFSDK_Annot*» » » » » GetFXAnnotAtPoint(FX_FLO AT pageX, FX_FLOAT pageY); | 276 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT p ageY); |
| 374 » CPDF_Annot*» » » » » » GetPDFWidgetAtPo int(FX_FLOAT pageX, FX_FLOAT pageY); | 277 CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
| 375 » CPDFSDK_Annot*» » » » » GetFXWidgetAtPoint(FX_FL OAT pageX, FX_FLOAT pageY); | 278 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
| 376 » CPDFSDK_Annot*» » » » » GetFocusAnnot() ; | 279 CPDFSDK_Annot* GetFocusAnnot() ; |
| 377 » void» » » » » » » SetFocusAnnot(CP DFSDK_Annot* pSDKAnnot,FX_UINT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, n Flag);} | 280 void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UI NT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);} |
| 378 » FX_BOOL»» » » » » » KillFocusAnnot(F X_UINT nFlag = 0) {return m_pSDKDoc->KillFocusAnnot(nFlag);} | 281 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {return m_ pSDKDoc->KillFocusAnnot(nFlag);} |
| 379 » FX_BOOL»» » » » » » Annot_HasAppeara nce(CPDF_Annot* pAnnot); | 282 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot); |
| 380 | 283 |
| 381 » CPDFSDK_Annot*» » » » » AddAnnot(CPDF_Dictionary * pDict); | 284 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary * pDict); |
| 382 » CPDFSDK_Annot*» » » » » AddAnnot(const FX_CHAR* lpSubType,CPDF_Dictionary * pDict); | 285 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType,CPDF_Dicti onary * pDict); |
| 383 » CPDFSDK_Annot*» » » » » AddAnnot(CPDF_Annot * pP DFAnnot); | 286 CPDFSDK_Annot* AddAnnot(CPDF_Annot * pPDFAnnot); |
| 384 FX_BOOL»» » » » » DeleteAnnot(CPDFSDK_Anno t* pAnnot); | 287 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); |
| 385 » int» » » » » » » » CountAnn ots(); | 288 int CountAnnots(); |
| 386 » CPDFSDK_Annot*» » » » » GetAnnot(int nIndex); | 289 CPDFSDK_Annot* GetAnnot(int nIndex); |
| 387 » CPDFSDK_Annot*» » » » GetAnnotByDict(CPDF_Dictiona ry * pDict); | 290 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary * pDict); |
| 388 » CPDF_Page*» » » » » » GetPDFPage(){ret urn m_page;} | 291 CPDF_Page* GetPDFPage(){return m_page;} |
| 389 » CPDF_Document*» » » » » GetPDFDocument(); | 292 CPDF_Document* GetPDFDocument(); |
| 390 » CPDFSDK_Document*» » » » GetSDKDocument() {return m_pSDKDoc;} | 293 CPDFSDK_Document* GetSDKDocument() {return m_pSDKDoc;} |
| 391 » FX_BOOL»» » » » OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag); | 294 FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_UINT nFla g); |
| 392 » FX_BOOL»» » » » OnLButtonUp(const CPDF_Point & p oint, FX_UINT nFlag); | 295 FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag) ; |
| 393 » FX_BOOL»» » » » OnChar(int nChar, FX_UINT nFlag) ; | 296 FX_BOOL OnChar(int nChar, FX_UINT nFlag); |
| 394 » FX_BOOL»» » » » OnKeyDown(int nKeyCode, int nFla g); | 297 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); |
| 395 » FX_BOOL»» » » » OnKeyUp(int nKeyCode, int nFlag) ; | 298 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); |
| 396 | 299 |
| 397 » FX_BOOL»» » » » OnMouseMove(const CPDF_Point & p oint, int nFlag); | 300 FX_BOOL OnMouseMove(const CPDF_Point & point, int nFlag); |
| 398 » FX_BOOL»» » » » OnMouseWheel(double deltaX, doub le deltaY,const CPDF_Point& point, int nFlag); | 301 FX_BOOL OnMouseWheel(double deltaX, double deltaY,const CPDF _Point& point, int nFlag); |
| 399 » FX_BOOL»» » » » IsValidAnnot(void* p); | 302 FX_BOOL IsValidAnnot(void* p); |
| 400 » void» » » » » GetCurrentMatrix(CPDF_Matrix& ma trix) {matrix = m_curMatrix;} | 303 void GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_cu rMatrix;} |
| 401 » void» » » » » UpdateRects(CFX_RectArray& rects ); | 304 void UpdateRects(CFX_RectArray& rects); |
| 402 » void» » » » » » » UpdateView(CPDFS DK_Annot* pAnnot); | 305 void UpdateView(CPDFSDK_Annot* pAnnot); |
| 403 » CFX_PtrArray*» » » » » GetAnnotList(){ return & m_fxAnnotArray; } | 306 CFX_PtrArray* GetAnnotList(){ return &m_fxAnnotArray; } |
| 404 | 307 |
| 405 » int» » » » » » GetPageIndex(); | 308 int GetPageIndex(); |
| 406 » void» » » » » » » LoadFXAnnots(); | 309 void LoadFXAnnots(); |
| 407 | 310 |
| 408 void SetValid(FX_BOOL bValid) {m_bValid = bValid;} | 311 void SetValid(FX_BOOL bValid) {m_bValid = bValid;} |
| 409 FX_BOOL IsValid() {return m_bValid;} | 312 FX_BOOL IsValid() {return m_bValid;} |
| 410 void SetLock(FX_BOOL bLocked) {m_bLocked= bLocked;} | 313 void SetLock(FX_BOOL bLocked) {m_bLocked= bLocked;} |
| 411 FX_BOOL IsLocked() {return m_bLocked;} | 314 FX_BOOL IsLocked() {return m_bLocked;} |
| 412 void TakeOverPage() {m_bTakeOverPage = TRUE;} | 315 void TakeOverPage() {m_bTakeOverPage = TRUE;} |
| 413 private: | 316 private: |
| 414 » void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_W idget* pWidget); | 317 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widge t* pWidget); |
| 415 CPDF_Matrix m_curMatrix; | 318 CPDF_Matrix m_curMatrix; |
| 416 » CPDF_Page* m_page; | 319 CPDF_Page* m_page; |
| 417 » CPDF_AnnotList* m_pAnnotList; | 320 CPDF_AnnotList* m_pAnnotList; |
| 418 » //CPDFSDK_Annot* m_pFocusAnnot; | 321 //CPDFSDK_Annot* m_pFocusAnnot; |
| 419 » CFX_PtrArray m_fxAnnotArray; | 322 CFX_PtrArray m_fxAnnotArray; |
| 420 » CPDFSDK_Document* m_pSDKDoc; | 323 CPDFSDK_Document* m_pSDKDoc; |
| 421 » CPDFSDK_Widget* m_CaptureWidget; | 324 CPDFSDK_Widget* m_CaptureWidget; |
| 422 » FX_BOOL m_bEnterWidget; | 325 FX_BOOL m_bEnterWidget; |
| 423 » FX_BOOL m_bExitWidget; | 326 FX_BOOL m_bExitWidget; |
| 424 » FX_BOOL m_bOnWidget; | 327 FX_BOOL m_bOnWidget; |
| 425 » FX_BOOL m_bValid; | 328 FX_BOOL m_bValid; |
| 426 FX_BOOL m_bLocked; | 329 FX_BOOL m_bLocked; |
| 427 FX_BOOL m_bTakeOverPage; | 330 FX_BOOL m_bTakeOverPage; |
| 428 }; | 331 }; |
| 429 | 332 |
| 430 | 333 |
| 431 template<class TYPE> | 334 template<class TYPE> |
| 432 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> | 335 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> |
| 433 { | 336 { |
| 434 public: | 337 public: |
| 435 » CGW_ArrayTemplate(){} | 338 CGW_ArrayTemplate(){} |
| 436 » virtual ~CGW_ArrayTemplate(){} | 339 virtual ~CGW_ArrayTemplate(){} |
| 437 | 340 |
| 438 » typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); | 341 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); |
| 439 | 342 |
| 440 » void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) | 343 void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) |
| 441 » { | 344 { |
| 442 » » int nSize = this->GetSize(); | 345 int nSize = this->GetSize(); |
| 443 » » QuickSort(0, nSize -1, bAscent, pCompare); | 346 QuickSort(0, nSize -1, bAscent, pCompare); |
| 444 » } | 347 } |
| 445 | 348 |
| 446 private: | 349 private: |
| 447 » void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_ COMPARE pCompare) | 350 void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMP ARE pCompare) |
| 448 » { | 351 { |
| 449 » » if (nStartPos >= nStopPos) return; | 352 if (nStartPos >= nStopPos) return; |
| 450 | 353 |
| 451 » » if ((nStopPos - nStartPos) == 1) | 354 if ((nStopPos - nStartPos) == 1) |
| 452 » » { | 355 { |
| 453 » » » TYPE Value1 = this->GetAt(nStartPos); | 356 TYPE Value1 = this->GetAt(nStartPos); |
| 454 » » » TYPE Value2 = this->GetAt(nStopPos); | 357 TYPE Value2 = this->GetAt(nStopPos); |
| 455 | 358 |
| 456 » » » int iGreate = (*pCompare)(Value1, Value2); | 359 int iGreate = (*pCompare)(Value1, Value2); |
| 457 » » » if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0 )) | 360 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) |
| 458 » » » { | 361 { |
| 459 » » » » this->SetAt(nStartPos, Value2); | 362 this->SetAt(nStartPos, Value2); |
| 460 » » » » this->SetAt(nStopPos, Value1); | 363 this->SetAt(nStopPos, Value1); |
| 461 » » » } | 364 } |
| 462 » » » return; | 365 return; |
| 463 » » } | 366 } |
| 464 | 367 |
| 465 » » FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2; | 368 FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2; |
| 466 » » FX_UINT i = nStartPos; | 369 FX_UINT i = nStartPos; |
| 467 | 370 |
| 468 » » TYPE Value = this->GetAt(m); | 371 TYPE Value = this->GetAt(m); |
| 469 | 372 |
| 470 » » while (i < m) | 373 while (i < m) |
| 471 » » { | 374 { |
| 472 » » » TYPE temp = this->GetAt(i); | 375 TYPE temp = this->GetAt(i); |
| 473 | 376 |
| 474 » » » int iGreate = (*pCompare)(temp, Value); | 377 int iGreate = (*pCompare)(temp, Value); |
| 475 » » » if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0 )) | 378 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) |
| 476 » » » { | 379 { |
| 477 » » » » this->InsertAt(m+1, temp); | 380 this->InsertAt(m+1, temp); |
| 478 » » » » this->RemoveAt(i); | 381 this->RemoveAt(i); |
| 479 » » » » m--; | 382 m--; |
| 480 » » » } | 383 } |
| 481 » » » else | 384 else |
| 482 » » » { | 385 { |
| 483 » » » » i++; | 386 i++; |
| 484 » » » } | 387 } |
| 485 » » } | 388 } |
| 486 | 389 |
| 487 » » FX_UINT j = nStopPos; | 390 FX_UINT j = nStopPos; |
| 488 | 391 |
| 489 » » while (j > m) | 392 while (j > m) |
| 490 » » { | 393 { |
| 491 » » » TYPE temp = this->GetAt(j); | 394 TYPE temp = this->GetAt(j); |
| 492 | 395 |
| 493 » » » int iGreate = (*pCompare)(temp, Value); | 396 int iGreate = (*pCompare)(temp, Value); |
| 494 » » » if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0 )) | 397 if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0)) |
| 495 » » » { | 398 { |
| 496 » » » » this->RemoveAt(j); | 399 this->RemoveAt(j); |
| 497 » » » » this->InsertAt(m, temp); | 400 this->InsertAt(m, temp); |
| 498 » » » » m++; | 401 m++; |
| 499 » » » } | 402 } |
| 500 » » » else | 403 else |
| 501 » » » { | 404 { |
| 502 » » » » j--; | 405 j--; |
| 503 » » » } | 406 } |
| 504 » » } | 407 } |
| 505 | 408 |
| 506 » » if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare); | 409 if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare); |
| 507 » » if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare); | 410 if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare); |
| 508 » } | 411 } |
| 509 }; | 412 }; |
| 510 | 413 |
| 511 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ | 414 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ |
| OLD | NEW |