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> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 return fxtime; | 86 return fxtime; |
87 } | 87 } |
88 | 88 |
89 void FFI_OnChange() | 89 void FFI_OnChange() |
90 { | 90 { |
91 if (m_pInfo && m_pInfo->FFI_OnChange) | 91 if (m_pInfo && m_pInfo->FFI_OnChange) |
92 m_pInfo->FFI_OnChange(m_pInfo); | 92 m_pInfo->FFI_OnChange(m_pInfo); |
93 } | 93 } |
94 | 94 |
95 FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) const | 95 bool FFI_IsSHIFTKeyDown(FX_DWORD nFlag) const |
96 { | 96 { |
97 return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; | 97 return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; |
98 } | 98 } |
99 | 99 |
100 FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) const | 100 bool FFI_IsCTRLKeyDown(FX_DWORD nFlag) const |
101 { | 101 { |
102 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; | 102 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; |
103 } | 103 } |
104 | 104 |
105 FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) const | 105 bool FFI_IsALTKeyDown(FX_DWORD nFlag) const |
106 { | 106 { |
107 return (nFlag & FWL_EVENTFLAG_AltKey) != 0; | 107 return (nFlag & FWL_EVENTFLAG_AltKey) != 0; |
108 } | 108 } |
109 | 109 |
110 FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) const | 110 bool FFI_IsINSERTKeyDown(FX_DWORD nFlag) const |
111 { | 111 { |
112 return FALSE; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 int JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, FX_UINT Type, FX
_UINT Icon); | 115 int JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, FX_UINT Type, FX
_UINT Icon); |
116 int JS_appResponse(const FX_WCHAR* Question, const FX_WCHAR* Title, const FX
_WCHAR* Default, | 116 int JS_appResponse(const FX_WCHAR* Question, const FX_WCHAR* Title, const FX
_WCHAR* Default, |
117 const FX_WCHAR* cLabel, FPDF_BOOL bPassword, void* respon
se, int length); | 117 const FX_WCHAR* cLabel, FPDF_BOOL bPassword, void* respon
se, int length); |
118 | 118 |
119 void JS_appBeep(int nType) | 119 void JS_appBeep(int nType) |
120 { | 120 { |
121 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_bee
p) | 121 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_bee
p) |
122 m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); | 122 m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return m_pInfo->FFI_GetRotation(m_pInfo, page); | 167 return m_pInfo->FFI_GetRotation(m_pInfo, page); |
168 return 0; | 168 return 0; |
169 } | 169 } |
170 | 170 |
171 void FFI_ExecuteNamedAction(const FX_CHAR* namedAction) | 171 void FFI_ExecuteNamedAction(const FX_CHAR* namedAction) |
172 { | 172 { |
173 if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) | 173 if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) |
174 m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); | 174 m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); |
175 } | 175 } |
176 | 176 |
177 void FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DW
ORD nTextLen, FX_BOOL bFocus) | 177 void FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DW
ORD nTextLen, bool bFocus) |
178 { | 178 { |
179 if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) | 179 if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) |
180 m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus)
; | 180 m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus)
; |
181 } | 181 } |
182 | 182 |
183 void FFI_DoURIAction(const FX_CHAR* bsURI) | 183 void FFI_DoURIAction(const FX_CHAR* bsURI) |
184 { | 184 { |
185 if (m_pInfo && m_pInfo->FFI_DoURIAction) | 185 if (m_pInfo && m_pInfo->FFI_DoURIAction) |
186 m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); | 186 m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); |
187 } | 187 } |
188 | 188 |
189 void FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int si
zeOfArray) | 189 void FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int si
zeOfArray) |
190 { | 190 { |
191 if (m_pInfo && m_pInfo->FFI_DoGoToAction) | 191 if (m_pInfo && m_pInfo->FFI_DoGoToAction) |
192 m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray,
sizeOfArray); | 192 m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray,
sizeOfArray); |
193 } | 193 } |
194 | 194 |
195 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } | 195 bool IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } |
196 void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } | 196 void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } |
197 CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } | 197 CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } |
198 CPDF_Document* GetPDFDocument() const { return m_pPDFDoc; } | 198 CPDF_Document* GetPDFDocument() const { return m_pPDFDoc; } |
199 CFX_ByteString GetAppName() const { return ""; } | 199 CFX_ByteString GetAppName() const { return ""; } |
200 IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler; } | 200 IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler; } |
201 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo;} | 201 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo;} |
202 CJS_RuntimeFactory* GetRuntimeFactory() const { return m_pJSRuntimeFactory;
} | 202 CJS_RuntimeFactory* GetRuntimeFactory() const { return m_pJSRuntimeFactory;
} |
203 | 203 |
204 CFFL_IFormFiller* GetIFormFiller(); // Creates if not present. | 204 CFFL_IFormFiller* GetIFormFiller(); // Creates if not present. |
205 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. | 205 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. |
(...skipping 14 matching lines...) Expand all Loading... |
220 | 220 |
221 class CPDFSDK_Document | 221 class CPDFSDK_Document |
222 { | 222 { |
223 public: | 223 public: |
224 CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv); | 224 CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv); |
225 ~CPDFSDK_Document(); | 225 ~CPDFSDK_Document(); |
226 | 226 |
227 CPDFSDK_InterForm* GetInterForm() ; | 227 CPDFSDK_InterForm* GetInterForm() ; |
228 CPDF_Document* GetDocument() {return m_pDoc;} | 228 CPDF_Document* GetDocument() {return m_pDoc;} |
229 | 229 |
230 CPDFSDK_PageView* GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRU
E); | 230 CPDFSDK_PageView* GetPageView(CPDF_Page* pPDFPage, bool ReNew = true); |
231 CPDFSDK_PageView* GetPageView(int nIndex); | 231 CPDFSDK_PageView* GetPageView(int nIndex); |
232 CPDFSDK_PageView* GetCurrentView(); | 232 CPDFSDK_PageView* GetCurrentView(); |
233 void ReMovePageView(CPDF_Page* pPDFPage); | 233 void ReMovePageView(CPDF_Page* pPDFPage); |
234 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_An
not* pAnnot); | 234 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_An
not* pAnnot); |
235 | 235 |
236 CPDFSDK_Annot* GetFocusAnnot(); | 236 CPDFSDK_Annot* GetFocusAnnot(); |
237 | 237 |
238 IFXJS_Runtime * GetJsRuntime(); | 238 IFXJS_Runtime * GetJsRuntime(); |
239 | 239 |
240 FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag =
0); | 240 bool SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0)
; |
241 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0); | 241 bool KillFocusAnnot(FX_UINT nFlag = 0); |
242 | 242 |
243 FX_BOOL ExtractPages(const CFX_WordArray &arrExtraPages, CPD
F_Document* pDstDoc); | 243 bool ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_D
ocument* pDstDoc); |
244 FX_BOOL InsertPages(int nInsertAt, const CPDF_Document* pSrc
Doc, const CFX_WordArray &arrSrcPages); | 244 bool InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc
, const CFX_WordArray &arrSrcPages); |
245 FX_BOOL ReplacePages(int nPage, const CPDF_Document* pSrcDoc
, const CFX_WordArray &arrSrcPages); | 245 bool ReplacePages(int nPage, const CPDF_Document* pSrcDoc, c
onst CFX_WordArray &arrSrcPages); |
246 | 246 |
247 void OnCloseDocument(); | 247 void OnCloseDocument(); |
248 | 248 |
249 int GetPageCount() {return m_pDoc->GetPageCount();} | 249 int GetPageCount() {return m_pDoc->GetPageCount();} |
250 FX_BOOL GetPermissions(int nFlag); | 250 bool GetPermissions(int nFlag); |
251 FX_BOOL GetChangeMark() {return m_bChangeMask;} | 251 bool GetChangeMark() {return m_bChangeMask;} |
252 void SetChangeMark() {m_bChangeMask = TRUE;} | 252 void SetChangeMark() {m_bChangeMask = true;} |
253 void ClearChangeMark() {m_bChangeMask= FALSE;} | 253 void ClearChangeMark() {m_bChangeMask= false;} |
254 CFX_WideString GetPath() ; | 254 CFX_WideString GetPath() ; |
255 CPDF_Page* GetPage(int nIndex); | 255 CPDF_Page* GetPage(int nIndex); |
256 CPDFDoc_Environment * GetEnv() {return m_pEnv; } | 256 CPDFDoc_Environment * GetEnv() {return m_pEnv; } |
257 void ProcJavascriptFun(); | 257 void ProcJavascriptFun(); |
258 FX_BOOL ProcOpenAction(); | 258 bool ProcOpenAction(); |
259 CPDF_OCContext* GetOCContext(); | 259 CPDF_OCContext* GetOCContext(); |
260 private: | 260 private: |
261 std::map<CPDF_Page*, CPDFSDK_PageView*> m_pageMap; | 261 std::map<CPDF_Page*, CPDFSDK_PageView*> m_pageMap; |
262 CPDF_Document* m_pDoc; | 262 CPDF_Document* m_pDoc; |
263 CPDFSDK_InterForm* m_pInterForm; | 263 CPDFSDK_InterForm* m_pInterForm; |
264 CPDFSDK_Annot* m_pFocusAnnot; | 264 CPDFSDK_Annot* m_pFocusAnnot; |
265 CPDFDoc_Environment* m_pEnv; | 265 CPDFDoc_Environment* m_pEnv; |
266 CPDF_OCContext* m_pOccontent; | 266 CPDF_OCContext* m_pOccontent; |
267 FX_BOOL m_bChangeMask; | 267 bool m_bChangeMask; |
268 }; | 268 }; |
269 class CPDFSDK_PageView final | 269 class CPDFSDK_PageView final |
270 { | 270 { |
271 public: | 271 public: |
272 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page); | 272 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page); |
273 ~CPDFSDK_PageView(); | 273 ~CPDFSDK_PageView(); |
274 void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CP
DF_RenderOptions* pOptions) ; | 274 void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CP
DF_RenderOptions* pOptions) ; |
275 CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT
pageY); | 275 CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT
pageY); |
276 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT p
ageY); | 276 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT p
ageY); |
277 CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT
pageY); | 277 CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT
pageY); |
278 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT
pageY); | 278 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT
pageY); |
279 CPDFSDK_Annot* GetFocusAnnot() ; | 279 CPDFSDK_Annot* GetFocusAnnot() ; |
280 void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UI
NT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);} | 280 void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UI
NT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);} |
281 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {return m_
pSDKDoc->KillFocusAnnot(nFlag);} | 281 bool KillFocusAnnot(FX_UINT nFlag = 0) {return m_pSD
KDoc->KillFocusAnnot(nFlag);} |
282 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot); | 282 bool Annot_HasAppearance(CPDF_Annot* pAnnot); |
283 | 283 |
284 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary * pDict); | 284 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary * pDict); |
285 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType,CPDF_Dicti
onary * pDict); | 285 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType,CPDF_Dicti
onary * pDict); |
286 CPDFSDK_Annot* AddAnnot(CPDF_Annot * pPDFAnnot); | 286 CPDFSDK_Annot* AddAnnot(CPDF_Annot * pPDFAnnot); |
287 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); | 287 bool DeleteAnnot(CPDFSDK_Annot* pAnnot); |
288 int CountAnnots(); | 288 int CountAnnots(); |
289 CPDFSDK_Annot* GetAnnot(int nIndex); | 289 CPDFSDK_Annot* GetAnnot(int nIndex); |
290 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary * pDict); | 290 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary * pDict); |
291 CPDF_Page* GetPDFPage(){return m_page;} | 291 CPDF_Page* GetPDFPage(){return m_page;} |
292 CPDF_Document* GetPDFDocument(); | 292 CPDF_Document* GetPDFDocument(); |
293 CPDFSDK_Document* GetSDKDocument() {return m_pSDKDoc;} | 293 CPDFSDK_Document* GetSDKDocument() {return m_pSDKDoc;} |
294 FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_UINT nFla
g); | 294 bool OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag); |
295 FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag)
; | 295 bool OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag); |
296 FX_BOOL OnChar(int nChar, FX_UINT nFlag); | 296 bool OnChar(int nChar, FX_UINT nFlag); |
297 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); | 297 bool OnKeyDown(int nKeyCode, int nFlag); |
298 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); | 298 bool OnKeyUp(int nKeyCode, int nFlag); |
299 | 299 |
300 FX_BOOL OnMouseMove(const CPDF_Point & point, int nFlag); | 300 bool OnMouseMove(const CPDF_Point & point, int nFlag); |
301 FX_BOOL OnMouseWheel(double deltaX, double deltaY,const CPDF
_Point& point, int nFlag); | 301 bool OnMouseWheel(double deltaX, double deltaY,const CPDF_Po
int& point, int nFlag); |
302 FX_BOOL IsValidAnnot(void* p); | 302 bool IsValidAnnot(void* p); |
303 void GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_cu
rMatrix;} | 303 void GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_cu
rMatrix;} |
304 void UpdateRects(CFX_RectArray& rects); | 304 void UpdateRects(CFX_RectArray& rects); |
305 void UpdateView(CPDFSDK_Annot* pAnnot); | 305 void UpdateView(CPDFSDK_Annot* pAnnot); |
306 CFX_PtrArray* GetAnnotList(){ return &m_fxAnnotArray; } | 306 CFX_PtrArray* GetAnnotList(){ return &m_fxAnnotArray; } |
307 | 307 |
308 int GetPageIndex(); | 308 int GetPageIndex(); |
309 void LoadFXAnnots(); | 309 void LoadFXAnnots(); |
310 | 310 |
311 void SetValid(FX_BOOL bValid) {m_bValid = bValid;} | 311 void SetValid(bool bValid) {m_bValid = bValid;} |
312 FX_BOOL IsValid() {return m_bValid;} | 312 bool IsValid() {return m_bValid;} |
313 void SetLock(FX_BOOL bLocked) {m_bLocked= bLocked;} | 313 void SetLock(bool bLocked) {m_bLocked= bLocked;} |
314 FX_BOOL IsLocked() {return m_bLocked;} | 314 bool IsLocked() {return m_bLocked;} |
315 void TakeOverPage() {m_bTakeOverPage = TRUE;} | 315 void TakeOverPage() {m_bTakeOverPage = true;} |
316 private: | 316 private: |
317 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widge
t* pWidget); | 317 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widge
t* pWidget); |
318 CPDF_Matrix m_curMatrix; | 318 CPDF_Matrix m_curMatrix; |
319 CPDF_Page* m_page; | 319 CPDF_Page* m_page; |
320 CPDF_AnnotList* m_pAnnotList; | 320 CPDF_AnnotList* m_pAnnotList; |
321 //CPDFSDK_Annot* m_pFocusAnnot; | 321 //CPDFSDK_Annot* m_pFocusAnnot; |
322 CFX_PtrArray m_fxAnnotArray; | 322 CFX_PtrArray m_fxAnnotArray; |
323 CPDFSDK_Document* m_pSDKDoc; | 323 CPDFSDK_Document* m_pSDKDoc; |
324 CPDFSDK_Widget* m_CaptureWidget; | 324 CPDFSDK_Widget* m_CaptureWidget; |
325 FX_BOOL m_bEnterWidget; | 325 bool m_bEnterWidget; |
326 FX_BOOL m_bExitWidget; | 326 bool m_bExitWidget; |
327 FX_BOOL m_bOnWidget; | 327 bool m_bOnWidget; |
328 FX_BOOL m_bValid; | 328 bool m_bValid; |
329 FX_BOOL m_bLocked; | 329 bool m_bLocked; |
330 FX_BOOL m_bTakeOverPage; | 330 bool m_bTakeOverPage; |
331 }; | 331 }; |
332 | 332 |
333 | 333 |
334 template<class TYPE> | 334 template<class TYPE> |
335 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> | 335 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> |
336 { | 336 { |
337 public: | 337 public: |
338 CGW_ArrayTemplate(){} | 338 CGW_ArrayTemplate(){} |
339 virtual ~CGW_ArrayTemplate(){} | 339 virtual ~CGW_ArrayTemplate(){} |
340 | 340 |
341 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); | 341 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); |
342 | 342 |
343 void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) | 343 void Sort(LP_COMPARE pCompare, bool bAscent = true) |
344 { | 344 { |
345 int nSize = this->GetSize(); | 345 int nSize = this->GetSize(); |
346 QuickSort(0, nSize -1, bAscent, pCompare); | 346 QuickSort(0, nSize -1, bAscent, pCompare); |
347 } | 347 } |
348 | 348 |
349 private: | 349 private: |
350 void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMP
ARE pCompare) | 350 void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, bool bAscend, LP_COMPARE
pCompare) |
351 { | 351 { |
352 if (nStartPos >= nStopPos) return; | 352 if (nStartPos >= nStopPos) return; |
353 | 353 |
354 if ((nStopPos - nStartPos) == 1) | 354 if ((nStopPos - nStartPos) == 1) |
355 { | 355 { |
356 TYPE Value1 = this->GetAt(nStartPos); | 356 TYPE Value1 = this->GetAt(nStartPos); |
357 TYPE Value2 = this->GetAt(nStopPos); | 357 TYPE Value2 = this->GetAt(nStopPos); |
358 | 358 |
359 int iGreate = (*pCompare)(Value1, Value2); | 359 int iGreate = (*pCompare)(Value1, Value2); |
360 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) | 360 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 j--; | 405 j--; |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare); | 409 if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare); |
410 if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare); | 410 if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare); |
411 } | 411 } |
412 }; | 412 }; |
413 | 413 |
414 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ | 414 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ |
OLD | NEW |