| 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 #include "public/fpdf_formfill.h" | 7 #include "public/fpdf_formfill.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/include/fsdk_define.h" |
| 10 #include "fpdfsdk/include/fsdk_mgr.h" |
| 11 #include "public/fpdfview.h" |
| 12 #include "third_party/base/nonstd_unique_ptr.h" |
| 13 |
| 9 #ifdef PDF_ENABLE_XFA | 14 #ifdef PDF_ENABLE_XFA |
| 10 #include "../include/fpdfxfa/fpdfxfa_app.h" | 15 #include "../include/fpdfxfa/fpdfxfa_app.h" |
| 11 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 16 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 12 #include "../include/fpdfxfa/fpdfxfa_page.h" | 17 #include "../include/fpdfxfa/fpdfxfa_page.h" |
| 13 #endif | 18 #endif // PDF_ENABLE_XFA |
| 14 #include "fpdfsdk/include/fsdk_define.h" | |
| 15 #include "fpdfsdk/include/fsdk_mgr.h" | |
| 16 #include "public/fpdfview.h" | |
| 17 #include "third_party/base/nonstd_unique_ptr.h" | |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 CPDFSDK_Document* FormHandleToSDKDoc(FPDF_FORMHANDLE hHandle) { | 22 CPDFSDK_Document* FormHandleToSDKDoc(FPDF_FORMHANDLE hHandle) { |
| 22 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 23 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
| 23 return pEnv ? pEnv->GetSDKDocument() : nullptr; | 24 return pEnv ? pEnv->GetSDKDocument() : nullptr; |
| 24 } | 25 } |
| 25 | 26 |
| 26 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { | 27 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { |
| 27 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); | 28 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 | 41 |
| 41 } // namespace | 42 } // namespace |
| 42 | 43 |
| 43 DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 44 DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 44 FPDF_PAGE page, | 45 FPDF_PAGE page, |
| 45 double page_x, | 46 double page_x, |
| 46 double page_y) { | 47 double page_y) { |
| 47 if (!hHandle) | 48 if (!hHandle) |
| 48 return -1; | 49 return -1; |
| 49 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 50 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 50 #ifndef PDF_ENABLE_XFA | 51 #ifdef PDF_ENABLE_XFA |
| 51 if (!pPage) | |
| 52 return -1; | |
| 53 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | |
| 54 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( | |
| 55 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); | |
| 56 if (!pFormCtrl) | |
| 57 return -1; | |
| 58 #else | |
| 59 if (pPage) { | 52 if (pPage) { |
| 60 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | 53 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 61 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( | 54 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( |
| 62 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); | 55 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); |
| 63 if (!pFormCtrl) | 56 if (!pFormCtrl) |
| 64 return -1; | 57 return -1; |
| 65 | 58 |
| 66 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 59 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| 67 if (!pFormField) | 60 if (!pFormField) |
| 68 return -1; | 61 return -1; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (rcWidget.Contains(static_cast<FX_FLOAT>(page_x), | 96 if (rcWidget.Contains(static_cast<FX_FLOAT>(page_x), |
| 104 static_cast<FX_FLOAT>(page_y))) { | 97 static_cast<FX_FLOAT>(page_y))) { |
| 105 pWidgetIterator->Release(); | 98 pWidgetIterator->Release(); |
| 106 return FPDF_FORMFIELD_XFA; | 99 return FPDF_FORMFIELD_XFA; |
| 107 } | 100 } |
| 108 pXFAAnnot = pWidgetIterator->MoveToNext(); | 101 pXFAAnnot = pWidgetIterator->MoveToNext(); |
| 109 } | 102 } |
| 110 | 103 |
| 111 pWidgetIterator->Release(); | 104 pWidgetIterator->Release(); |
| 112 } | 105 } |
| 113 #endif | 106 return -1; |
| 114 | 107 #else // PDF_ENABLE_XFA |
| 115 #ifndef PDF_ENABLE_XFA | 108 if (!pPage) |
| 109 return -1; |
| 110 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 111 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( |
| 112 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); |
| 113 if (!pFormCtrl) |
| 114 return -1; |
| 116 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 115 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| 117 return pFormField ? pFormField->GetFieldType() : -1; | 116 return pFormField ? pFormField->GetFieldType() : -1; |
| 118 #else | 117 #endif // PDF_ENABLE_XFA |
| 119 return -1; | |
| 120 #endif | |
| 121 } | 118 } |
| 122 | 119 |
| 123 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 120 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 124 FPDF_PAGE page, | 121 FPDF_PAGE page, |
| 125 double page_x, | 122 double page_x, |
| 126 double page_y) { | 123 double page_y) { |
| 127 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); | 124 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); |
| 128 } | 125 } |
| 129 | 126 |
| 130 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, | 127 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, |
| 131 FPDF_PAGE page, | 128 FPDF_PAGE page, |
| 132 double page_x, | 129 double page_x, |
| 133 double page_y) { | 130 double page_y) { |
| 134 if (!hHandle) | 131 if (!hHandle) |
| 135 return -1; | 132 return -1; |
| 136 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 133 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 137 if (!pPage) | 134 if (!pPage) |
| 138 return -1; | 135 return -1; |
| 139 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | 136 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 140 int z_order = -1; | 137 int z_order = -1; |
| 141 (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, | 138 (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, |
| 142 &z_order); | 139 &z_order); |
| 143 return z_order; | 140 return z_order; |
| 144 } | 141 } |
| 145 | 142 |
| 146 DLLEXPORT FPDF_FORMHANDLE STDCALL | 143 DLLEXPORT FPDF_FORMHANDLE STDCALL |
| 147 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, | 144 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, |
| 148 FPDF_FORMFILLINFO* formInfo) { | 145 FPDF_FORMFILLINFO* formInfo) { |
| 149 #ifndef PDF_ENABLE_XFA | 146 #ifdef PDF_ENABLE_XFA |
| 147 const int kRequiredVersion = 2; |
| 148 #else // PDF_ENABLE_XFA |
| 150 const int kRequiredVersion = 1; | 149 const int kRequiredVersion = 1; |
| 151 #else | 150 #endif // PDF_ENABLE_XFA |
| 152 const int kRequiredVersion = 2; | |
| 153 #endif | |
| 154 if (!formInfo || formInfo->version != kRequiredVersion) | 151 if (!formInfo || formInfo->version != kRequiredVersion) |
| 155 return nullptr; | 152 return nullptr; |
| 156 | 153 |
| 157 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); | 154 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); |
| 158 if (!pDocument) | 155 if (!pDocument) |
| 159 return nullptr; | 156 return nullptr; |
| 160 | 157 |
| 161 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); | 158 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); |
| 162 #ifndef PDF_ENABLE_XFA | 159 #ifdef PDF_ENABLE_XFA |
| 163 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); | |
| 164 #else | |
| 165 pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv)); | 160 pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv)); |
| 166 | |
| 167 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | 161 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); |
| 168 pApp->AddFormFillEnv(pEnv); | 162 pApp->AddFormFillEnv(pEnv); |
| 169 #endif | 163 #else // PDF_ENABLE_XFA |
| 164 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); |
| 165 #endif // PDF_ENABLE_XFA |
| 170 return pEnv; | 166 return pEnv; |
| 171 } | 167 } |
| 172 | 168 |
| 173 DLLEXPORT void STDCALL | 169 DLLEXPORT void STDCALL |
| 174 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { | 170 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { |
| 175 if (!hHandle) | 171 if (!hHandle) |
| 176 return; | 172 return; |
| 177 #ifndef PDF_ENABLE_XFA | |
| 178 | |
| 179 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 173 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
| 174 #ifdef PDF_ENABLE_XFA |
| 175 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); |
| 176 pApp->RemoveFormFillEnv(pEnv); |
| 177 #else // PDF_ENABLE_XFA |
| 180 if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) { | 178 if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) { |
| 181 pEnv->SetSDKDocument(NULL); | 179 pEnv->SetSDKDocument(NULL); |
| 182 delete pSDKDoc; | 180 delete pSDKDoc; |
| 183 } | 181 } |
| 182 #endif // PDF_ENABLE_XFA |
| 184 delete pEnv; | 183 delete pEnv; |
| 185 #else | |
| 186 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | |
| 187 pApp->RemoveFormFillEnv((CPDFDoc_Environment*)hHandle); | |
| 188 delete (CPDFDoc_Environment*)hHandle; | |
| 189 #endif | |
| 190 } | 184 } |
| 191 | 185 |
| 192 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, | 186 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, |
| 193 FPDF_PAGE page, | 187 FPDF_PAGE page, |
| 194 int modifier, | 188 int modifier, |
| 195 double page_x, | 189 double page_x, |
| 196 double page_y) { | 190 double page_y) { |
| 197 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 191 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 198 if (!pPageView) | 192 if (!pPageView) |
| 199 return FALSE; | 193 return FALSE; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 int modifier, | 241 int modifier, |
| 248 double page_x, | 242 double page_x, |
| 249 double page_y) { | 243 double page_y) { |
| 250 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 244 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 251 if (!pPageView) | 245 if (!pPageView) |
| 252 return FALSE; | 246 return FALSE; |
| 253 | 247 |
| 254 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); | 248 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); |
| 255 return pPageView->OnRButtonUp(pt, modifier); | 249 return pPageView->OnRButtonUp(pt, modifier); |
| 256 } | 250 } |
| 251 #endif // PDF_ENABLE_XFA |
| 257 | 252 |
| 258 #endif | |
| 259 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, | 253 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, |
| 260 FPDF_PAGE page, | 254 FPDF_PAGE page, |
| 261 int nKeyCode, | 255 int nKeyCode, |
| 262 int modifier) { | 256 int modifier) { |
| 263 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 257 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 264 if (!pPageView) | 258 if (!pPageView) |
| 265 return FALSE; | 259 return FALSE; |
| 266 | 260 |
| 267 return pPageView->OnKeyDown(nKeyCode, modifier); | 261 return pPageView->OnKeyDown(nKeyCode, modifier); |
| 268 } | 262 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 306 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 313 if (!pPage) | 307 if (!pPage) |
| 314 return; | 308 return; |
| 315 | 309 |
| 316 #ifndef PDF_ENABLE_XFA | 310 #ifndef PDF_ENABLE_XFA |
| 317 CPDF_RenderOptions options; | 311 CPDF_RenderOptions options; |
| 318 if (flags & FPDF_LCD_TEXT) | 312 if (flags & FPDF_LCD_TEXT) |
| 319 options.m_Flags |= RENDER_CLEARTYPE; | 313 options.m_Flags |= RENDER_CLEARTYPE; |
| 320 else | 314 else |
| 321 options.m_Flags &= ~RENDER_CLEARTYPE; | 315 options.m_Flags &= ~RENDER_CLEARTYPE; |
| 322 #else | |
| 323 CPDFXFA_Document* pDocument = pPage->GetDocument(); | |
| 324 if (!pDocument) | |
| 325 return; | |
| 326 #endif | |
| 327 | |
| 328 #ifndef PDF_ENABLE_XFA | |
| 329 // Grayscale output | 316 // Grayscale output |
| 330 if (flags & FPDF_GRAYSCALE) { | 317 if (flags & FPDF_GRAYSCALE) { |
| 331 options.m_ColorMode = RENDER_COLOR_GRAY; | 318 options.m_ColorMode = RENDER_COLOR_GRAY; |
| 332 options.m_ForeColor = 0; | 319 options.m_ForeColor = 0; |
| 333 options.m_BackColor = 0xffffff; | 320 options.m_BackColor = 0xffffff; |
| 334 } | 321 } |
| 335 #else | 322 options.m_AddFlags = flags >> 8; |
| 323 options.m_pOCContext = new CPDF_OCContext(pPage->m_pDocument); |
| 324 #else // PDF_ENABLE_XFA |
| 325 CPDFXFA_Document* pDocument = pPage->GetDocument(); |
| 326 if (!pDocument) |
| 327 return; |
| 336 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); | 328 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); |
| 337 if (!pPDFDoc) | 329 if (!pPDFDoc) |
| 338 return; | 330 return; |
| 339 #endif | |
| 340 | |
| 341 #ifndef PDF_ENABLE_XFA | |
| 342 options.m_AddFlags = flags >> 8; | |
| 343 options.m_pOCContext = new CPDF_OCContext(pPage->m_pDocument); | |
| 344 #else | |
| 345 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 331 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
| 346 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); | 332 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); |
| 347 if (!pFXDoc) | 333 if (!pFXDoc) |
| 348 return; | 334 return; |
| 349 #endif | 335 #endif // PDF_ENABLE_XFA |
| 350 | 336 |
| 351 CFX_AffineMatrix matrix; | 337 CFX_AffineMatrix matrix; |
| 352 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); | 338 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); |
| 353 | 339 |
| 354 FX_RECT clip; | 340 FX_RECT clip; |
| 355 clip.left = start_x; | 341 clip.left = start_x; |
| 356 clip.right = start_x + size_x; | 342 clip.right = start_x + size_x; |
| 357 clip.top = start_y; | 343 clip.top = start_y; |
| 358 clip.bottom = start_y + size_y; | 344 clip.bottom = start_y + size_y; |
| 359 | 345 |
| 360 #ifdef _SKIA_SUPPORT_ | 346 #ifdef _SKIA_SUPPORT_ |
| 361 nonstd::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); | 347 nonstd::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); |
| 362 #else | 348 #else |
| 363 nonstd::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); | 349 nonstd::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); |
| 364 #endif | 350 #endif |
| 365 #ifdef PDF_ENABLE_XFA | |
| 366 | |
| 367 if (!pDevice) | |
| 368 return; | |
| 369 #endif | |
| 370 pDevice->Attach((CFX_DIBitmap*)bitmap); | 351 pDevice->Attach((CFX_DIBitmap*)bitmap); |
| 371 pDevice->SaveState(); | 352 pDevice->SaveState(); |
| 372 pDevice->SetClip_Rect(&clip); | 353 pDevice->SetClip_Rect(&clip); |
| 373 | 354 |
| 374 #ifndef PDF_ENABLE_XFA | 355 #ifndef PDF_ENABLE_XFA |
| 375 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) | 356 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) |
| 376 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); | 357 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); |
| 377 #else | 358 #else // PDF_ENABLE_XFA |
| 378 CPDF_RenderOptions options; | 359 CPDF_RenderOptions options; |
| 379 if (flags & FPDF_LCD_TEXT) | 360 if (flags & FPDF_LCD_TEXT) |
| 380 options.m_Flags |= RENDER_CLEARTYPE; | 361 options.m_Flags |= RENDER_CLEARTYPE; |
| 381 else | 362 else |
| 382 options.m_Flags &= ~RENDER_CLEARTYPE; | 363 options.m_Flags &= ~RENDER_CLEARTYPE; |
| 383 | 364 |
| 384 // Grayscale output | 365 // Grayscale output |
| 385 if (flags & FPDF_GRAYSCALE) { | 366 if (flags & FPDF_GRAYSCALE) { |
| 386 options.m_ColorMode = RENDER_COLOR_GRAY; | 367 options.m_ColorMode = RENDER_COLOR_GRAY; |
| 387 options.m_ForeColor = 0; | 368 options.m_ForeColor = 0; |
| 388 options.m_BackColor = 0xffffff; | 369 options.m_BackColor = 0xffffff; |
| 389 } | 370 } |
| 390 options.m_AddFlags = flags >> 8; | 371 options.m_AddFlags = flags >> 8; |
| 391 options.m_pOCContext = new CPDF_OCContext(pPDFDoc); | 372 options.m_pOCContext = new CPDF_OCContext(pPDFDoc); |
| 392 | 373 |
| 393 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage)) | 374 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage)) |
| 394 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); | 375 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); |
| 395 #endif | 376 #endif // PDF_ENABLE_XFA |
| 396 | 377 |
| 397 pDevice->RestoreState(); | 378 pDevice->RestoreState(); |
| 398 delete options.m_pOCContext; | 379 delete options.m_pOCContext; |
| 399 #ifdef PDF_ENABLE_XFA | 380 #ifdef PDF_ENABLE_XFA |
| 400 options.m_pOCContext = NULL; | 381 options.m_pOCContext = NULL; |
| 382 #endif // PDF_ENABLE_XFA |
| 401 } | 383 } |
| 384 |
| 385 #ifdef PDF_ENABLE_XFA |
| 402 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, | 386 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, |
| 403 FPDF_WIDGET hWidget) { | 387 FPDF_WIDGET hWidget) { |
| 404 if (NULL == hWidget || NULL == document) | 388 if (NULL == hWidget || NULL == document) |
| 405 return; | 389 return; |
| 406 | 390 |
| 407 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 391 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 408 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 392 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 409 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 393 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 410 return; | 394 return; |
| 411 | 395 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 FPDF_BYTESTRING bsText, | 624 FPDF_BYTESTRING bsText, |
| 641 FPDF_DWORD size) { | 625 FPDF_DWORD size) { |
| 642 if (stringHandle == NULL || bsText == NULL || size <= 0) | 626 if (stringHandle == NULL || bsText == NULL || size <= 0) |
| 643 return FALSE; | 627 return FALSE; |
| 644 | 628 |
| 645 CFX_ByteStringArray* stringArr = (CFX_ByteStringArray*)stringHandle; | 629 CFX_ByteStringArray* stringArr = (CFX_ByteStringArray*)stringHandle; |
| 646 CFX_ByteString bsStr(bsText, size); | 630 CFX_ByteString bsStr(bsText, size); |
| 647 | 631 |
| 648 stringArr->Add(bsStr); | 632 stringArr->Add(bsStr); |
| 649 return TRUE; | 633 return TRUE; |
| 650 #endif | |
| 651 } | 634 } |
| 635 #endif // PDF_ENABLE_XFA |
| 652 | 636 |
| 653 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, | 637 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, |
| 654 int fieldType, | 638 int fieldType, |
| 655 unsigned long color) { | 639 unsigned long color) { |
| 656 if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle)) | 640 if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle)) |
| 657 pInterForm->SetHighlightColor(color, fieldType); | 641 pInterForm->SetHighlightColor(color, fieldType); |
| 658 } | 642 } |
| 659 | 643 |
| 660 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, | 644 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, |
| 661 unsigned char alpha) { | 645 unsigned char alpha) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 734 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
| 751 } | 735 } |
| 752 } else { | 736 } else { |
| 753 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 737 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 754 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 738 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 755 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 739 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 756 } | 740 } |
| 757 } | 741 } |
| 758 } | 742 } |
| 759 } | 743 } |
| OLD | NEW |