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 #include "public/fpdf_formfill.h" | 7 #include "public/fpdf_formfill.h" |
| 8 | 8 |
| 9 #ifdef PDF_ENABLE_XFA | |
| 9 #include "../include/fpdfxfa/fpdfxfa_app.h" | 10 #include "../include/fpdfxfa/fpdfxfa_app.h" |
| 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 11 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 11 #include "../include/fpdfxfa/fpdfxfa_page.h" | 12 #include "../include/fpdfxfa/fpdfxfa_page.h" |
| 13 #endif | |
| 12 #include "fpdfsdk/include/fsdk_define.h" | 14 #include "fpdfsdk/include/fsdk_define.h" |
| 13 #include "fpdfsdk/include/fsdk_mgr.h" | 15 #include "fpdfsdk/include/fsdk_mgr.h" |
| 14 #include "public/fpdfview.h" | 16 #include "public/fpdfview.h" |
| 15 #include "third_party/base/nonstd_unique_ptr.h" | 17 #include "third_party/base/nonstd_unique_ptr.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 CPDFSDK_Document* FormHandleToSDKDoc(FPDF_FORMHANDLE hHandle) { | 21 CPDFSDK_Document* FormHandleToSDKDoc(FPDF_FORMHANDLE hHandle) { |
| 20 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 22 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
| 21 return pEnv ? pEnv->GetSDKDocument() : nullptr; | 23 return pEnv ? pEnv->GetSDKDocument() : nullptr; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 38 | 40 |
| 39 } // namespace | 41 } // namespace |
| 40 | 42 |
| 41 DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 43 DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 42 FPDF_PAGE page, | 44 FPDF_PAGE page, |
| 43 double page_x, | 45 double page_x, |
| 44 double page_y) { | 46 double page_y) { |
| 45 if (!hHandle) | 47 if (!hHandle) |
| 46 return -1; | 48 return -1; |
| 47 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 49 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 50 #ifndef 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 | |
| 48 if (pPage) { | 59 if (pPage) { |
| 49 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | 60 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 50 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( | 61 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( |
| 51 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); | 62 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); |
| 52 if (!pFormCtrl) | 63 if (!pFormCtrl) |
| 53 return -1; | 64 return -1; |
| 54 | 65 |
| 55 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 66 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| 56 if (!pFormField) | 67 if (!pFormField) |
| 57 return -1; | 68 return -1; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 if (rcWidget.Contains(static_cast<FX_FLOAT>(page_x), | 103 if (rcWidget.Contains(static_cast<FX_FLOAT>(page_x), |
| 93 static_cast<FX_FLOAT>(page_y))) { | 104 static_cast<FX_FLOAT>(page_y))) { |
| 94 pWidgetIterator->Release(); | 105 pWidgetIterator->Release(); |
| 95 return FPDF_FORMFIELD_XFA; | 106 return FPDF_FORMFIELD_XFA; |
| 96 } | 107 } |
| 97 pXFAAnnot = pWidgetIterator->MoveToNext(); | 108 pXFAAnnot = pWidgetIterator->MoveToNext(); |
| 98 } | 109 } |
| 99 | 110 |
| 100 pWidgetIterator->Release(); | 111 pWidgetIterator->Release(); |
| 101 } | 112 } |
| 113 #endif | |
| 102 | 114 |
| 115 #ifndef PDF_ENABLE_XFA | |
| 116 CPDF_FormField* pFormField = pFormCtrl->GetField(); | |
| 117 return pFormField ? pFormField->GetFieldType() : -1; | |
| 118 #else | |
| 103 return -1; | 119 return -1; |
| 120 #endif | |
| 104 } | 121 } |
| 105 | 122 |
| 106 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 123 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 107 FPDF_PAGE page, | 124 FPDF_PAGE page, |
| 108 double page_x, | 125 double page_x, |
| 109 double page_y) { | 126 double page_y) { |
| 110 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); | 127 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); |
| 111 } | 128 } |
| 112 | 129 |
| 113 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, | 130 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, |
| 114 FPDF_PAGE page, | 131 FPDF_PAGE page, |
| 115 double page_x, | 132 double page_x, |
| 116 double page_y) { | 133 double page_y) { |
| 117 if (!hHandle) | 134 if (!hHandle) |
| 118 return -1; | 135 return -1; |
| 119 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 136 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 120 if (!pPage) | 137 if (!pPage) |
| 121 return -1; | 138 return -1; |
| 122 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | 139 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 123 int z_order = -1; | 140 int z_order = -1; |
| 124 (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, | 141 (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, |
| 125 &z_order); | 142 &z_order); |
| 126 return z_order; | 143 return z_order; |
| 127 } | 144 } |
| 128 | 145 |
| 129 DLLEXPORT FPDF_FORMHANDLE STDCALL | 146 DLLEXPORT FPDF_FORMHANDLE STDCALL |
| 130 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, | 147 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, |
| 131 FPDF_FORMFILLINFO* formInfo) { | 148 FPDF_FORMFILLINFO* formInfo) { |
| 149 #ifndef PDF_ENABLE_XFA | |
| 150 const int kRequiredVersion = 1; | |
| 151 #else | |
| 132 const int kRequiredVersion = 2; | 152 const int kRequiredVersion = 2; |
| 153 #endif | |
| 133 if (!formInfo || formInfo->version != kRequiredVersion) | 154 if (!formInfo || formInfo->version != kRequiredVersion) |
| 134 return nullptr; | 155 return nullptr; |
| 135 | 156 |
| 136 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); | 157 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); |
| 137 if (!pDocument) | 158 if (!pDocument) |
| 138 return nullptr; | 159 return nullptr; |
| 139 | 160 |
| 140 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); | 161 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); |
| 162 #ifndef PDF_ENABLE_XFA | |
| 163 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); | |
| 164 #else | |
| 141 pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv)); | 165 pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv)); |
| 142 | 166 |
| 143 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | 167 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); |
| 144 pApp->AddFormFillEnv(pEnv); | 168 pApp->AddFormFillEnv(pEnv); |
| 169 #endif | |
| 145 return pEnv; | 170 return pEnv; |
| 146 } | 171 } |
| 147 | 172 |
| 148 DLLEXPORT void STDCALL | 173 DLLEXPORT void STDCALL |
| 149 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { | 174 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { |
| 150 if (!hHandle) | 175 if (!hHandle) |
| 151 return; | 176 return; |
| 177 #ifndef PDF_ENABLE_XFA | |
| 178 | |
| 179 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | |
| 180 if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) { | |
| 181 pEnv->SetSDKDocument(NULL); | |
| 182 delete pSDKDoc; | |
| 183 } | |
| 184 delete pEnv; | |
| 185 #else | |
| 152 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | 186 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); |
| 153 pApp->RemoveFormFillEnv((CPDFDoc_Environment*)hHandle); | 187 pApp->RemoveFormFillEnv((CPDFDoc_Environment*)hHandle); |
| 154 delete (CPDFDoc_Environment*)hHandle; | 188 delete (CPDFDoc_Environment*)hHandle; |
| 189 #endif | |
| 155 } | 190 } |
| 156 | 191 |
| 157 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, | 192 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, |
| 158 FPDF_PAGE page, | 193 FPDF_PAGE page, |
| 159 int modifier, | 194 int modifier, |
| 160 double page_x, | 195 double page_x, |
| 161 double page_y) { | 196 double page_y) { |
| 162 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 197 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 163 if (!pPageView) | 198 if (!pPageView) |
| 164 return FALSE; | 199 return FALSE; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 186 double page_x, | 221 double page_x, |
| 187 double page_y) { | 222 double page_y) { |
| 188 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 223 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 189 if (!pPageView) | 224 if (!pPageView) |
| 190 return FALSE; | 225 return FALSE; |
| 191 | 226 |
| 192 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); | 227 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); |
| 193 return pPageView->OnLButtonUp(pt, modifier); | 228 return pPageView->OnLButtonUp(pt, modifier); |
| 194 } | 229 } |
| 195 | 230 |
| 231 #ifdef PDF_ENABLE_XFA | |
| 196 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, | 232 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, |
| 197 FPDF_PAGE page, | 233 FPDF_PAGE page, |
| 198 int modifier, | 234 int modifier, |
| 199 double page_x, | 235 double page_x, |
| 200 double page_y) { | 236 double page_y) { |
| 201 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 237 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 202 if (!pPageView) | 238 if (!pPageView) |
| 203 return FALSE; | 239 return FALSE; |
| 204 | 240 |
| 205 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); | 241 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); |
| 206 return pPageView->OnRButtonDown(pt, modifier); | 242 return pPageView->OnRButtonDown(pt, modifier); |
| 207 } | 243 } |
| 208 | 244 |
| 209 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, | 245 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, |
| 210 FPDF_PAGE page, | 246 FPDF_PAGE page, |
| 211 int modifier, | 247 int modifier, |
| 212 double page_x, | 248 double page_x, |
| 213 double page_y) { | 249 double page_y) { |
| 214 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 250 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 215 if (!pPageView) | 251 if (!pPageView) |
| 216 return FALSE; | 252 return FALSE; |
| 217 | 253 |
| 218 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); | 254 CPDF_Point pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); |
| 219 return pPageView->OnRButtonUp(pt, modifier); | 255 return pPageView->OnRButtonUp(pt, modifier); |
| 220 } | 256 } |
| 221 | 257 |
| 258 #endif | |
| 222 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, | 259 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, |
| 223 FPDF_PAGE page, | 260 FPDF_PAGE page, |
| 224 int nKeyCode, | 261 int nKeyCode, |
| 225 int modifier) { | 262 int modifier) { |
| 226 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); | 263 CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 227 if (!pPageView) | 264 if (!pPageView) |
| 228 return FALSE; | 265 return FALSE; |
| 229 | 266 |
| 230 return pPageView->OnKeyDown(nKeyCode, modifier); | 267 return pPageView->OnKeyDown(nKeyCode, modifier); |
| 231 } | 268 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 262 | 299 |
| 263 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, | 300 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, |
| 264 FPDF_BITMAP bitmap, | 301 FPDF_BITMAP bitmap, |
| 265 FPDF_PAGE page, | 302 FPDF_PAGE page, |
| 266 int start_x, | 303 int start_x, |
| 267 int start_y, | 304 int start_y, |
| 268 int size_x, | 305 int size_x, |
| 269 int size_y, | 306 int size_y, |
| 270 int rotate, | 307 int rotate, |
| 271 int flags) { | 308 int flags) { |
| 309 #ifndef PDF_ENABLE_XFA | |
| 310 if (!hHandle) | |
| 311 #else | |
| 272 if (!hHandle || !page) | 312 if (!hHandle || !page) |
|
Lei Zhang
2015/11/25 00:12:02
Needs more merging here.
| |
| 313 #endif | |
| 273 return; | 314 return; |
| 274 | 315 |
| 316 #ifndef PDF_ENABLE_XFA | |
| 317 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | |
| 318 if (!pPage) | |
| 319 #else | |
| 275 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; | 320 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; |
| 276 CPDFXFA_Document* pDocument = pPage->GetDocument(); | 321 CPDFXFA_Document* pDocument = pPage->GetDocument(); |
| 277 if (!pDocument) | 322 if (!pDocument) |
| 278 return; | 323 return; |
| 279 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); | 324 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); |
| 280 if (!pPDFDoc) | 325 if (!pPDFDoc) |
| 326 #endif | |
| 281 return; | 327 return; |
| 282 | 328 |
| 329 #ifndef PDF_ENABLE_XFA | |
| 330 CPDF_RenderOptions options; | |
| 331 if (flags & FPDF_LCD_TEXT) | |
| 332 options.m_Flags |= RENDER_CLEARTYPE; | |
| 333 else | |
| 334 options.m_Flags &= ~RENDER_CLEARTYPE; | |
| 335 | |
| 336 // Grayscale output | |
| 337 if (flags & FPDF_GRAYSCALE) { | |
| 338 options.m_ColorMode = RENDER_COLOR_GRAY; | |
| 339 options.m_ForeColor = 0; | |
| 340 options.m_BackColor = 0xffffff; | |
| 341 } | |
| 342 | |
| 343 options.m_AddFlags = flags >> 8; | |
| 344 options.m_pOCContext = new CPDF_OCContext(pPage->m_pDocument); | |
| 345 #else | |
| 283 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 346 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
| 284 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); | 347 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); |
| 285 if (!pFXDoc) | 348 if (!pFXDoc) |
| 286 return; | 349 return; |
| 350 #endif | |
| 287 | 351 |
| 288 CFX_AffineMatrix matrix; | 352 CFX_AffineMatrix matrix; |
| 289 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); | 353 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); |
| 290 | 354 |
| 291 FX_RECT clip; | 355 FX_RECT clip; |
| 292 clip.left = start_x; | 356 clip.left = start_x; |
| 293 clip.right = start_x + size_x; | 357 clip.right = start_x + size_x; |
| 294 clip.top = start_y; | 358 clip.top = start_y; |
| 295 clip.bottom = start_y + size_y; | 359 clip.bottom = start_y + size_y; |
| 296 | 360 |
| 297 #ifdef _SKIA_SUPPORT_ | 361 #ifdef _SKIA_SUPPORT_ |
| 298 nonstd::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); | 362 nonstd::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); |
| 299 #else | 363 #else |
| 300 nonstd::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); | 364 nonstd::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); |
| 301 #endif | 365 #endif |
| 366 #ifdef PDF_ENABLE_XFA | |
| 302 | 367 |
| 303 if (!pDevice) | 368 if (!pDevice) |
| 304 return; | 369 return; |
| 370 #endif | |
| 305 pDevice->Attach((CFX_DIBitmap*)bitmap); | 371 pDevice->Attach((CFX_DIBitmap*)bitmap); |
| 306 pDevice->SaveState(); | 372 pDevice->SaveState(); |
| 307 pDevice->SetClip_Rect(&clip); | 373 pDevice->SetClip_Rect(&clip); |
| 308 | 374 |
| 375 #ifndef PDF_ENABLE_XFA | |
| 376 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) | |
| 377 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); | |
| 378 #else | |
| 309 CPDF_RenderOptions options; | 379 CPDF_RenderOptions options; |
| 310 if (flags & FPDF_LCD_TEXT) | 380 if (flags & FPDF_LCD_TEXT) |
| 311 options.m_Flags |= RENDER_CLEARTYPE; | 381 options.m_Flags |= RENDER_CLEARTYPE; |
| 312 else | 382 else |
| 313 options.m_Flags &= ~RENDER_CLEARTYPE; | 383 options.m_Flags &= ~RENDER_CLEARTYPE; |
| 314 | 384 |
| 315 // Grayscale output | 385 // Grayscale output |
| 316 if (flags & FPDF_GRAYSCALE) { | 386 if (flags & FPDF_GRAYSCALE) { |
| 317 options.m_ColorMode = RENDER_COLOR_GRAY; | 387 options.m_ColorMode = RENDER_COLOR_GRAY; |
| 318 options.m_ForeColor = 0; | 388 options.m_ForeColor = 0; |
| 319 options.m_BackColor = 0xffffff; | 389 options.m_BackColor = 0xffffff; |
| 320 } | 390 } |
| 321 options.m_AddFlags = flags >> 8; | 391 options.m_AddFlags = flags >> 8; |
| 322 options.m_pOCContext = new CPDF_OCContext(pPDFDoc); | 392 options.m_pOCContext = new CPDF_OCContext(pPDFDoc); |
| 323 | 393 |
| 324 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDFXFA_Page*)page)) | 394 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDFXFA_Page*)page)) |
| 325 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); | 395 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); |
| 396 #endif | |
| 326 | 397 |
| 327 pDevice->RestoreState(); | 398 pDevice->RestoreState(); |
| 328 delete options.m_pOCContext; | 399 delete options.m_pOCContext; |
| 400 #ifdef PDF_ENABLE_XFA | |
| 329 options.m_pOCContext = NULL; | 401 options.m_pOCContext = NULL; |
| 330 } | 402 } |
| 331 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, | 403 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, |
| 332 FPDF_WIDGET hWidget) { | 404 FPDF_WIDGET hWidget) { |
| 333 if (NULL == hWidget || NULL == document) | 405 if (NULL == hWidget || NULL == document) |
| 334 return; | 406 return; |
| 335 | 407 |
| 336 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 408 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 337 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 409 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 338 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 410 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 FPDF_BYTESTRING bsText, | 641 FPDF_BYTESTRING bsText, |
| 570 FPDF_DWORD size) { | 642 FPDF_DWORD size) { |
| 571 if (stringHandle == NULL || bsText == NULL || size <= 0) | 643 if (stringHandle == NULL || bsText == NULL || size <= 0) |
| 572 return FALSE; | 644 return FALSE; |
| 573 | 645 |
| 574 CFX_ByteStringArray* stringArr = (CFX_ByteStringArray*)stringHandle; | 646 CFX_ByteStringArray* stringArr = (CFX_ByteStringArray*)stringHandle; |
| 575 CFX_ByteString bsStr(bsText, size); | 647 CFX_ByteString bsStr(bsText, size); |
| 576 | 648 |
| 577 stringArr->Add(bsStr); | 649 stringArr->Add(bsStr); |
| 578 return TRUE; | 650 return TRUE; |
| 651 #endif | |
| 579 } | 652 } |
| 580 | 653 |
| 581 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, | 654 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, |
| 582 int fieldType, | 655 int fieldType, |
| 583 unsigned long color) { | 656 unsigned long color) { |
| 584 if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle)) | 657 if (CPDFSDK_InterForm* pInterForm = FormHandleToInterForm(hHandle)) |
| 585 pInterForm->SetHighlightColor(color, fieldType); | 658 pInterForm->SetHighlightColor(color, fieldType); |
| 586 } | 659 } |
| 587 | 660 |
| 588 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, | 661 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 751 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
| 679 } | 752 } |
| 680 } else { | 753 } else { |
| 681 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 754 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 682 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 755 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 683 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 756 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 684 } | 757 } |
| 685 } | 758 } |
| 686 } | 759 } |
| 687 } | 760 } |
| OLD | NEW |