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 "xfa/fxfa/include/xfa_ffwidgethandler.h" | 7 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 return nullptr; | 321 return nullptr; |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
325 CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, | 325 CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, |
326 CXFA_Node* pBefore) const { | 326 CXFA_Node* pBefore) const { |
327 CXFA_Node* pField = CreateField(XFA_ELEMENT_Button, pParent, pBefore); | 327 CXFA_Node* pField = CreateField(XFA_ELEMENT_Button, pParent, pBefore); |
328 CXFA_Node* pCaption = CreateCopyNode(XFA_ELEMENT_Caption, pField); | 328 CXFA_Node* pCaption = CreateCopyNode(XFA_ELEMENT_Caption, pField); |
329 CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pCaption); | 329 CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pCaption); |
330 CXFA_Node* pText = CreateCopyNode(XFA_ELEMENT_Text, pValue); | 330 CXFA_Node* pText = CreateCopyNode(XFA_ELEMENT_Text, pValue); |
331 pText->SetContent(FX_WSTRC(L"Button"), FX_WSTRC(L"Button"), FALSE); | 331 pText->SetContent(L"Button", L"Button", FALSE); |
332 | 332 |
333 CXFA_Node* pPara = CreateCopyNode(XFA_ELEMENT_Para, pCaption); | 333 CXFA_Node* pPara = CreateCopyNode(XFA_ELEMENT_Para, pCaption); |
334 pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, FALSE); | 334 pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, FALSE); |
335 pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, FALSE); | 335 pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, FALSE); |
336 CreateFontNode(pCaption); | 336 CreateFontNode(pCaption); |
337 | 337 |
338 CXFA_Node* pBorder = CreateCopyNode(XFA_ELEMENT_Border, pField); | 338 CXFA_Node* pBorder = CreateCopyNode(XFA_ELEMENT_Border, pField); |
339 pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, FALSE); | 339 pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, FALSE); |
340 | 340 |
341 CXFA_Node* pEdge = CreateCopyNode(XFA_ELEMENT_Edge, pBorder); | 341 CXFA_Node* pEdge = CreateCopyNode(XFA_ELEMENT_Edge, pBorder); |
342 pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, FALSE); | 342 pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, FALSE); |
343 | 343 |
344 CXFA_Node* pFill = CreateCopyNode(XFA_ELEMENT_Fill, pBorder); | 344 CXFA_Node* pFill = CreateCopyNode(XFA_ELEMENT_Fill, pBorder); |
345 CXFA_Node* pColor = CreateCopyNode(XFA_ELEMENT_Color, pFill); | 345 CXFA_Node* pColor = CreateCopyNode(XFA_ELEMENT_Color, pFill); |
346 pColor->SetCData(XFA_ATTRIBUTE_Value, FX_WSTRC(L"212, 208, 200"), FALSE); | 346 pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", FALSE); |
347 | 347 |
348 CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField); | 348 CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField); |
349 pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None); | 349 pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None); |
350 | 350 |
351 return pField; | 351 return pField; |
352 } | 352 } |
353 | 353 |
354 CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent, | 354 CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent, |
355 CXFA_Node* pBefore) const { | 355 CXFA_Node* pBefore) const { |
356 return CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore); | 356 return CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 CXFA_Document* pXFADoc = GetXFADoc(); | 508 CXFA_Document* pXFADoc = GetXFADoc(); |
509 CXFA_Node* pNewTemplateNode = pXFADoc->GetParser()->GetFactory()->CreateNode( | 509 CXFA_Node* pNewTemplateNode = pXFADoc->GetParser()->GetFactory()->CreateNode( |
510 XFA_XDPPACKET_Template, eElement); | 510 XFA_XDPPACKET_Template, eElement); |
511 if (pParent) | 511 if (pParent) |
512 pParent->InsertChild(pNewTemplateNode, pBefore); | 512 pParent->InsertChild(pNewTemplateNode, pBefore); |
513 return pNewTemplateNode; | 513 return pNewTemplateNode; |
514 } | 514 } |
515 | 515 |
516 CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { | 516 CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { |
517 CXFA_Node* pFont = CreateCopyNode(XFA_ELEMENT_Font, pParent); | 517 CXFA_Node* pFont = CreateCopyNode(XFA_ELEMENT_Font, pParent); |
518 pFont->SetCData(XFA_ATTRIBUTE_Typeface, FX_WSTRC(L"Myriad Pro"), FALSE); | 518 pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", FALSE); |
519 return pFont; | 519 return pFont; |
520 } | 520 } |
521 | 521 |
522 CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent, | 522 CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent, |
523 uint32_t dwFlags, | 523 uint32_t dwFlags, |
524 FX_FLOAT fInsets[4]) const { | 524 FX_FLOAT fInsets[4]) const { |
525 CXFA_Node* pMargin = CreateCopyNode(XFA_ELEMENT_Margin, pParent); | 525 CXFA_Node* pMargin = CreateCopyNode(XFA_ELEMENT_Margin, pParent); |
526 if (dwFlags & 0x01) | 526 if (dwFlags & 0x01) |
527 pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset, | 527 pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset, |
528 CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), FALSE); | 528 CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), FALSE); |
(...skipping 17 matching lines...) Expand all Loading... |
546 } | 546 } |
547 | 547 |
548 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { | 548 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { |
549 return GetXFADoc()->GetParser()->GetFactory(); | 549 return GetXFADoc()->GetParser()->GetFactory(); |
550 } | 550 } |
551 | 551 |
552 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { | 552 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { |
553 return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); | 553 return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); |
554 } | 554 } |
555 | 555 |
OLD | NEW |