| OLD | NEW | 
|---|
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" | 7 #include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" | 
| 8 | 8 | 
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 54 | 54 | 
| 55 void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, | 55 void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, | 
| 56                                             const CFX_RectF& rt, | 56                                             const CFX_RectF& rt, | 
| 57                                             uint32_t dwFlags /* = 0 */) { | 57                                             uint32_t dwFlags /* = 0 */) { | 
| 58   if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 58   if (!m_pDocument->GetXFADoc() || !m_pDocument->GetSDKDoc()) | 
| 59     return; | 59     return; | 
| 60 | 60 | 
| 61   if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 61   if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA) | 
| 62     return; | 62     return; | 
| 63 | 63 | 
| 64   CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView); | 64   CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView); | 
| 65   if (!pPage) | 65   if (!pPage) | 
| 66     return; | 66     return; | 
| 67 | 67 | 
| 68   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 68   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 
| 69   if (!pEnv) | 69   if (!pEnv) | 
| 70     return; | 70     return; | 
| 71 | 71 | 
| 72   CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); | 72   CFX_FloatRect rcPage = CFX_FloatRect::FromCFXRectF(rt); | 
| 73   pEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, rcPage.right, | 73   pEnv->Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, rcPage.right, | 
| 74                    rcPage.top); | 74                    rcPage.top); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 86 | 86 | 
| 87   CXFA_FFWidgetHandler* pWidgetHandler = | 87   CXFA_FFWidgetHandler* pWidgetHandler = | 
| 88       m_pDocument->GetXFADocView()->GetWidgetHandler(); | 88       m_pDocument->GetXFADocView()->GetWidgetHandler(); | 
| 89   if (!pWidgetHandler) | 89   if (!pWidgetHandler) | 
| 90     return; | 90     return; | 
| 91 | 91 | 
| 92   CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 92   CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 
| 93   if (!pPageView) | 93   if (!pPageView) | 
| 94     return; | 94     return; | 
| 95 | 95 | 
| 96   CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView); | 96   CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView); | 
| 97   if (!pPage) | 97   if (!pPage) | 
| 98     return; | 98     return; | 
| 99 | 99 | 
| 100   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 100   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 
| 101   if (!pEnv) | 101   if (!pEnv) | 
| 102     return; | 102     return; | 
| 103 | 103 | 
| 104   CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); | 104   CFX_FloatRect rcCaret = CFX_FloatRect::FromCFXRectF(*pRtAnchor); | 
| 105   pEnv->DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, | 105   pEnv->DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, | 
| 106                      rcCaret.right, rcCaret.bottom); | 106                      rcCaret.right, rcCaret.bottom); | 
| 107 } | 107 } | 
| 108 | 108 | 
| 109 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, | 109 FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget, | 
| 110                                             FX_FLOAT fMinPopup, | 110                                             FX_FLOAT fMinPopup, | 
| 111                                             FX_FLOAT fMaxPopup, | 111                                             FX_FLOAT fMaxPopup, | 
| 112                                             const CFX_RectF& rtAnchor, | 112                                             const CFX_RectF& rtAnchor, | 
| 113                                             CFX_RectF& rtPopup) { | 113                                             CFX_RectF& rtPopup) { | 
| 114   if (!hWidget) | 114   if (!hWidget) | 
| 115     return FALSE; | 115     return FALSE; | 
| 116 | 116 | 
| 117   CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 117   CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 
| 118   if (!pXFAPageView) | 118   if (!pXFAPageView) | 
| 119     return FALSE; | 119     return FALSE; | 
| 120 | 120 | 
| 121   CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView); | 121   CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView); | 
| 122   if (!pPage) | 122   if (!pPage) | 
| 123     return FALSE; | 123     return FALSE; | 
| 124 | 124 | 
| 125   CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); | 125   CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); | 
| 126   int nRotate = pWidgetAcc->GetRotate(); | 126   int nRotate = pWidgetAcc->GetRotate(); | 
| 127   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 127   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 
| 128   if (!pEnv) | 128   if (!pEnv) | 
| 129     return FALSE; | 129     return FALSE; | 
| 130 | 130 | 
| 131   FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; | 131   FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 224 | 224 | 
| 225 FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget, | 225 FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget, | 
| 226                                           CFX_PointF ptPopup) { | 226                                           CFX_PointF ptPopup) { | 
| 227   if (!hWidget) | 227   if (!hWidget) | 
| 228     return FALSE; | 228     return FALSE; | 
| 229 | 229 | 
| 230   CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 230   CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 
| 231   if (!pXFAPageView) | 231   if (!pXFAPageView) | 
| 232     return FALSE; | 232     return FALSE; | 
| 233 | 233 | 
| 234   CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView); | 234   CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView); | 
| 235   if (!pPage) | 235   if (!pPage) | 
| 236     return FALSE; | 236     return FALSE; | 
| 237 | 237 | 
| 238   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 238   CPDFSDK_Environment* pEnv = m_pDocument->GetSDKDoc()->GetEnv(); | 
| 239   if (!pEnv) | 239   if (!pEnv) | 
| 240     return FALSE; | 240     return FALSE; | 
| 241 | 241 | 
| 242   int menuFlag = 0; | 242   int menuFlag = 0; | 
| 243   if (hWidget->CanUndo()) | 243   if (hWidget->CanUndo()) | 
| 244     menuFlag |= FXFA_MENU_UNDO; | 244     menuFlag |= FXFA_MENU_UNDO; | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 295 | 295 | 
| 296 void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, | 296 void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, | 
| 297                                            CXFA_WidgetAcc* pWidgetData) { | 297                                            CXFA_WidgetAcc* pWidgetData) { | 
| 298   if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) | 298   if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) | 
| 299     return; | 299     return; | 
| 300 | 300 | 
| 301   CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 301   CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 
| 302   if (!pPageView) | 302   if (!pPageView) | 
| 303     return; | 303     return; | 
| 304 | 304 | 
| 305   CPDFXFA_Page* pXFAPage = m_pDocument->GetPage(pPageView); | 305   CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView); | 
| 306   if (!pXFAPage) | 306   if (!pXFAPage) | 
| 307     return; | 307     return; | 
| 308 | 308 | 
| 309   m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true)->AddAnnot(hWidget); | 309   m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true)->AddAnnot(hWidget); | 
| 310 } | 310 } | 
| 311 | 311 | 
| 312 void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget, | 312 void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget, | 
| 313                                              CXFA_WidgetAcc* pWidgetData) { | 313                                              CXFA_WidgetAcc* pWidgetData) { | 
| 314   if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) | 314   if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA || !hWidget) | 
| 315     return; | 315     return; | 
| 316 | 316 | 
| 317   CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 317   CXFA_FFPageView* pPageView = hWidget->GetPageView(); | 
| 318   if (!pPageView) | 318   if (!pPageView) | 
| 319     return; | 319     return; | 
| 320 | 320 | 
| 321   CPDFXFA_Page* pXFAPage = m_pDocument->GetPage(pPageView); | 321   CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView); | 
| 322   if (!pXFAPage) | 322   if (!pXFAPage) | 
| 323     return; | 323     return; | 
| 324 | 324 | 
| 325   CPDFSDK_PageView* pSdkPageView = | 325   CPDFSDK_PageView* pSdkPageView = | 
| 326       m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true); | 326       m_pDocument->GetSDKDoc()->GetPageView(pXFAPage, true); | 
| 327   if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) | 327   if (CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget)) | 
| 328     pSdkPageView->DeleteAnnot(pAnnot); | 328     pSdkPageView->DeleteAnnot(pAnnot); | 
| 329 } | 329 } | 
| 330 | 330 | 
| 331 int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { | 331 int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { | 
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1012   if (!m_pJSContext) { | 1012   if (!m_pJSContext) { | 
| 1013     m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 1013     m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->SetReaderDocument( | 
| 1014         m_pDocument->GetSDKDoc()); | 1014         m_pDocument->GetSDKDoc()); | 
| 1015     m_pJSContext = | 1015     m_pJSContext = | 
| 1016         m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 1016         m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->NewContext(); | 
| 1017   } | 1017   } | 
| 1018 | 1018 | 
| 1019   return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 1019   return m_pDocument->GetSDKDoc()->GetEnv()->GetJSRuntime()->GetValueByName( | 
| 1020       szPropName, pValue); | 1020       szPropName, pValue); | 
| 1021 } | 1021 } | 
| OLD | NEW | 
|---|