| 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/xfa_ffwidgethandler.h" | 7 #include "xfa/fxfa/xfa_ffwidgethandler.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "xfa/fxfa/app/xfa_ffchoicelist.h" | 11 #include "xfa/fxfa/app/xfa_ffchoicelist.h" |
| 12 #include "xfa/fxfa/app/xfa_fffield.h" | 12 #include "xfa/fxfa/app/xfa_fffield.h" |
| 13 #include "xfa/fxfa/app/xfa_fwladapter.h" | 13 #include "xfa/fxfa/app/xfa_fwladapter.h" |
| 14 #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" | 14 #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" |
| 15 #include "xfa/fxfa/parser/cxfa_measurement.h" | 15 #include "xfa/fxfa/parser/cxfa_measurement.h" |
| 16 #include "xfa/fxfa/xfa_ffdoc.h" | 16 #include "xfa/fxfa/xfa_ffdoc.h" |
| 17 #include "xfa/fxfa/xfa_ffdocview.h" | 17 #include "xfa/fxfa/xfa_ffdocview.h" |
| 18 #include "xfa/fxfa/xfa_ffwidget.h" | 18 #include "xfa/fxfa/xfa_ffwidget.h" |
| 19 | 19 |
| 20 CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) | 20 CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) |
| 21 : m_pDocView(pDocView) {} | 21 : m_pDocView(pDocView) {} |
| 22 | 22 |
| 23 CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {} | 23 CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {} |
| 24 | 24 |
| 25 FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) { | 25 bool CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) { |
| 26 m_pDocView->LockUpdate(); | 26 m_pDocView->LockUpdate(); |
| 27 FX_BOOL bRet = hWidget->OnMouseEnter(); | 27 bool bRet = hWidget->OnMouseEnter(); |
| 28 m_pDocView->UnlockUpdate(); | 28 m_pDocView->UnlockUpdate(); |
| 29 m_pDocView->UpdateDocView(); | 29 m_pDocView->UpdateDocView(); |
| 30 return bRet; | 30 return bRet; |
| 31 } | 31 } |
| 32 | 32 |
| 33 FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { | 33 bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { |
| 34 m_pDocView->LockUpdate(); | 34 m_pDocView->LockUpdate(); |
| 35 FX_BOOL bRet = hWidget->OnMouseExit(); | 35 bool bRet = hWidget->OnMouseExit(); |
| 36 m_pDocView->UnlockUpdate(); | 36 m_pDocView->UnlockUpdate(); |
| 37 m_pDocView->UpdateDocView(); | 37 m_pDocView->UpdateDocView(); |
| 38 return bRet; | 38 return bRet; |
| 39 } | 39 } |
| 40 | 40 |
| 41 FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, | 41 bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, |
| 42 uint32_t dwFlags, | 42 uint32_t dwFlags, |
| 43 FX_FLOAT fx, | 43 FX_FLOAT fx, |
| 44 FX_FLOAT fy) { | 44 FX_FLOAT fy) { |
| 45 m_pDocView->LockUpdate(); | 45 m_pDocView->LockUpdate(); |
| 46 hWidget->Rotate2Normal(fx, fy); | 46 hWidget->Rotate2Normal(fx, fy); |
| 47 FX_BOOL bRet = hWidget->OnLButtonDown(dwFlags, fx, fy); | 47 bool bRet = hWidget->OnLButtonDown(dwFlags, fx, fy); |
| 48 if (bRet && m_pDocView->SetFocus(hWidget)) { | 48 if (bRet && m_pDocView->SetFocus(hWidget)) { |
| 49 m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( | 49 m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( |
| 50 m_pDocView->GetDoc(), hWidget); | 50 m_pDocView->GetDoc(), hWidget); |
| 51 } | 51 } |
| 52 m_pDocView->UnlockUpdate(); | 52 m_pDocView->UnlockUpdate(); |
| 53 m_pDocView->UpdateDocView(); | 53 m_pDocView->UpdateDocView(); |
| 54 return bRet; | 54 return bRet; |
| 55 } | 55 } |
| 56 | 56 |
| 57 FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, | 57 bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, |
| 58 uint32_t dwFlags, | 58 uint32_t dwFlags, |
| 59 FX_FLOAT fx, | 59 FX_FLOAT fx, |
| 60 FX_FLOAT fy) { | 60 FX_FLOAT fy) { |
| 61 m_pDocView->LockUpdate(); | 61 m_pDocView->LockUpdate(); |
| 62 hWidget->Rotate2Normal(fx, fy); | 62 hWidget->Rotate2Normal(fx, fy); |
| 63 m_pDocView->m_bLayoutEvent = TRUE; | 63 m_pDocView->m_bLayoutEvent = true; |
| 64 FX_BOOL bRet = hWidget->OnLButtonUp(dwFlags, fx, fy); | 64 bool bRet = hWidget->OnLButtonUp(dwFlags, fx, fy); |
| 65 m_pDocView->UnlockUpdate(); | 65 m_pDocView->UnlockUpdate(); |
| 66 m_pDocView->UpdateDocView(); | 66 m_pDocView->UpdateDocView(); |
| 67 return bRet; | 67 return bRet; |
| 68 } | 68 } |
| 69 | 69 |
| 70 FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, | 70 bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, |
| 71 uint32_t dwFlags, | 71 uint32_t dwFlags, |
| 72 FX_FLOAT fx, | 72 FX_FLOAT fx, |
| 73 FX_FLOAT fy) { | 73 FX_FLOAT fy) { |
| 74 hWidget->Rotate2Normal(fx, fy); | 74 hWidget->Rotate2Normal(fx, fy); |
| 75 FX_BOOL bRet = hWidget->OnLButtonDblClk(dwFlags, fx, fy); | 75 bool bRet = hWidget->OnLButtonDblClk(dwFlags, fx, fy); |
| 76 m_pDocView->RunInvalidate(); | 76 m_pDocView->RunInvalidate(); |
| 77 return bRet; | 77 return bRet; |
| 78 } | 78 } |
| 79 | 79 |
| 80 FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, | 80 bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, |
| 81 uint32_t dwFlags, | 81 uint32_t dwFlags, |
| 82 FX_FLOAT fx, | 82 FX_FLOAT fx, |
| 83 FX_FLOAT fy) { | 83 FX_FLOAT fy) { |
| 84 hWidget->Rotate2Normal(fx, fy); | 84 hWidget->Rotate2Normal(fx, fy); |
| 85 FX_BOOL bRet = hWidget->OnMouseMove(dwFlags, fx, fy); | 85 bool bRet = hWidget->OnMouseMove(dwFlags, fx, fy); |
| 86 m_pDocView->RunInvalidate(); | 86 m_pDocView->RunInvalidate(); |
| 87 return bRet; | 87 return bRet; |
| 88 } | 88 } |
| 89 | 89 |
| 90 FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, | 90 bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, |
| 91 uint32_t dwFlags, | 91 uint32_t dwFlags, |
| 92 int16_t zDelta, | 92 int16_t zDelta, |
| 93 FX_FLOAT fx, | 93 FX_FLOAT fx, |
| 94 FX_FLOAT fy) { | 94 FX_FLOAT fy) { |
| 95 hWidget->Rotate2Normal(fx, fy); | 95 hWidget->Rotate2Normal(fx, fy); |
| 96 FX_BOOL bRet = hWidget->OnMouseWheel(dwFlags, zDelta, fx, fy); | 96 bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, fx, fy); |
| 97 m_pDocView->RunInvalidate(); | 97 m_pDocView->RunInvalidate(); |
| 98 return bRet; | 98 return bRet; |
| 99 } | 99 } |
| 100 | 100 |
| 101 FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, | 101 bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, |
| 102 uint32_t dwFlags, | 102 uint32_t dwFlags, |
| 103 FX_FLOAT fx, | 103 FX_FLOAT fx, |
| 104 FX_FLOAT fy) { | 104 FX_FLOAT fy) { |
| 105 hWidget->Rotate2Normal(fx, fy); | 105 hWidget->Rotate2Normal(fx, fy); |
| 106 FX_BOOL bRet = hWidget->OnRButtonDown(dwFlags, fx, fy); | 106 bool bRet = hWidget->OnRButtonDown(dwFlags, fx, fy); |
| 107 if (bRet && m_pDocView->SetFocus(hWidget)) { | 107 if (bRet && m_pDocView->SetFocus(hWidget)) { |
| 108 m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( | 108 m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( |
| 109 m_pDocView->GetDoc(), hWidget); | 109 m_pDocView->GetDoc(), hWidget); |
| 110 } | 110 } |
| 111 m_pDocView->RunInvalidate(); | 111 m_pDocView->RunInvalidate(); |
| 112 return bRet; | 112 return bRet; |
| 113 } | 113 } |
| 114 | 114 |
| 115 FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, | 115 bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, |
| 116 uint32_t dwFlags, | 116 uint32_t dwFlags, |
| 117 FX_FLOAT fx, | 117 FX_FLOAT fx, |
| 118 FX_FLOAT fy) { | 118 FX_FLOAT fy) { |
| 119 hWidget->Rotate2Normal(fx, fy); | 119 hWidget->Rotate2Normal(fx, fy); |
| 120 FX_BOOL bRet = hWidget->OnRButtonUp(dwFlags, fx, fy); | 120 bool bRet = hWidget->OnRButtonUp(dwFlags, fx, fy); |
| 121 m_pDocView->RunInvalidate(); | 121 m_pDocView->RunInvalidate(); |
| 122 return bRet; | 122 return bRet; |
| 123 } | 123 } |
| 124 | 124 |
| 125 FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, | 125 bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, |
| 126 uint32_t dwFlags, | 126 uint32_t dwFlags, |
| 127 FX_FLOAT fx, | 127 FX_FLOAT fx, |
| 128 FX_FLOAT fy) { | 128 FX_FLOAT fy) { |
| 129 hWidget->Rotate2Normal(fx, fy); | 129 hWidget->Rotate2Normal(fx, fy); |
| 130 FX_BOOL bRet = hWidget->OnRButtonDblClk(dwFlags, fx, fy); | 130 bool bRet = hWidget->OnRButtonDblClk(dwFlags, fx, fy); |
| 131 m_pDocView->RunInvalidate(); | 131 m_pDocView->RunInvalidate(); |
| 132 return bRet; | 132 return bRet; |
| 133 } | 133 } |
| 134 | 134 |
| 135 FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget, | 135 bool CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget, |
| 136 uint32_t dwKeyCode, | 136 uint32_t dwKeyCode, |
| 137 uint32_t dwFlags) { | 137 uint32_t dwFlags) { |
| 138 FX_BOOL bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags); | 138 bool bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags); |
| 139 m_pDocView->RunInvalidate(); | 139 m_pDocView->RunInvalidate(); |
| 140 m_pDocView->UpdateDocView(); | 140 m_pDocView->UpdateDocView(); |
| 141 return bRet; | 141 return bRet; |
| 142 } | 142 } |
| 143 | 143 |
| 144 FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget, | 144 bool CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget, |
| 145 uint32_t dwKeyCode, | 145 uint32_t dwKeyCode, |
| 146 uint32_t dwFlags) { | 146 uint32_t dwFlags) { |
| 147 FX_BOOL bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags); | 147 bool bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags); |
| 148 m_pDocView->RunInvalidate(); | 148 m_pDocView->RunInvalidate(); |
| 149 return bRet; | 149 return bRet; |
| 150 } | 150 } |
| 151 | 151 |
| 152 FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, | 152 bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, |
| 153 uint32_t dwChar, | 153 uint32_t dwChar, |
| 154 uint32_t dwFlags) { | 154 uint32_t dwFlags) { |
| 155 FX_BOOL bRet = hWidget->OnChar(dwChar, dwFlags); | 155 bool bRet = hWidget->OnChar(dwChar, dwFlags); |
| 156 m_pDocView->RunInvalidate(); | 156 m_pDocView->RunInvalidate(); |
| 157 return bRet; | 157 return bRet; |
| 158 } | 158 } |
| 159 | 159 |
| 160 FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, | 160 FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, |
| 161 FX_FLOAT fx, | 161 FX_FLOAT fx, |
| 162 FX_FLOAT fy) { | 162 FX_FLOAT fy) { |
| 163 if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible)) | 163 if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible)) |
| 164 return FWL_WidgetHit::Unknown; | 164 return FWL_WidgetHit::Unknown; |
| 165 | 165 |
| 166 hWidget->Rotate2Normal(fx, fy); | 166 hWidget->Rotate2Normal(fx, fy); |
| 167 return hWidget->OnHitTest(fx, fy); | 167 return hWidget->OnHitTest(fx, fy); |
| 168 } | 168 } |
| 169 | 169 |
| 170 FX_BOOL CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, | 170 bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, |
| 171 FX_FLOAT fx, | 171 FX_FLOAT fx, |
| 172 FX_FLOAT fy) { | 172 FX_FLOAT fy) { |
| 173 hWidget->Rotate2Normal(fx, fy); | 173 hWidget->Rotate2Normal(fx, fy); |
| 174 return hWidget->OnSetCursor(fx, fy); | 174 return hWidget->OnSetCursor(fx, fy); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, | 177 void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, |
| 178 CFX_Graphics* pGS, | 178 CFX_Graphics* pGS, |
| 179 CFX_Matrix* pMatrix, | 179 CFX_Matrix* pMatrix, |
| 180 FX_BOOL bHighlight) { | 180 bool bHighlight) { |
| 181 hWidget->RenderWidget(pGS, pMatrix, | 181 hWidget->RenderWidget(pGS, pMatrix, |
| 182 bHighlight ? XFA_WidgetStatus_Highlight : 0); | 182 bHighlight ? XFA_WidgetStatus_Highlight : 0); |
| 183 } | 183 } |
| 184 | 184 |
| 185 FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, | 185 bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, |
| 186 XFA_EVENTTYPE eEventType) { | 186 XFA_EVENTTYPE eEventType) { |
| 187 if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown) | 187 if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown) |
| 188 return FALSE; | 188 return false; |
| 189 if (pWidgetAcc->GetElementType() == XFA_Element::Draw) | 189 if (pWidgetAcc->GetElementType() == XFA_Element::Draw) |
| 190 return FALSE; | 190 return false; |
| 191 | 191 |
| 192 switch (eEventType) { | 192 switch (eEventType) { |
| 193 case XFA_EVENT_Calculate: { | 193 case XFA_EVENT_Calculate: { |
| 194 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); | 194 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); |
| 195 if (!calc) | 195 if (!calc) |
| 196 return FALSE; | 196 return false; |
| 197 if (calc.GetScript()) | 197 if (calc.GetScript()) |
| 198 return TRUE; | 198 return true; |
| 199 return FALSE; | 199 return false; |
| 200 } | 200 } |
| 201 case XFA_EVENT_Validate: { | 201 case XFA_EVENT_Validate: { |
| 202 CXFA_Validate val = pWidgetAcc->GetValidate(); | 202 CXFA_Validate val = pWidgetAcc->GetValidate(); |
| 203 if (!val) | 203 if (!val) |
| 204 return FALSE; | 204 return false; |
| 205 if (val.GetScript()) | 205 if (val.GetScript()) |
| 206 return TRUE; | 206 return true; |
| 207 return FALSE; | 207 return false; |
| 208 } | 208 } |
| 209 default: | 209 default: |
| 210 break; | 210 break; |
| 211 } | 211 } |
| 212 CXFA_NodeArray eventArray; | 212 CXFA_NodeArray eventArray; |
| 213 return pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType], | 213 return pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType], |
| 214 eventArray) > 0; | 214 eventArray) > 0; |
| 215 } | 215 } |
| 216 | 216 |
| 217 int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, | 217 int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 return nullptr; | 317 return nullptr; |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 | 320 |
| 321 CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, | 321 CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, |
| 322 CXFA_Node* pBefore) const { | 322 CXFA_Node* pBefore) const { |
| 323 CXFA_Node* pField = CreateField(XFA_Element::Button, pParent, pBefore); | 323 CXFA_Node* pField = CreateField(XFA_Element::Button, pParent, pBefore); |
| 324 CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField); | 324 CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField); |
| 325 CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption); | 325 CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption); |
| 326 CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue); | 326 CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue); |
| 327 pText->SetContent(L"Button", L"Button", FALSE); | 327 pText->SetContent(L"Button", L"Button", false); |
| 328 | 328 |
| 329 CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption); | 329 CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption); |
| 330 pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, FALSE); | 330 pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, false); |
| 331 pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, FALSE); | 331 pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, false); |
| 332 CreateFontNode(pCaption); | 332 CreateFontNode(pCaption); |
| 333 | 333 |
| 334 CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField); | 334 CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField); |
| 335 pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, FALSE); | 335 pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, false); |
| 336 | 336 |
| 337 CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder); | 337 CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder); |
| 338 pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, FALSE); | 338 pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, false); |
| 339 | 339 |
| 340 CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder); | 340 CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder); |
| 341 CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill); | 341 CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill); |
| 342 pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", FALSE); | 342 pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", false); |
| 343 | 343 |
| 344 CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField); | 344 CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField); |
| 345 pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None); | 345 pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None); |
| 346 | 346 |
| 347 return pField; | 347 return pField; |
| 348 } | 348 } |
| 349 | 349 |
| 350 CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent, | 350 CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent, |
| 351 CXFA_Node* pBefore) const { | 351 CXFA_Node* pBefore) const { |
| 352 return CreateField(XFA_Element::CheckButton, pParent, pBefore); | 352 return CreateField(XFA_Element::CheckButton, pParent, pBefore); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 412 |
| 413 CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent, | 413 CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent, |
| 414 CXFA_Node* pBefore) const { | 414 CXFA_Node* pBefore) const { |
| 415 return CreateField(XFA_Element::ImageEdit, pParent, pBefore); | 415 return CreateField(XFA_Element::ImageEdit, pParent, pBefore); |
| 416 } | 416 } |
| 417 | 417 |
| 418 CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent, | 418 CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent, |
| 419 CXFA_Node* pBefore) const { | 419 CXFA_Node* pBefore) const { |
| 420 CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore); | 420 CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore); |
| 421 CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField); | 421 CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField); |
| 422 pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, FALSE); | 422 pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, false); |
| 423 return pField; | 423 return pField; |
| 424 } | 424 } |
| 425 | 425 |
| 426 CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_Element eElement, | 426 CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_Element eElement, |
| 427 CXFA_Node* pParent, | 427 CXFA_Node* pParent, |
| 428 CXFA_Node* pBefore) const { | 428 CXFA_Node* pBefore) const { |
| 429 CXFA_Node* pField = CreateFormItem(XFA_Element::Field, pParent, pBefore); | 429 CXFA_Node* pField = CreateFormItem(XFA_Element::Field, pParent, pBefore); |
| 430 CreateCopyNode(eElement, CreateCopyNode(XFA_Element::Ui, pField)); | 430 CreateCopyNode(eElement, CreateCopyNode(XFA_Element::Ui, pField)); |
| 431 CreateFontNode(pField); | 431 CreateFontNode(pField); |
| 432 return pField; | 432 return pField; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 474 |
| 475 CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent, | 475 CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent, |
| 476 CXFA_Node* pBefore) const { | 476 CXFA_Node* pBefore) const { |
| 477 return CreateFormItem(XFA_Element::Subform, pParent, pBefore); | 477 return CreateFormItem(XFA_Element::Subform, pParent, pBefore); |
| 478 } | 478 } |
| 479 | 479 |
| 480 CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement, | 480 CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_Element eElement, |
| 481 CXFA_Node* pParent, | 481 CXFA_Node* pParent, |
| 482 CXFA_Node* pBefore) const { | 482 CXFA_Node* pBefore) const { |
| 483 CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr; | 483 CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr; |
| 484 CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(FALSE); | 484 CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(false); |
| 485 if (pParent) | 485 if (pParent) |
| 486 pParent->InsertChild(pNewFormItem, pBefore); | 486 pParent->InsertChild(pNewFormItem, pBefore); |
| 487 return pNewFormItem; | 487 return pNewFormItem; |
| 488 } | 488 } |
| 489 | 489 |
| 490 CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement, | 490 CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_Element eElement, |
| 491 CXFA_Node* pParent, | 491 CXFA_Node* pParent, |
| 492 CXFA_Node* pBefore) const { | 492 CXFA_Node* pBefore) const { |
| 493 CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr; | 493 CXFA_Node* pTemplateParent = pParent ? pParent->GetTemplateNode() : nullptr; |
| 494 CXFA_Node* pNewNode = | 494 CXFA_Node* pNewNode = |
| 495 CreateTemplateNode(eElement, pTemplateParent, | 495 CreateTemplateNode(eElement, pTemplateParent, |
| 496 pBefore ? pBefore->GetTemplateNode() : nullptr) | 496 pBefore ? pBefore->GetTemplateNode() : nullptr) |
| 497 ->Clone(FALSE); | 497 ->Clone(false); |
| 498 if (pParent) | 498 if (pParent) |
| 499 pParent->InsertChild(pNewNode, pBefore); | 499 pParent->InsertChild(pNewNode, pBefore); |
| 500 return pNewNode; | 500 return pNewNode; |
| 501 } | 501 } |
| 502 | 502 |
| 503 CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement, | 503 CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement, |
| 504 CXFA_Node* pParent, | 504 CXFA_Node* pParent, |
| 505 CXFA_Node* pBefore) const { | 505 CXFA_Node* pBefore) const { |
| 506 CXFA_Document* pXFADoc = GetXFADoc(); | 506 CXFA_Document* pXFADoc = GetXFADoc(); |
| 507 CXFA_Node* pNewTemplateNode = | 507 CXFA_Node* pNewTemplateNode = |
| 508 pXFADoc->CreateNode(XFA_XDPPACKET_Template, eElement); | 508 pXFADoc->CreateNode(XFA_XDPPACKET_Template, eElement); |
| 509 if (pParent) | 509 if (pParent) |
| 510 pParent->InsertChild(pNewTemplateNode, pBefore); | 510 pParent->InsertChild(pNewTemplateNode, pBefore); |
| 511 return pNewTemplateNode; | 511 return pNewTemplateNode; |
| 512 } | 512 } |
| 513 | 513 |
| 514 CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { | 514 CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { |
| 515 CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent); | 515 CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent); |
| 516 pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", FALSE); | 516 pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", false); |
| 517 return pFont; | 517 return pFont; |
| 518 } | 518 } |
| 519 | 519 |
| 520 CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent, | 520 CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent, |
| 521 uint32_t dwFlags, | 521 uint32_t dwFlags, |
| 522 FX_FLOAT fInsets[4]) const { | 522 FX_FLOAT fInsets[4]) const { |
| 523 CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent); | 523 CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent); |
| 524 if (dwFlags & 0x01) | 524 if (dwFlags & 0x01) |
| 525 pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset, | 525 pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset, |
| 526 CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), FALSE); | 526 CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), false); |
| 527 if (dwFlags & 0x02) | 527 if (dwFlags & 0x02) |
| 528 pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset, | 528 pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset, |
| 529 CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), FALSE); | 529 CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), false); |
| 530 if (dwFlags & 0x04) | 530 if (dwFlags & 0x04) |
| 531 pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset, | 531 pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset, |
| 532 CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), FALSE); | 532 CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), false); |
| 533 if (dwFlags & 0x08) | 533 if (dwFlags & 0x08) |
| 534 pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset, | 534 pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset, |
| 535 CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), FALSE); | 535 CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), false); |
| 536 return pMargin; | 536 return pMargin; |
| 537 } | 537 } |
| 538 | 538 |
| 539 CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_Element eValue, | 539 CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_Element eValue, |
| 540 CXFA_Node* pParent) const { | 540 CXFA_Node* pParent) const { |
| 541 CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pParent); | 541 CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pParent); |
| 542 CreateCopyNode(eValue, pValue); | 542 CreateCopyNode(eValue, pValue); |
| 543 return pValue; | 543 return pValue; |
| 544 } | 544 } |
| 545 | 545 |
| 546 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { | 546 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { |
| 547 return GetXFADoc(); | 547 return GetXFADoc(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { | 550 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { |
| 551 return m_pDocView->GetDoc()->GetXFADoc(); | 551 return m_pDocView->GetDoc()->GetXFADoc(); |
| 552 } | 552 } |
| 553 | 553 |
| OLD | NEW |