| 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 "../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 10 #include "../include/fpdfxfa/fpdfxfa_util.h" | 10 #include "../include/fpdfxfa/fpdfxfa_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 m_pWidgetHandler(NULL) | 34 m_pWidgetHandler(NULL) |
| 35 { | 35 { |
| 36 ASSERT(m_pInterForm != NULL); | 36 ASSERT(m_pInterForm != NULL); |
| 37 } | 37 } |
| 38 | 38 |
| 39 CPDFSDK_Widget::~CPDFSDK_Widget() | 39 CPDFSDK_Widget::~CPDFSDK_Widget() |
| 40 { | 40 { |
| 41 | 41 |
| 42 } | 42 } |
| 43 | 43 |
| 44 XFA_HWIDGET» CPDFSDK_Widget::GetMixXFAWidget() | 44 IXFA_Widget*» CPDFSDK_Widget::GetMixXFAWidget() |
| 45 { | 45 { |
| 46 ASSERT(m_pPageView != NULL); | 46 ASSERT(m_pPageView != NULL); |
| 47 | 47 |
| 48 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); | 48 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); |
| 49 ASSERT(pSDKDoc != NULL); | 49 ASSERT(pSDKDoc != NULL); |
| 50 | 50 |
| 51 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 51 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
| 52 ASSERT(pDoc != NULL); | 52 ASSERT(pDoc != NULL); |
| 53 | 53 |
| 54 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) | 54 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 70 if (!sName.IsEmpty()) | 70 if (!sName.IsEmpty()) |
| 71 m_hMixXFAWidget = pDocView->GetWidgetByN
ame(sName); | 71 m_hMixXFAWidget = pDocView->GetWidgetByN
ame(sName); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 return m_hMixXFAWidget; | 74 return m_hMixXFAWidget; |
| 75 } | 75 } |
| 76 | 76 |
| 77 return NULL; | 77 return NULL; |
| 78 } | 78 } |
| 79 | 79 |
| 80 XFA_HWIDGET» CPDFSDK_Widget::GetGroupMixXFAWidget() | 80 IXFA_Widget*» CPDFSDK_Widget::GetGroupMixXFAWidget() |
| 81 { | 81 { |
| 82 ASSERT(m_pPageView != NULL); | 82 ASSERT(m_pPageView != NULL); |
| 83 | 83 |
| 84 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); | 84 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); |
| 85 ASSERT(pSDKDoc != NULL); | 85 ASSERT(pSDKDoc != NULL); |
| 86 | 86 |
| 87 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 87 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
| 88 ASSERT(pDoc != NULL); | 88 ASSERT(pDoc != NULL); |
| 89 | 89 |
| 90 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) | 90 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 case CPDF_AAction::PrintDocument: | 200 case CPDF_AAction::PrintDocument: |
| 201 case CPDF_AAction::DocumentPrinted: | 201 case CPDF_AAction::DocumentPrinted: |
| 202 break; | 202 break; |
| 203 } | 203 } |
| 204 | 204 |
| 205 return eEventType; | 205 return eEventType; |
| 206 } | 206 } |
| 207 | 207 |
| 208 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) | 208 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) |
| 209 { | 209 { |
| 210 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 210 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 211 { | 211 { |
| 212 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 212 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 213 { | 213 { |
| 214 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); | 214 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); |
| 215 | 215 |
| 216 if ((eEventType == XFA_EVENT_Click || | 216 if ((eEventType == XFA_EVENT_Click || |
| 217 eEventType == XFA_EVENT_Change) && | 217 eEventType == XFA_EVENT_Change) && |
| 218 GetFieldType() == FIELDTYPE_RADIOBUTTON) | 218 GetFieldType() == FIELDTYPE_RADIOBUTTON) |
| 219 { | 219 { |
| 220 » » » » if (XFA_HWIDGET hGroupWidget = GetGroupMixXFAWid
get()) | 220 » » » » if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWi
dget()) |
| 221 { | 221 { |
| 222 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler
->GetDataAcc(hGroupWidget); | 222 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler
->GetDataAcc(hGroupWidget); |
| 223 if (pXFAWidgetHandler->HasEvent(pAcc, eE
ventType)) | 223 if (pXFAWidgetHandler->HasEvent(pAcc, eE
ventType)) |
| 224 return TRUE; | 224 return TRUE; |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 { | 228 { |
| 229 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDat
aAcc(hWidget); | 229 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDat
aAcc(hWidget); |
| 230 return pXFAWidgetHandler->HasEvent(pAcc, eEventT
ype); | 230 return pXFAWidgetHandler->HasEvent(pAcc, eEventT
ype); |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 return FALSE; | 235 return FALSE; |
| 236 } | 236 } |
| 237 | 237 |
| 238 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, PDFSDK_Field
Action& data, CPDFSDK_PageView* pPageView) | 238 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, PDFSDK_Field
Action& data, CPDFSDK_PageView* pPageView) |
| 239 { | 239 { |
| 240 ASSERT(m_pPageView != NULL); | 240 ASSERT(m_pPageView != NULL); |
| 241 | 241 |
| 242 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); | 242 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); |
| 243 ASSERT(pSDKDoc != NULL); | 243 ASSERT(pSDKDoc != NULL); |
| 244 | 244 |
| 245 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 245 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
| 246 ASSERT(pDoc != NULL); | 246 ASSERT(pDoc != NULL); |
| 247 | 247 |
| 248 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 248 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 249 { | 249 { |
| 250 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); | 250 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); |
| 251 | 251 |
| 252 if (eEventType != XFA_EVENT_Unknown) | 252 if (eEventType != XFA_EVENT_Unknown) |
| 253 { | 253 { |
| 254 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFA
WidgetHandler()) | 254 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFA
WidgetHandler()) |
| 255 { | 255 { |
| 256 CXFA_EventParam param; | 256 CXFA_EventParam param; |
| 257 param.m_eType = eEventType; | 257 param.m_eType = eEventType; |
| 258 param.m_wsChange = data.sChange; | 258 param.m_wsChange = data.sChange; |
| 259 param.m_iCommitKey = data.nCommitKey; | 259 param.m_iCommitKey = data.nCommitKey; |
| 260 param.m_bShift = data.bShift; | 260 param.m_bShift = data.bShift; |
| 261 param.m_iSelStart = data.nSelStart; | 261 param.m_iSelStart = data.nSelStart; |
| 262 param.m_iSelEnd = data.nSelEnd; | 262 param.m_iSelEnd = data.nSelEnd; |
| 263 param.m_wsFullText = data.sValue; | 263 param.m_wsFullText = data.sValue; |
| 264 param.m_bKeyDown = data.bKeyDown; | 264 param.m_bKeyDown = data.bKeyDown; |
| 265 param.m_bModifier = data.bModifier; | 265 param.m_bModifier = data.bModifier; |
| 266 param.m_wsNewText = data.sValue; | 266 param.m_wsNewText = data.sValue; |
| 267 if (data.nSelEnd > data.nSelStart) | 267 if (data.nSelEnd > data.nSelStart) |
| 268 param.m_wsNewText.Delete(data.nSelStart,
data.nSelEnd - data.nSelStart); | 268 param.m_wsNewText.Delete(data.nSelStart,
data.nSelEnd - data.nSelStart); |
| 269 for (int i=0; i<data.sChange.GetLength(); i++) | 269 for (int i=0; i<data.sChange.GetLength(); i++) |
| 270 param.m_wsNewText.Insert(data.nSelStart,
data.sChange[i]); | 270 param.m_wsNewText.Insert(data.nSelStart,
data.sChange[i]); |
| 271 param.m_wsPrevText = data.sValue; | 271 param.m_wsPrevText = data.sValue; |
| 272 | 272 |
| 273 if ((eEventType == XFA_EVENT_Click || | 273 if ((eEventType == XFA_EVENT_Click || |
| 274 eEventType == XFA_EVENT_Change) && | 274 eEventType == XFA_EVENT_Change) && |
| 275 GetFieldType() == FIELDTYPE_RADIOBUTTON) | 275 GetFieldType() == FIELDTYPE_RADIOBUTTON) |
| 276 { | 276 { |
| 277 » » » » » if (XFA_HWIDGET hGroupWidget = GetGroupM
ixXFAWidget()) | 277 » » » » » if (IXFA_Widget* hGroupWidget = GetGroup
MixXFAWidget()) |
| 278 { | 278 { |
| 279 CXFA_WidgetAcc* pAcc = pXFAWidge
tHandler->GetDataAcc(hGroupWidget); | 279 CXFA_WidgetAcc* pAcc = pXFAWidge
tHandler->GetDataAcc(hGroupWidget); |
| 280 param.m_pTarget = pAcc; | 280 param.m_pTarget = pAcc; |
| 281 pXFAWidgetHandler->ProcessEvent(
pAcc, ¶m); | 281 pXFAWidgetHandler->ProcessEvent(
pAcc, ¶m); |
| 282 } | 282 } |
| 283 | 283 |
| 284 { | 284 { |
| 285 CXFA_WidgetAcc* pAcc = pXFAWidge
tHandler->GetDataAcc(hWidget); | 285 CXFA_WidgetAcc* pAcc = pXFAWidge
tHandler->GetDataAcc(hWidget); |
| 286 param.m_pTarget = pAcc; | 286 param.m_pTarget = pAcc; |
| 287 FX_INT32 nRet = pXFAWidgetHandle
r->ProcessEvent(pAcc, ¶m); | 287 FX_INT32 nRet = pXFAWidgetHandle
r->ProcessEvent(pAcc, ¶m); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 return FALSE; | 307 return FALSE; |
| 308 } | 308 } |
| 309 | 309 |
| 310 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) | 310 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) |
| 311 { | 311 { |
| 312 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 312 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 313 { | 313 { |
| 314 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 314 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 315 { | 315 { |
| 316 CPDF_FormField* pFormField = GetFormField(); | 316 CPDF_FormField* pFormField = GetFormField(); |
| 317 ASSERT(pFormField != NULL); | 317 ASSERT(pFormField != NULL); |
| 318 | 318 |
| 319 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 319 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
| 320 { | 320 { |
| 321 switch (GetFieldType()) | 321 switch (GetFieldType()) |
| 322 { | 322 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 374 |
| 375 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); | 375 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); |
| 376 ASSERT(pSDKDoc != NULL); | 376 ASSERT(pSDKDoc != NULL); |
| 377 | 377 |
| 378 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 378 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
| 379 ASSERT(pDoc != NULL); | 379 ASSERT(pDoc != NULL); |
| 380 | 380 |
| 381 IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); | 381 IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); |
| 382 if (!pXFADocView) return; | 382 if (!pXFADocView) return; |
| 383 | 383 |
| 384 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 384 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 385 { | 385 { |
| 386 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 386 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 387 { | 387 { |
| 388 CPDF_FormField* pFormField = GetFormField(); | 388 CPDF_FormField* pFormField = GetFormField(); |
| 389 ASSERT(pFormField != NULL); | 389 ASSERT(pFormField != NULL); |
| 390 | 390 |
| 391 CPDF_FormControl* pFormCtrl = GetFormControl(); | 391 CPDF_FormControl* pFormCtrl = GetFormControl(); |
| 392 ASSERT(pFormCtrl != NULL); | 392 ASSERT(pFormCtrl != NULL); |
| 393 | 393 |
| 394 CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget
, pFormField, pFormCtrl); | 394 CPDFSDK_Widget::SynchronizeXFAValue(pXFADocView, hWidget
, pFormField, pFormCtrl); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 void CPDFSDK_Widget::SynchronizeXFAItems() | 399 void CPDFSDK_Widget::SynchronizeXFAItems() |
| 400 { | 400 { |
| 401 ASSERT(m_pPageView != NULL); | 401 ASSERT(m_pPageView != NULL); |
| 402 | 402 |
| 403 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); | 403 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); |
| 404 ASSERT(pSDKDoc != NULL); | 404 ASSERT(pSDKDoc != NULL); |
| 405 | 405 |
| 406 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 406 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
| 407 ASSERT(pDoc != NULL); | 407 ASSERT(pDoc != NULL); |
| 408 | 408 |
| 409 IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); | 409 IXFA_DocView* pXFADocView = pDoc->GetXFADocView(); |
| 410 if (!pXFADocView) return; | 410 if (!pXFADocView) return; |
| 411 | 411 |
| 412 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 412 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 413 { | 413 { |
| 414 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 414 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 415 { | 415 { |
| 416 CPDF_FormField* pFormField = GetFormField(); | 416 CPDF_FormField* pFormField = GetFormField(); |
| 417 ASSERT(pFormField != NULL); | 417 ASSERT(pFormField != NULL); |
| 418 | 418 |
| 419 SynchronizeXFAItems(pXFADocView, hWidget, pFormField, NU
LL); | 419 SynchronizeXFAItems(pXFADocView, hWidget, pFormField, NU
LL); |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| 424 void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView, XFA_HWIDGET
hWidget, | 424 void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView, IXFA_Widget*
hWidget, |
| 425 CPDF_FormField* pFormField, CPDF_FormControl* pFormControl) | 425 CPDF_FormField* pFormField, CPDF_FormControl* pFormControl) |
| 426 { | 426 { |
| 427 ASSERT(pXFADocView != NULL); | 427 ASSERT(pXFADocView != NULL); |
| 428 ASSERT(hWidget != NULL); | 428 ASSERT(hWidget != NULL); |
| 429 | 429 |
| 430 if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandle
r()) | 430 if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandle
r()) |
| 431 { | 431 { |
| 432 ASSERT(pFormField != NULL); | 432 ASSERT(pFormField != NULL); |
| 433 ASSERT(pFormControl != NULL); | 433 ASSERT(pFormControl != NULL); |
| 434 | 434 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 CFX_WideString sValue; | 503 CFX_WideString sValue; |
| 504 pWidgetAcc->GetValue(sValue, XFA_VALUEPI
CTURE_Display); | 504 pWidgetAcc->GetValue(sValue, XFA_VALUEPI
CTURE_Display); |
| 505 pFormField->SetValue(sValue, TRUE); | 505 pFormField->SetValue(sValue, TRUE); |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 break; | 508 break; |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 } | 511 } |
| 512 | 512 |
| 513 void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView, XFA_HWIDGET
hWidget, | 513 void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView, IXFA_Widget*
hWidget, |
| 514 CPDF_FormField* pFormField, CPDF_FormControl* pFormControl) | 514 CPDF_FormField* pFormField, CPDF_FormControl* pFormControl) |
| 515 { | 515 { |
| 516 ASSERT(pXFADocView != NULL); | 516 ASSERT(pXFADocView != NULL); |
| 517 ASSERT(hWidget != NULL); | 517 ASSERT(hWidget != NULL); |
| 518 | 518 |
| 519 if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandle
r()) | 519 if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandle
r()) |
| 520 { | 520 { |
| 521 ASSERT(pFormField != NULL); | 521 ASSERT(pFormField != NULL); |
| 522 | 522 |
| 523 switch (pFormField->GetFieldType()) | 523 switch (pFormField->GetFieldType()) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); | 762 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); |
| 763 CFX_ByteString csFont = ""; | 763 CFX_ByteString csFont = ""; |
| 764 FX_FLOAT fFontSize = 0.0f; | 764 FX_FLOAT fFontSize = 0.0f; |
| 765 pDa.GetFont(csFont, fFontSize); | 765 pDa.GetFont(csFont, fFontSize); |
| 766 | 766 |
| 767 return fFontSize; | 767 return fFontSize; |
| 768 } | 768 } |
| 769 | 769 |
| 770 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) | 770 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) |
| 771 { | 771 { |
| 772 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 772 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 773 { | 773 { |
| 774 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 774 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 775 { | 775 { |
| 776 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 776 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
| 777 { | 777 { |
| 778 if (nIndex < pWidgetAcc->CountSelectedItems()) | 778 if (nIndex < pWidgetAcc->CountSelectedItems()) |
| 779 return pWidgetAcc->GetSelectedItem(nInde
x); | 779 return pWidgetAcc->GetSelectedItem(nInde
x); |
| 780 } | 780 } |
| 781 } | 781 } |
| 782 } | 782 } |
| 783 | 783 |
| 784 CPDF_FormField* pFormField = GetFormField(); | 784 CPDF_FormField* pFormField = GetFormField(); |
| 785 ASSERT(pFormField != NULL); | 785 ASSERT(pFormField != NULL); |
| 786 | 786 |
| 787 return pFormField->GetSelectedIndex(nIndex); | 787 return pFormField->GetSelectedIndex(nIndex); |
| 788 } | 788 } |
| 789 | 789 |
| 790 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) | 790 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) |
| 791 { | 791 { |
| 792 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 792 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 793 { | 793 { |
| 794 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 794 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 795 { | 795 { |
| 796 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 796 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
| 797 { | 797 { |
| 798 CFX_WideString sValue; | 798 CFX_WideString sValue; |
| 799 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALU
EPICTURE_Display : XFA_VALUEPICTURE_Edit); | 799 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALU
EPICTURE_Display : XFA_VALUEPICTURE_Edit); |
| 800 return sValue; | 800 return sValue; |
| 801 } | 801 } |
| 802 } | 802 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 827 int CPDFSDK_Widget::CountOptions() const | 827 int CPDFSDK_Widget::CountOptions() const |
| 828 { | 828 { |
| 829 CPDF_FormField* pFormField = GetFormField(); | 829 CPDF_FormField* pFormField = GetFormField(); |
| 830 ASSERT(pFormField != NULL); | 830 ASSERT(pFormField != NULL); |
| 831 | 831 |
| 832 return pFormField->CountOptions(); | 832 return pFormField->CountOptions(); |
| 833 } | 833 } |
| 834 | 834 |
| 835 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) | 835 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) |
| 836 { | 836 { |
| 837 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 837 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 838 { | 838 { |
| 839 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) | 839 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHa
ndler()) |
| 840 { | 840 { |
| 841 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 841 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
| 842 { | 842 { |
| 843 if (nIndex > -1 && nIndex < pWidgetAcc->CountCho
iceListItems()) | 843 if (nIndex > -1 && nIndex < pWidgetAcc->CountCho
iceListItems()) |
| 844 return pWidgetAcc->GetItemState(nIndex); | 844 return pWidgetAcc->GetItemState(nIndex); |
| 845 else | 845 else |
| 846 return FALSE; | 846 return FALSE; |
| 847 } | 847 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 859 CPDF_FormField* pFormField = GetFormField(); | 859 CPDF_FormField* pFormField = GetFormField(); |
| 860 ASSERT(pFormField != NULL); | 860 ASSERT(pFormField != NULL); |
| 861 | 861 |
| 862 return pFormField->GetTopVisibleIndex(); | 862 return pFormField->GetTopVisibleIndex(); |
| 863 } | 863 } |
| 864 | 864 |
| 865 FX_BOOL CPDFSDK_Widget::IsChecked() | 865 FX_BOOL CPDFSDK_Widget::IsChecked() |
| 866 { | 866 { |
| 867 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) | 867 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) |
| 868 { | 868 { |
| 869 » » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 869 » » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 870 { | 870 { |
| 871 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) | 871 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetD
ataAcc(hWidget)) |
| 872 { | 872 { |
| 873 FX_BOOL bChecked = pWidgetAcc->GetCheckState() =
= XFA_CHECKSTATE_On; | 873 FX_BOOL bChecked = pWidgetAcc->GetCheckState() =
= XFA_CHECKSTATE_On; |
| 874 return bChecked; | 874 return bChecked; |
| 875 } | 875 } |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 | 878 |
| 879 CPDF_FormControl* pFormCtrl = GetFormControl(); | 879 CPDF_FormControl* pFormCtrl = GetFormControl(); |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2236 { | 2236 { |
| 2237 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 2237 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 2238 ASSERT(pDocument != NULL); | 2238 ASSERT(pDocument != NULL); |
| 2239 | 2239 |
| 2240 CPDFXFA_Document* pDoc = pDocument->GetDocument(); | 2240 CPDFXFA_Document* pDoc = pDocument->GetDocument(); |
| 2241 ASSERT(pDoc != NULL); | 2241 ASSERT(pDoc != NULL); |
| 2242 | 2242 |
| 2243 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 2243 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 2244 ASSERT(pEnv != NULL); | 2244 ASSERT(pEnv != NULL); |
| 2245 | 2245 |
| 2246 » if (XFA_HWIDGET hWidget = this->GetMixXFAWidget()) | 2246 » if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) |
| 2247 { | 2247 { |
| 2248 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommi
t); | 2248 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommi
t); |
| 2249 | 2249 |
| 2250 if (eEventType != XFA_EVENT_Unknown) | 2250 if (eEventType != XFA_EVENT_Unknown) |
| 2251 { | 2251 { |
| 2252 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFA
WidgetHandler()) | 2252 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFA
WidgetHandler()) |
| 2253 { | 2253 { |
| 2254 CXFA_EventParam param; | 2254 CXFA_EventParam param; |
| 2255 param.m_eType = eEventType; | 2255 param.m_eType = eEventType; |
| 2256 param.m_wsChange = data.sChange; | 2256 param.m_wsChange = data.sChange; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 int nFieldFlags = GetFieldFlags(); | 2361 int nFieldFlags = GetFieldFlags(); |
| 2362 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 2362 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
| 2363 return FALSE; | 2363 return FALSE; |
| 2364 | 2364 |
| 2365 return TRUE; | 2365 return TRUE; |
| 2366 } | 2366 } |
| 2367 return FALSE; | 2367 return FALSE; |
| 2368 } | 2368 } |
| 2369 | 2369 |
| 2370 //CPDFSDK_XFAWidget | 2370 //CPDFSDK_XFAWidget |
| 2371 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(XFA_HWIDGET pAnnot, CPDFSDK_PageView* pPage
View, CPDFSDK_InterForm* pInterForm) : | 2371 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPag
eView, CPDFSDK_InterForm* pInterForm) : |
| 2372 CPDFSDK_Annot(pPageView), | 2372 CPDFSDK_Annot(pPageView), |
| 2373 m_hXFAWidget(pAnnot), | 2373 m_hXFAWidget(pAnnot), |
| 2374 m_pInterForm(pInterForm) | 2374 m_pInterForm(pInterForm) |
| 2375 { | 2375 { |
| 2376 | 2376 |
| 2377 } | 2377 } |
| 2378 | 2378 |
| 2379 FX_BOOL CPDFSDK_XFAWidget::IsXFAField() | 2379 FX_BOOL CPDFSDK_XFAWidget::IsXFAField() |
| 2380 { | 2380 { |
| 2381 return TRUE; | 2381 return TRUE; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidg
et) | 2568 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidg
et) |
| 2569 { | 2569 { |
| 2570 m_Map.SetAt(pControl, pWidget); | 2570 m_Map.SetAt(pControl, pWidget); |
| 2571 } | 2571 } |
| 2572 | 2572 |
| 2573 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) | 2573 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) |
| 2574 { | 2574 { |
| 2575 m_Map.RemoveKey(pControl); | 2575 m_Map.RemoveKey(pControl); |
| 2576 } | 2576 } |
| 2577 | 2577 |
| 2578 void CPDFSDK_InterForm::AddXFAMap(XFA_HWIDGET hWidget, CPDFSDK_XFAWidget* pWidge
t) | 2578 void CPDFSDK_InterForm::AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidg
et) |
| 2579 { | 2579 { |
| 2580 m_XFAMap.SetAt(hWidget, pWidget); | 2580 m_XFAMap.SetAt(hWidget, pWidget); |
| 2581 } | 2581 } |
| 2582 | 2582 |
| 2583 void CPDFSDK_InterForm::RemoveXFAMap(XFA_HWIDGET hWidget) | 2583 void CPDFSDK_InterForm::RemoveXFAMap(IXFA_Widget* hWidget) |
| 2584 { | 2584 { |
| 2585 m_XFAMap.RemoveKey(hWidget); | 2585 m_XFAMap.RemoveKey(hWidget); |
| 2586 } | 2586 } |
| 2587 | 2587 |
| 2588 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(XFA_HWIDGET hWidget) | 2588 CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(IXFA_Widget* hWidget) |
| 2589 { | 2589 { |
| 2590 CPDFSDK_XFAWidget* pWidget = NULL; | 2590 CPDFSDK_XFAWidget* pWidget = NULL; |
| 2591 m_XFAMap.Lookup(hWidget, pWidget); | 2591 m_XFAMap.Lookup(hWidget, pWidget); |
| 2592 | 2592 |
| 2593 return pWidget; | 2593 return pWidget; |
| 2594 } | 2594 } |
| 2595 | 2595 |
| 2596 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) | 2596 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) |
| 2597 { | 2597 { |
| 2598 m_bCalculate = bEnabled; | 2598 m_bCalculate = bEnabled; |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3785 | 3785 |
| 3786 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 3786 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 3787 ASSERT(pPDFAnnot != NULL); | 3787 ASSERT(pPDFAnnot != NULL); |
| 3788 | 3788 |
| 3789 CPDF_Rect rcAnnot; | 3789 CPDF_Rect rcAnnot; |
| 3790 pPDFAnnot->GetRect(rcAnnot); | 3790 pPDFAnnot->GetRect(rcAnnot); |
| 3791 | 3791 |
| 3792 return rcAnnot; | 3792 return rcAnnot; |
| 3793 } | 3793 } |
| 3794 | 3794 |
| OLD | NEW |