| 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/app/xfa_ffwidgetacc.h" | 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 std::unique_ptr<CXFA_TextLayout> m_pTextLayout; | 67 std::unique_ptr<CXFA_TextLayout> m_pTextLayout; |
| 68 std::unique_ptr<CXFA_TextProvider> m_pTextProvider; | 68 std::unique_ptr<CXFA_TextProvider> m_pTextProvider; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData { | 71 class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData { |
| 72 public: | 72 public: |
| 73 CXFA_ImageLayoutData() | 73 CXFA_ImageLayoutData() |
| 74 : m_pDIBitmap(nullptr), | 74 : m_pDIBitmap(nullptr), |
| 75 m_bNamedImage(FALSE), | 75 m_bNamedImage(false), |
| 76 m_iImageXDpi(0), | 76 m_iImageXDpi(0), |
| 77 m_iImageYDpi(0) {} | 77 m_iImageYDpi(0) {} |
| 78 | 78 |
| 79 ~CXFA_ImageLayoutData() override { | 79 ~CXFA_ImageLayoutData() override { |
| 80 if (m_pDIBitmap && !m_bNamedImage) | 80 if (m_pDIBitmap && !m_bNamedImage) |
| 81 delete m_pDIBitmap; | 81 delete m_pDIBitmap; |
| 82 } | 82 } |
| 83 | 83 |
| 84 FX_BOOL LoadImageData(CXFA_WidgetAcc* pAcc) { | 84 bool LoadImageData(CXFA_WidgetAcc* pAcc) { |
| 85 if (m_pDIBitmap) | 85 if (m_pDIBitmap) |
| 86 return TRUE; | 86 return true; |
| 87 | 87 |
| 88 CXFA_Value value = pAcc->GetFormValue(); | 88 CXFA_Value value = pAcc->GetFormValue(); |
| 89 if (!value) | 89 if (!value) |
| 90 return FALSE; | 90 return false; |
| 91 | 91 |
| 92 CXFA_Image imageObj = value.GetImage(); | 92 CXFA_Image imageObj = value.GetImage(); |
| 93 if (!imageObj) | 93 if (!imageObj) |
| 94 return FALSE; | 94 return false; |
| 95 | 95 |
| 96 CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); | 96 CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); |
| 97 pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage, | 97 pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage, |
| 98 m_iImageXDpi, m_iImageYDpi)); | 98 m_iImageXDpi, m_iImageYDpi)); |
| 99 return !!m_pDIBitmap; | 99 return !!m_pDIBitmap; |
| 100 } | 100 } |
| 101 | 101 |
| 102 CFX_DIBitmap* m_pDIBitmap; | 102 CFX_DIBitmap* m_pDIBitmap; |
| 103 FX_BOOL m_bNamedImage; | 103 bool m_bNamedImage; |
| 104 int32_t m_iImageXDpi; | 104 int32_t m_iImageXDpi; |
| 105 int32_t m_iImageYDpi; | 105 int32_t m_iImageYDpi; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData { | 108 class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData { |
| 109 public: | 109 public: |
| 110 CXFA_FieldLayoutData() {} | 110 CXFA_FieldLayoutData() {} |
| 111 ~CXFA_FieldLayoutData() override {} | 111 ~CXFA_FieldLayoutData() override {} |
| 112 | 112 |
| 113 FX_BOOL LoadCaption(CXFA_WidgetAcc* pAcc) { | 113 bool LoadCaption(CXFA_WidgetAcc* pAcc) { |
| 114 if (m_pCapTextLayout) | 114 if (m_pCapTextLayout) |
| 115 return TRUE; | 115 return true; |
| 116 CXFA_Caption caption = pAcc->GetCaption(); | 116 CXFA_Caption caption = pAcc->GetCaption(); |
| 117 if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden) | 117 if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden) |
| 118 return FALSE; | 118 return false; |
| 119 m_pCapTextProvider.reset( | 119 m_pCapTextProvider.reset( |
| 120 new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption)); | 120 new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption)); |
| 121 m_pCapTextLayout.reset(new CXFA_TextLayout(m_pCapTextProvider.get())); | 121 m_pCapTextLayout.reset(new CXFA_TextLayout(m_pCapTextProvider.get())); |
| 122 return TRUE; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 std::unique_ptr<CXFA_TextLayout> m_pCapTextLayout; | 125 std::unique_ptr<CXFA_TextLayout> m_pCapTextLayout; |
| 126 std::unique_ptr<CXFA_TextProvider> m_pCapTextProvider; | 126 std::unique_ptr<CXFA_TextProvider> m_pCapTextProvider; |
| 127 std::unique_ptr<CFDE_TextOut> m_pTextOut; | 127 std::unique_ptr<CFDE_TextOut> m_pTextOut; |
| 128 std::unique_ptr<CFX_FloatArray> m_pFieldSplitArray; | 128 std::unique_ptr<CFX_FloatArray> m_pFieldSplitArray; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 class CXFA_TextEditData : public CXFA_FieldLayoutData { | 131 class CXFA_TextEditData : public CXFA_FieldLayoutData { |
| 132 public: | 132 public: |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 class CXFA_ImageEditData : public CXFA_FieldLayoutData { | 135 class CXFA_ImageEditData : public CXFA_FieldLayoutData { |
| 136 public: | 136 public: |
| 137 CXFA_ImageEditData() | 137 CXFA_ImageEditData() |
| 138 : m_pDIBitmap(nullptr), | 138 : m_pDIBitmap(nullptr), |
| 139 m_bNamedImage(FALSE), | 139 m_bNamedImage(false), |
| 140 m_iImageXDpi(0), | 140 m_iImageXDpi(0), |
| 141 m_iImageYDpi(0) {} | 141 m_iImageYDpi(0) {} |
| 142 | 142 |
| 143 ~CXFA_ImageEditData() override { | 143 ~CXFA_ImageEditData() override { |
| 144 if (m_pDIBitmap && !m_bNamedImage) | 144 if (m_pDIBitmap && !m_bNamedImage) |
| 145 delete m_pDIBitmap; | 145 delete m_pDIBitmap; |
| 146 } | 146 } |
| 147 | 147 |
| 148 FX_BOOL LoadImageData(CXFA_WidgetAcc* pAcc) { | 148 bool LoadImageData(CXFA_WidgetAcc* pAcc) { |
| 149 if (m_pDIBitmap) | 149 if (m_pDIBitmap) |
| 150 return TRUE; | 150 return true; |
| 151 | 151 |
| 152 CXFA_Value value = pAcc->GetFormValue(); | 152 CXFA_Value value = pAcc->GetFormValue(); |
| 153 if (!value) | 153 if (!value) |
| 154 return FALSE; | 154 return false; |
| 155 | 155 |
| 156 CXFA_Image imageObj = value.GetImage(); | 156 CXFA_Image imageObj = value.GetImage(); |
| 157 CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); | 157 CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); |
| 158 pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage, | 158 pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage, |
| 159 m_iImageXDpi, m_iImageYDpi)); | 159 m_iImageXDpi, m_iImageYDpi)); |
| 160 return !!m_pDIBitmap; | 160 return !!m_pDIBitmap; |
| 161 } | 161 } |
| 162 | 162 |
| 163 CFX_DIBitmap* m_pDIBitmap; | 163 CFX_DIBitmap* m_pDIBitmap; |
| 164 FX_BOOL m_bNamedImage; | 164 bool m_bNamedImage; |
| 165 int32_t m_iImageXDpi; | 165 int32_t m_iImageXDpi; |
| 166 int32_t m_iImageYDpi; | 166 int32_t m_iImageYDpi; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode) | 169 CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode) |
| 170 : CXFA_WidgetData(pNode), | 170 : CXFA_WidgetData(pNode), |
| 171 m_pDocView(pDocView), | 171 m_pDocView(pDocView), |
| 172 m_nRecursionDepth(0) {} | 172 m_nRecursionDepth(0) {} |
| 173 | 173 |
| 174 CXFA_WidgetAcc::~CXFA_WidgetAcc() {} | 174 CXFA_WidgetAcc::~CXFA_WidgetAcc() {} |
| 175 | 175 |
| 176 FX_BOOL CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) { | 176 bool CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) { |
| 177 if (iNameType == 0) { | 177 if (iNameType == 0) { |
| 178 m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName); | 178 m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName); |
| 179 return !wsName.IsEmpty(); | 179 return !wsName.IsEmpty(); |
| 180 } | 180 } |
| 181 m_pNode->GetSOMExpression(wsName); | 181 m_pNode->GetSOMExpression(wsName); |
| 182 if (iNameType == 2 && wsName.GetLength() >= 15) { | 182 if (iNameType == 2 && wsName.GetLength() >= 15) { |
| 183 CFX_WideStringC wsPre = FX_WSTRC(L"xfa[0].form[0]."); | 183 CFX_WideStringC wsPre = FX_WSTRC(L"xfa[0].form[0]."); |
| 184 if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) { | 184 if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) { |
| 185 wsName.Delete(0, wsPre.GetLength()); | 185 wsName.Delete(0, wsPre.GetLength()); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 return TRUE; | 188 return true; |
| 189 } | 189 } |
| 190 CXFA_Node* CXFA_WidgetAcc::GetDatasets() { | 190 CXFA_Node* CXFA_WidgetAcc::GetDatasets() { |
| 191 return m_pNode->GetBindData(); | 191 return m_pNode->GetBindData(); |
| 192 } | 192 } |
| 193 FX_BOOL CXFA_WidgetAcc::ProcessValueChanged() { | 193 bool CXFA_WidgetAcc::ProcessValueChanged() { |
| 194 m_pDocView->AddValidateWidget(this); | 194 m_pDocView->AddValidateWidget(this); |
| 195 m_pDocView->AddCalculateWidgetAcc(this); | 195 m_pDocView->AddCalculateWidgetAcc(this); |
| 196 m_pDocView->RunCalculateWidgets(); | 196 m_pDocView->RunCalculateWidgets(); |
| 197 m_pDocView->RunValidate(); | 197 m_pDocView->RunValidate(); |
| 198 return TRUE; | 198 return true; |
| 199 } | 199 } |
| 200 void CXFA_WidgetAcc::ResetData() { | 200 void CXFA_WidgetAcc::ResetData() { |
| 201 CFX_WideString wsValue; | 201 CFX_WideString wsValue; |
| 202 XFA_Element eUIType = GetUIType(); | 202 XFA_Element eUIType = GetUIType(); |
| 203 switch (eUIType) { | 203 switch (eUIType) { |
| 204 case XFA_Element::ImageEdit: { | 204 case XFA_Element::ImageEdit: { |
| 205 CXFA_Value imageValue = GetDefaultValue(); | 205 CXFA_Value imageValue = GetDefaultValue(); |
| 206 CXFA_Image image = imageValue.GetImage(); | 206 CXFA_Image image = imageValue.GetImage(); |
| 207 CFX_WideString wsContentType, wsHref; | 207 CFX_WideString wsContentType, wsHref; |
| 208 if (image) { | 208 if (image) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType, | 255 void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType, |
| 256 const CFX_WideString& wsHref, | 256 const CFX_WideString& wsHref, |
| 257 const CFX_WideString& wsData) { | 257 const CFX_WideString& wsData) { |
| 258 CXFA_Image image = GetFormValue().GetImage(); | 258 CXFA_Image image = GetFormValue().GetImage(); |
| 259 if (image) { | 259 if (image) { |
| 260 image.SetContentType(CFX_WideString(wsContentType)); | 260 image.SetContentType(CFX_WideString(wsContentType)); |
| 261 image.SetHref(wsHref); | 261 image.SetHref(wsHref); |
| 262 } | 262 } |
| 263 CFX_WideString wsFormatValue(wsData); | 263 CFX_WideString wsFormatValue(wsData); |
| 264 GetFormatDataValue(wsData, wsFormatValue); | 264 GetFormatDataValue(wsData, wsFormatValue); |
| 265 m_pNode->SetContent(wsData, wsFormatValue, TRUE); | 265 m_pNode->SetContent(wsData, wsFormatValue, true); |
| 266 CXFA_Node* pBind = GetDatasets(); | 266 CXFA_Node* pBind = GetDatasets(); |
| 267 if (!pBind) { | 267 if (!pBind) { |
| 268 image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64); | 268 image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64); |
| 269 return; | 269 return; |
| 270 } | 270 } |
| 271 pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); | 271 pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); |
| 272 CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild); | 272 CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 273 if (pHrefNode) { | 273 if (pHrefNode) { |
| 274 pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref); | 274 pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref); |
| 275 } else { | 275 } else { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 if (GetRawValue() != EventParam.m_wsResult) { | 362 if (GetRawValue() != EventParam.m_wsResult) { |
| 363 SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw); | 363 SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw); |
| 364 UpdateUIDisplay(); | 364 UpdateUIDisplay(); |
| 365 } | 365 } |
| 366 return XFA_EVENTERROR_Success; | 366 return XFA_EVENTERROR_Success; |
| 367 } | 367 } |
| 368 | 368 |
| 369 void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, | 369 void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, |
| 370 int32_t iRet, | 370 int32_t iRet, |
| 371 CFXJSE_Value* pRetValue, | 371 CFXJSE_Value* pRetValue, |
| 372 FX_BOOL bVersionFlag) { | 372 bool bVersionFlag) { |
| 373 if (iRet == XFA_EVENTERROR_Success && pRetValue) { | 373 if (iRet == XFA_EVENTERROR_Success && pRetValue) { |
| 374 if (pRetValue->IsBoolean() && !pRetValue->ToBoolean()) { | 374 if (pRetValue->IsBoolean() && !pRetValue->ToBoolean()) { |
| 375 IXFA_AppProvider* pAppProvider = GetAppProvider(); | 375 IXFA_AppProvider* pAppProvider = GetAppProvider(); |
| 376 if (!pAppProvider) { | 376 if (!pAppProvider) { |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 CFX_WideString wsTitle; | 379 CFX_WideString wsTitle; |
| 380 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); | 380 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); |
| 381 CFX_WideString wsScriptMsg; | 381 CFX_WideString wsScriptMsg; |
| 382 validate.GetScriptMessageText(wsScriptMsg); | 382 validate.GetScriptMessageText(wsScriptMsg); |
| 383 int32_t eScriptTest = validate.GetScriptTest(); | 383 int32_t eScriptTest = validate.GetScriptTest(); |
| 384 if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) { | 384 if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) { |
| 385 if (GetNode()->IsUserInteractive()) | 385 if (GetNode()->IsUserInteractive()) |
| 386 return; | 386 return; |
| 387 if (wsScriptMsg.IsEmpty()) | 387 if (wsScriptMsg.IsEmpty()) |
| 388 GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag); | 388 GetValidateMessage(pAppProvider, wsScriptMsg, false, bVersionFlag); |
| 389 | 389 |
| 390 if (bVersionFlag) { | 390 if (bVersionFlag) { |
| 391 pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, | 391 pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, |
| 392 XFA_MB_OK); | 392 XFA_MB_OK); |
| 393 return; | 393 return; |
| 394 } | 394 } |
| 395 if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, | 395 if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, |
| 396 XFA_MB_YesNo) == XFA_IDYes) { | 396 XFA_MB_YesNo) == XFA_IDYes) { |
| 397 GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); | 397 GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); |
| 398 } | 398 } |
| 399 } else { | 399 } else { |
| 400 if (wsScriptMsg.IsEmpty()) { | 400 if (wsScriptMsg.IsEmpty()) { |
| 401 GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag); | 401 GetValidateMessage(pAppProvider, wsScriptMsg, true, bVersionFlag); |
| 402 } | 402 } |
| 403 pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); | 403 pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, | 408 int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, |
| 409 FX_BOOL bVersionFlag) { | 409 bool bVersionFlag) { |
| 410 CFX_WideString wsRawValue = GetRawValue(); | 410 CFX_WideString wsRawValue = GetRawValue(); |
| 411 if (!wsRawValue.IsEmpty()) { | 411 if (!wsRawValue.IsEmpty()) { |
| 412 CFX_WideString wsPicture; | 412 CFX_WideString wsPicture; |
| 413 validate.GetPicture(wsPicture); | 413 validate.GetPicture(wsPicture); |
| 414 if (wsPicture.IsEmpty()) { | 414 if (wsPicture.IsEmpty()) { |
| 415 return XFA_EVENTERROR_NotExist; | 415 return XFA_EVENTERROR_NotExist; |
| 416 } | 416 } |
| 417 IFX_Locale* pLocale = GetLocal(); | 417 IFX_Locale* pLocale = GetLocal(); |
| 418 if (!pLocale) { | 418 if (!pLocale) { |
| 419 return XFA_EVENTERROR_NotExist; | 419 return XFA_EVENTERROR_NotExist; |
| 420 } | 420 } |
| 421 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(this); | 421 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(this); |
| 422 if (!lcValue.ValidateValue(lcValue.GetValue(), wsPicture, pLocale)) { | 422 if (!lcValue.ValidateValue(lcValue.GetValue(), wsPicture, pLocale)) { |
| 423 IXFA_AppProvider* pAppProvider = GetAppProvider(); | 423 IXFA_AppProvider* pAppProvider = GetAppProvider(); |
| 424 if (!pAppProvider) { | 424 if (!pAppProvider) { |
| 425 return XFA_EVENTERROR_NotExist; | 425 return XFA_EVENTERROR_NotExist; |
| 426 } | 426 } |
| 427 CFX_WideString wsFormatMsg; | 427 CFX_WideString wsFormatMsg; |
| 428 validate.GetFormatMessageText(wsFormatMsg); | 428 validate.GetFormatMessageText(wsFormatMsg); |
| 429 CFX_WideString wsTitle; | 429 CFX_WideString wsTitle; |
| 430 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); | 430 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); |
| 431 int32_t eFormatTest = validate.GetFormatTest(); | 431 int32_t eFormatTest = validate.GetFormatTest(); |
| 432 if (eFormatTest == XFA_ATTRIBUTEENUM_Error) { | 432 if (eFormatTest == XFA_ATTRIBUTEENUM_Error) { |
| 433 if (wsFormatMsg.IsEmpty()) { | 433 if (wsFormatMsg.IsEmpty()) { |
| 434 GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag); | 434 GetValidateMessage(pAppProvider, wsFormatMsg, true, bVersionFlag); |
| 435 } | 435 } |
| 436 pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); | 436 pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); |
| 437 return XFA_EVENTERROR_Success; | 437 return XFA_EVENTERROR_Success; |
| 438 } | 438 } |
| 439 if (GetNode()->IsUserInteractive()) | 439 if (GetNode()->IsUserInteractive()) |
| 440 return XFA_EVENTERROR_NotExist; | 440 return XFA_EVENTERROR_NotExist; |
| 441 if (wsFormatMsg.IsEmpty()) | 441 if (wsFormatMsg.IsEmpty()) |
| 442 GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag); | 442 GetValidateMessage(pAppProvider, wsFormatMsg, false, bVersionFlag); |
| 443 | 443 |
| 444 if (bVersionFlag) { | 444 if (bVersionFlag) { |
| 445 pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, | 445 pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, |
| 446 XFA_MB_OK); | 446 XFA_MB_OK); |
| 447 return XFA_EVENTERROR_Success; | 447 return XFA_EVENTERROR_Success; |
| 448 } | 448 } |
| 449 if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, | 449 if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, |
| 450 XFA_MB_YesNo) == XFA_IDYes) { | 450 XFA_MB_YesNo) == XFA_IDYes) { |
| 451 GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); | 451 GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); |
| 452 } | 452 } |
| 453 return XFA_EVENTERROR_Success; | 453 return XFA_EVENTERROR_Success; |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 return XFA_EVENTERROR_NotExist; | 456 return XFA_EVENTERROR_NotExist; |
| 457 } | 457 } |
| 458 int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, | 458 int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, |
| 459 int32_t iFlags, | 459 int32_t iFlags, |
| 460 FX_BOOL bVersionFlag) { | 460 bool bVersionFlag) { |
| 461 CFX_WideString wsValue; | 461 CFX_WideString wsValue; |
| 462 GetValue(wsValue, XFA_VALUEPICTURE_Raw); | 462 GetValue(wsValue, XFA_VALUEPICTURE_Raw); |
| 463 if (!wsValue.IsEmpty()) { | 463 if (!wsValue.IsEmpty()) { |
| 464 return XFA_EVENTERROR_Success; | 464 return XFA_EVENTERROR_Success; |
| 465 } | 465 } |
| 466 if (m_bIsNull && (m_bPreNull == m_bIsNull)) { | 466 if (m_bIsNull && (m_bPreNull == m_bIsNull)) { |
| 467 return XFA_EVENTERROR_Success; | 467 return XFA_EVENTERROR_Success; |
| 468 } | 468 } |
| 469 int32_t eNullTest = validate.GetNullTest(); | 469 int32_t eNullTest = validate.GetNullTest(); |
| 470 CFX_WideString wsNullMsg; | 470 CFX_WideString wsNullMsg; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 500 GetValidateCaptionName(wsCaptionName, bVersionFlag); | 500 GetValidateCaptionName(wsCaptionName, bVersionFlag); |
| 501 CFX_WideString wsError; | 501 CFX_WideString wsError; |
| 502 pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); | 502 pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); |
| 503 wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); | 503 wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); |
| 504 } | 504 } |
| 505 pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); | 505 pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); |
| 506 return XFA_EVENTERROR_Error; | 506 return XFA_EVENTERROR_Error; |
| 507 } | 507 } |
| 508 case XFA_ATTRIBUTEENUM_Warning: { | 508 case XFA_ATTRIBUTEENUM_Warning: { |
| 509 if (GetNode()->IsUserInteractive()) | 509 if (GetNode()->IsUserInteractive()) |
| 510 return TRUE; | 510 return true; |
| 511 | 511 |
| 512 if (wsNullMsg.IsEmpty()) { | 512 if (wsNullMsg.IsEmpty()) { |
| 513 GetValidateCaptionName(wsCaptionName, bVersionFlag); | 513 GetValidateCaptionName(wsCaptionName, bVersionFlag); |
| 514 CFX_WideString wsWarning; | 514 CFX_WideString wsWarning; |
| 515 pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); | 515 pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); |
| 516 wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), | 516 wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), |
| 517 wsCaptionName.c_str()); | 517 wsCaptionName.c_str()); |
| 518 } | 518 } |
| 519 if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning, | 519 if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning, |
| 520 XFA_MB_YesNo) == XFA_IDYes) { | 520 XFA_MB_YesNo) == XFA_IDYes) { |
| 521 GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); | 521 GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); |
| 522 } | 522 } |
| 523 return XFA_EVENTERROR_Error; | 523 return XFA_EVENTERROR_Error; |
| 524 } | 524 } |
| 525 case XFA_ATTRIBUTEENUM_Disabled: | 525 case XFA_ATTRIBUTEENUM_Disabled: |
| 526 default: | 526 default: |
| 527 break; | 527 break; |
| 528 } | 528 } |
| 529 return XFA_EVENTERROR_Success; | 529 return XFA_EVENTERROR_Success; |
| 530 } | 530 } |
| 531 void CXFA_WidgetAcc::GetValidateCaptionName(CFX_WideString& wsCaptionName, | 531 void CXFA_WidgetAcc::GetValidateCaptionName(CFX_WideString& wsCaptionName, |
| 532 FX_BOOL bVersionFlag) { | 532 bool bVersionFlag) { |
| 533 if (!bVersionFlag) { | 533 if (!bVersionFlag) { |
| 534 CXFA_Caption caption = GetCaption(); | 534 CXFA_Caption caption = GetCaption(); |
| 535 if (caption) { | 535 if (caption) { |
| 536 CXFA_Value capValue = caption.GetValue(); | 536 CXFA_Value capValue = caption.GetValue(); |
| 537 if (capValue) { | 537 if (capValue) { |
| 538 CXFA_Text capText = capValue.GetText(); | 538 CXFA_Text capText = capValue.GetText(); |
| 539 if (capText) { | 539 if (capText) { |
| 540 capText.GetContent(wsCaptionName); | 540 capText.GetContent(wsCaptionName); |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 } | 544 } |
| 545 if (wsCaptionName.IsEmpty()) { | 545 if (wsCaptionName.IsEmpty()) { |
| 546 GetName(wsCaptionName); | 546 GetName(wsCaptionName); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider, | 549 void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider, |
| 550 CFX_WideString& wsMessage, | 550 CFX_WideString& wsMessage, |
| 551 FX_BOOL bError, | 551 bool bError, |
| 552 FX_BOOL bVersionFlag) { | 552 bool bVersionFlag) { |
| 553 CFX_WideString wsCaptionName; | 553 CFX_WideString wsCaptionName; |
| 554 GetValidateCaptionName(wsCaptionName, bVersionFlag); | 554 GetValidateCaptionName(wsCaptionName, bVersionFlag); |
| 555 CFX_WideString wsError; | 555 CFX_WideString wsError; |
| 556 if (bVersionFlag) { | 556 if (bVersionFlag) { |
| 557 pAppProvider->LoadString(XFA_IDS_ValidateFailed, wsError); | 557 pAppProvider->LoadString(XFA_IDS_ValidateFailed, wsError); |
| 558 wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); | 558 wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); |
| 559 return; | 559 return; |
| 560 } | 560 } |
| 561 if (bError) { | 561 if (bError) { |
| 562 pAppProvider->LoadString(XFA_IDS_ValidateError, wsError); | 562 pAppProvider->LoadString(XFA_IDS_ValidateError, wsError); |
| 563 wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); | 563 wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 CFX_WideString wsWarning; | 566 CFX_WideString wsWarning; |
| 567 pAppProvider->LoadString(XFA_IDS_ValidateWarning, wsWarning); | 567 pAppProvider->LoadString(XFA_IDS_ValidateWarning, wsWarning); |
| 568 wsMessage.Format(wsWarning.c_str(), wsCaptionName.c_str(), | 568 wsMessage.Format(wsWarning.c_str(), wsCaptionName.c_str(), |
| 569 wsCaptionName.c_str()); | 569 wsCaptionName.c_str()); |
| 570 } | 570 } |
| 571 int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { | 571 int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { |
| 572 if (GetElementType() == XFA_Element::Draw) { | 572 if (GetElementType() == XFA_Element::Draw) { |
| 573 return XFA_EVENTERROR_NotExist; | 573 return XFA_EVENTERROR_NotExist; |
| 574 } | 574 } |
| 575 CXFA_Validate validate = GetValidate(); | 575 CXFA_Validate validate = GetValidate(); |
| 576 if (!validate) { | 576 if (!validate) { |
| 577 return XFA_EVENTERROR_NotExist; | 577 return XFA_EVENTERROR_NotExist; |
| 578 } | 578 } |
| 579 FX_BOOL bInitDoc = validate.GetNode()->NeedsInitApp(); | 579 bool bInitDoc = validate.GetNode()->NeedsInitApp(); |
| 580 FX_BOOL bStatus = | 580 bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End; |
| 581 m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End; | |
| 582 int32_t iFormat = 0; | 581 int32_t iFormat = 0; |
| 583 CFXJSE_Value* pRetValue = nullptr; | 582 CFXJSE_Value* pRetValue = nullptr; |
| 584 int32_t iRet = XFA_EVENTERROR_NotExist; | 583 int32_t iRet = XFA_EVENTERROR_NotExist; |
| 585 CXFA_Script script = validate.GetScript(); | 584 CXFA_Script script = validate.GetScript(); |
| 586 if (script) { | 585 if (script) { |
| 587 CXFA_EventParam eParam; | 586 CXFA_EventParam eParam; |
| 588 eParam.m_eType = XFA_EVENT_Validate; | 587 eParam.m_eType = XFA_EVENT_Validate; |
| 589 eParam.m_pTarget = this; | 588 eParam.m_pTarget = this; |
| 590 iRet = ExecuteScript(script, &eParam, | 589 iRet = ExecuteScript(script, &eParam, |
| 591 ((bInitDoc || bStatus) && GetRawValue().IsEmpty()) | 590 ((bInitDoc || bStatus) && GetRawValue().IsEmpty()) |
| 592 ? nullptr | 591 ? nullptr |
| 593 : &pRetValue); | 592 : &pRetValue); |
| 594 } | 593 } |
| 595 XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode(); | 594 XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode(); |
| 596 FX_BOOL bVersionFlag = FALSE; | 595 bool bVersionFlag = false; |
| 597 if (version < XFA_VERSION_208) { | 596 if (version < XFA_VERSION_208) { |
| 598 bVersionFlag = TRUE; | 597 bVersionFlag = true; |
| 599 } | 598 } |
| 600 if (bInitDoc) { | 599 if (bInitDoc) { |
| 601 validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp); | 600 validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp); |
| 602 } else { | 601 } else { |
| 603 iFormat = ProcessFormatTestValidate(validate, bVersionFlag); | 602 iFormat = ProcessFormatTestValidate(validate, bVersionFlag); |
| 604 if (!bVersionFlag) { | 603 if (!bVersionFlag) { |
| 605 bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting); | 604 bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting); |
| 606 } | 605 } |
| 607 iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag); | 606 iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag); |
| 608 } | 607 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 pContext->SetEventParam(*pEventParam); | 639 pContext->SetEventParam(*pEventParam); |
| 641 pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt()); | 640 pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt()); |
| 642 CXFA_NodeArray refNodes; | 641 CXFA_NodeArray refNodes; |
| 643 if (pEventParam->m_eType == XFA_EVENT_InitCalculate || | 642 if (pEventParam->m_eType == XFA_EVENT_InitCalculate || |
| 644 pEventParam->m_eType == XFA_EVENT_Calculate) { | 643 pEventParam->m_eType == XFA_EVENT_Calculate) { |
| 645 pContext->SetNodesOfRunScript(&refNodes); | 644 pContext->SetNodesOfRunScript(&refNodes); |
| 646 } | 645 } |
| 647 std::unique_ptr<CFXJSE_Value> pTmpRetValue( | 646 std::unique_ptr<CFXJSE_Value> pTmpRetValue( |
| 648 new CFXJSE_Value(pContext->GetRuntime())); | 647 new CFXJSE_Value(pContext->GetRuntime())); |
| 649 ++m_nRecursionDepth; | 648 ++m_nRecursionDepth; |
| 650 FX_BOOL bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, | 649 bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, |
| 651 wsExpression.AsStringC(), | 650 wsExpression.AsStringC(), pTmpRetValue.get(), |
| 652 pTmpRetValue.get(), m_pNode); | 651 m_pNode); |
| 653 --m_nRecursionDepth; | 652 --m_nRecursionDepth; |
| 654 int32_t iRet = XFA_EVENTERROR_Error; | 653 int32_t iRet = XFA_EVENTERROR_Error; |
| 655 if (bRet) { | 654 if (bRet) { |
| 656 iRet = XFA_EVENTERROR_Success; | 655 iRet = XFA_EVENTERROR_Success; |
| 657 if (pEventParam->m_eType == XFA_EVENT_Calculate || | 656 if (pEventParam->m_eType == XFA_EVENT_Calculate || |
| 658 pEventParam->m_eType == XFA_EVENT_InitCalculate) { | 657 pEventParam->m_eType == XFA_EVENT_InitCalculate) { |
| 659 if (!pTmpRetValue->IsUndefined()) { | 658 if (!pTmpRetValue->IsUndefined()) { |
| 660 if (!pTmpRetValue->IsNull()) | 659 if (!pTmpRetValue->IsNull()) |
| 661 pEventParam->m_wsResult = pTmpRetValue->ToWideString(); | 660 pEventParam->m_wsResult = pTmpRetValue->ToWideString(); |
| 662 | 661 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 mgCap.GetBottomInset(fBottomInset); | 764 mgCap.GetBottomInset(fBottomInset); |
| 766 if (bReserveExit) { | 765 if (bReserveExit) { |
| 767 bVert ? (szCap.x += fLeftInset + fRightInset) | 766 bVert ? (szCap.x += fLeftInset + fRightInset) |
| 768 : (szCap.y += fTopInset + fBottomInset); | 767 : (szCap.y += fTopInset + fBottomInset); |
| 769 } else { | 768 } else { |
| 770 szCap.x += fLeftInset + fRightInset; | 769 szCap.x += fLeftInset + fRightInset; |
| 771 szCap.y += fTopInset + fBottomInset; | 770 szCap.y += fTopInset + fBottomInset; |
| 772 } | 771 } |
| 773 } | 772 } |
| 774 } | 773 } |
| 775 FX_BOOL CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { | 774 bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { |
| 776 CFX_SizeF szCap; | 775 CFX_SizeF szCap; |
| 777 CalcCaptionSize(szCap); | 776 CalcCaptionSize(szCap); |
| 778 CFX_RectF rtUIMargin; | 777 CFX_RectF rtUIMargin; |
| 779 GetUIMargin(rtUIMargin); | 778 GetUIMargin(rtUIMargin); |
| 780 size.x += rtUIMargin.left + rtUIMargin.width; | 779 size.x += rtUIMargin.left + rtUIMargin.width; |
| 781 size.y += rtUIMargin.top + rtUIMargin.height; | 780 size.y += rtUIMargin.top + rtUIMargin.height; |
| 782 if (szCap.x > 0 && szCap.y > 0) { | 781 if (szCap.x > 0 && szCap.y > 0) { |
| 783 int32_t iCapPlacement = GetCaption().GetPlacementType(); | 782 int32_t iCapPlacement = GetCaption().GetPlacementType(); |
| 784 switch (iCapPlacement) { | 783 switch (iCapPlacement) { |
| 785 case XFA_ATTRIBUTEENUM_Left: | 784 case XFA_ATTRIBUTEENUM_Left: |
| 786 case XFA_ATTRIBUTEENUM_Right: | 785 case XFA_ATTRIBUTEENUM_Right: |
| 787 case XFA_ATTRIBUTEENUM_Inline: { | 786 case XFA_ATTRIBUTEENUM_Inline: { |
| 788 size.x += szCap.x; | 787 size.x += szCap.x; |
| 789 size.y = std::max(size.y, szCap.y); | 788 size.y = std::max(size.y, szCap.y); |
| 790 } break; | 789 } break; |
| 791 case XFA_ATTRIBUTEENUM_Top: | 790 case XFA_ATTRIBUTEENUM_Top: |
| 792 case XFA_ATTRIBUTEENUM_Bottom: { | 791 case XFA_ATTRIBUTEENUM_Bottom: { |
| 793 size.y += szCap.y; | 792 size.y += szCap.y; |
| 794 size.x = std::max(size.x, szCap.x); | 793 size.x = std::max(size.x, szCap.x); |
| 795 } | 794 } |
| 796 default: | 795 default: |
| 797 break; | 796 break; |
| 798 } | 797 } |
| 799 } | 798 } |
| 800 return CalculateWidgetAutoSize(size); | 799 return CalculateWidgetAutoSize(size); |
| 801 } | 800 } |
| 802 FX_BOOL CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { | 801 bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { |
| 803 CXFA_Margin mgWidget = GetMargin(); | 802 CXFA_Margin mgWidget = GetMargin(); |
| 804 if (mgWidget) { | 803 if (mgWidget) { |
| 805 FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; | 804 FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; |
| 806 mgWidget.GetLeftInset(fLeftInset); | 805 mgWidget.GetLeftInset(fLeftInset); |
| 807 mgWidget.GetTopInset(fTopInset); | 806 mgWidget.GetTopInset(fTopInset); |
| 808 mgWidget.GetRightInset(fRightInset); | 807 mgWidget.GetRightInset(fRightInset); |
| 809 mgWidget.GetBottomInset(fBottomInset); | 808 mgWidget.GetBottomInset(fBottomInset); |
| 810 size.x += fLeftInset + fRightInset; | 809 size.x += fLeftInset + fRightInset; |
| 811 size.y += fTopInset + fBottomInset; | 810 size.y += fTopInset + fBottomInset; |
| 812 } | 811 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 830 if (GetHeight(fVal)) { | 829 if (GetHeight(fVal)) { |
| 831 size.y = fVal; | 830 size.y = fVal; |
| 832 } else { | 831 } else { |
| 833 if (GetMinHeight(fMin)) { | 832 if (GetMinHeight(fMin)) { |
| 834 size.y = std::max(size.y, fMin); | 833 size.y = std::max(size.y, fMin); |
| 835 } | 834 } |
| 836 if (GetMaxHeight(fMax) && fMax > 0) { | 835 if (GetMaxHeight(fMax) && fMax > 0) { |
| 837 size.y = std::min(size.y, fMax); | 836 size.y = std::min(size.y, fMax); |
| 838 } | 837 } |
| 839 } | 838 } |
| 840 return TRUE; | 839 return true; |
| 841 } | 840 } |
| 842 void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { | 841 void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { |
| 843 FX_FLOAT fFontSize = GetFontSize(); | 842 FX_FLOAT fFontSize = GetFontSize(); |
| 844 CFX_WideString wsText; | 843 CFX_WideString wsText; |
| 845 GetValue(wsText, XFA_VALUEPICTURE_Display); | 844 GetValue(wsText, XFA_VALUEPICTURE_Display); |
| 846 if (wsText.IsEmpty()) { | 845 if (wsText.IsEmpty()) { |
| 847 size.y += fFontSize; | 846 size.y += fFontSize; |
| 848 return; | 847 return; |
| 849 } | 848 } |
| 850 FX_WCHAR wcEnter = '\n'; | 849 FX_WCHAR wcEnter = '\n'; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 864 pTextOut->SetLineSpace(GetLineHeight()); | 863 pTextOut->SetLineSpace(GetLineHeight()); |
| 865 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight; | 864 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight; |
| 866 if (GetUIType() == XFA_Element::TextEdit && IsMultiLine()) { | 865 if (GetUIType() == XFA_Element::TextEdit && IsMultiLine()) { |
| 867 dwStyles |= FDE_TTOSTYLE_LineWrap; | 866 dwStyles |= FDE_TTOSTYLE_LineWrap; |
| 868 } | 867 } |
| 869 pTextOut->SetStyles(dwStyles); | 868 pTextOut->SetStyles(dwStyles); |
| 870 } | 869 } |
| 871 layoutData->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), | 870 layoutData->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), |
| 872 size); | 871 size); |
| 873 } | 872 } |
| 874 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { | 873 bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { |
| 875 if (size.x > 0) { | 874 if (size.x > 0) { |
| 876 CFX_SizeF szOrz = size; | 875 CFX_SizeF szOrz = size; |
| 877 CFX_SizeF szCap; | 876 CFX_SizeF szCap; |
| 878 CalcCaptionSize(szCap); | 877 CalcCaptionSize(szCap); |
| 879 FX_BOOL bCapExit = szCap.x > 0.01 && szCap.y > 0.01; | 878 bool bCapExit = szCap.x > 0.01 && szCap.y > 0.01; |
| 880 int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; | 879 int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; |
| 881 if (bCapExit) { | 880 if (bCapExit) { |
| 882 iCapPlacement = GetCaption().GetPlacementType(); | 881 iCapPlacement = GetCaption().GetPlacementType(); |
| 883 switch (iCapPlacement) { | 882 switch (iCapPlacement) { |
| 884 case XFA_ATTRIBUTEENUM_Left: | 883 case XFA_ATTRIBUTEENUM_Left: |
| 885 case XFA_ATTRIBUTEENUM_Right: | 884 case XFA_ATTRIBUTEENUM_Right: |
| 886 case XFA_ATTRIBUTEENUM_Inline: { | 885 case XFA_ATTRIBUTEENUM_Inline: { |
| 887 size.x -= szCap.x; | 886 size.x -= szCap.x; |
| 888 } | 887 } |
| 889 default: | 888 default: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 916 default: | 915 default: |
| 917 break; | 916 break; |
| 918 } | 917 } |
| 919 } | 918 } |
| 920 size.x = szOrz.x; | 919 size.x = szOrz.x; |
| 921 return CalculateWidgetAutoSize(size); | 920 return CalculateWidgetAutoSize(size); |
| 922 } | 921 } |
| 923 CalculateTextContentSize(size); | 922 CalculateTextContentSize(size); |
| 924 return CalculateFieldAutoSize(size); | 923 return CalculateFieldAutoSize(size); |
| 925 } | 924 } |
| 926 FX_BOOL CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) { | 925 bool CXFA_WidgetAcc::CalculateCheckButtonAutoSize(CFX_SizeF& size) { |
| 927 FX_FLOAT fCheckSize = GetCheckButtonSize(); | 926 FX_FLOAT fCheckSize = GetCheckButtonSize(); |
| 928 size.x = size.y = fCheckSize; | 927 size.x = size.y = fCheckSize; |
| 929 return CalculateFieldAutoSize(size); | 928 return CalculateFieldAutoSize(size); |
| 930 } | 929 } |
| 931 FX_BOOL CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) { | 930 bool CXFA_WidgetAcc::CalculatePushButtonAutoSize(CFX_SizeF& size) { |
| 932 CalcCaptionSize(size); | 931 CalcCaptionSize(size); |
| 933 return CalculateWidgetAutoSize(size); | 932 return CalculateWidgetAutoSize(size); |
| 934 } | 933 } |
| 935 FX_BOOL CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) { | 934 bool CXFA_WidgetAcc::CalculateImageAutoSize(CFX_SizeF& size) { |
| 936 if (!GetImageImage()) { | 935 if (!GetImageImage()) { |
| 937 LoadImageImage(); | 936 LoadImageImage(); |
| 938 } | 937 } |
| 939 size.clear(); | 938 size.clear(); |
| 940 if (CFX_DIBitmap* pBitmap = GetImageImage()) { | 939 if (CFX_DIBitmap* pBitmap = GetImageImage()) { |
| 941 CFX_RectF rtImage, rtFit; | 940 CFX_RectF rtImage, rtFit; |
| 942 rtImage.Set(0, 0, 0, 0); | 941 rtImage.Set(0, 0, 0, 0); |
| 943 rtFit.Set(0, 0, 0, 0); | 942 rtFit.Set(0, 0, 0, 0); |
| 944 int32_t iImageXDpi = 0; | 943 int32_t iImageXDpi = 0; |
| 945 int32_t iImageYDpi = 0; | 944 int32_t iImageYDpi = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 956 if (GetHeight(rtFit.height)) { | 955 if (GetHeight(rtFit.height)) { |
| 957 GetHeightWithoutMargin(rtFit.height); | 956 GetHeightWithoutMargin(rtFit.height); |
| 958 } else { | 957 } else { |
| 959 rtFit.height = rtImage.height; | 958 rtFit.height = rtImage.height; |
| 960 } | 959 } |
| 961 size.x = rtFit.width; | 960 size.x = rtFit.width; |
| 962 size.y = rtFit.height; | 961 size.y = rtFit.height; |
| 963 } | 962 } |
| 964 return CalculateWidgetAutoSize(size); | 963 return CalculateWidgetAutoSize(size); |
| 965 } | 964 } |
| 966 FX_BOOL CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) { | 965 bool CXFA_WidgetAcc::CalculateImageEditAutoSize(CFX_SizeF& size) { |
| 967 if (!GetImageEditImage()) { | 966 if (!GetImageEditImage()) { |
| 968 LoadImageEditImage(); | 967 LoadImageEditImage(); |
| 969 } | 968 } |
| 970 size.clear(); | 969 size.clear(); |
| 971 if (CFX_DIBitmap* pBitmap = GetImageEditImage()) { | 970 if (CFX_DIBitmap* pBitmap = GetImageEditImage()) { |
| 972 CFX_RectF rtImage, rtFit; | 971 CFX_RectF rtImage, rtFit; |
| 973 rtImage.Set(0, 0, 0, 0); | 972 rtImage.Set(0, 0, 0, 0); |
| 974 rtFit.Set(0, 0, 0, 0); | 973 rtFit.Set(0, 0, 0, 0); |
| 975 int32_t iImageXDpi = 0; | 974 int32_t iImageXDpi = 0; |
| 976 int32_t iImageYDpi = 0; | 975 int32_t iImageYDpi = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 987 if (GetHeight(rtFit.height)) { | 986 if (GetHeight(rtFit.height)) { |
| 988 GetHeightWithoutMargin(rtFit.height); | 987 GetHeightWithoutMargin(rtFit.height); |
| 989 } else { | 988 } else { |
| 990 rtFit.height = rtImage.height; | 989 rtFit.height = rtImage.height; |
| 991 } | 990 } |
| 992 size.x = rtFit.width; | 991 size.x = rtFit.width; |
| 993 size.y = rtFit.height; | 992 size.y = rtFit.height; |
| 994 } | 993 } |
| 995 return CalculateFieldAutoSize(size); | 994 return CalculateFieldAutoSize(size); |
| 996 } | 995 } |
| 997 FX_BOOL CXFA_WidgetAcc::LoadImageImage() { | 996 bool CXFA_WidgetAcc::LoadImageImage() { |
| 998 InitLayoutData(); | 997 InitLayoutData(); |
| 999 return static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get()) | 998 return static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get()) |
| 1000 ->LoadImageData(this); | 999 ->LoadImageData(this); |
| 1001 } | 1000 } |
| 1002 FX_BOOL CXFA_WidgetAcc::LoadImageEditImage() { | 1001 bool CXFA_WidgetAcc::LoadImageEditImage() { |
| 1003 InitLayoutData(); | 1002 InitLayoutData(); |
| 1004 return static_cast<CXFA_ImageEditData*>(m_pLayoutData.get()) | 1003 return static_cast<CXFA_ImageEditData*>(m_pLayoutData.get()) |
| 1005 ->LoadImageData(this); | 1004 ->LoadImageData(this); |
| 1006 } | 1005 } |
| 1007 void CXFA_WidgetAcc::GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) { | 1006 void CXFA_WidgetAcc::GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) { |
| 1008 CXFA_ImageLayoutData* pData = | 1007 CXFA_ImageLayoutData* pData = |
| 1009 static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get()); | 1008 static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get()); |
| 1010 iImageXDpi = pData->m_iImageXDpi; | 1009 iImageXDpi = pData->m_iImageXDpi; |
| 1011 iImageYDpi = pData->m_iImageYDpi; | 1010 iImageYDpi = pData->m_iImageYDpi; |
| 1012 } | 1011 } |
| 1013 void CXFA_WidgetAcc::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) { | 1012 void CXFA_WidgetAcc::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) { |
| 1014 CXFA_ImageEditData* pData = | 1013 CXFA_ImageEditData* pData = |
| 1015 static_cast<CXFA_ImageEditData*>(m_pLayoutData.get()); | 1014 static_cast<CXFA_ImageEditData*>(m_pLayoutData.get()); |
| 1016 iImageXDpi = pData->m_iImageXDpi; | 1015 iImageXDpi = pData->m_iImageXDpi; |
| 1017 iImageYDpi = pData->m_iImageYDpi; | 1016 iImageYDpi = pData->m_iImageYDpi; |
| 1018 } | 1017 } |
| 1019 FX_BOOL CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) { | 1018 bool CXFA_WidgetAcc::CalculateTextAutoSize(CFX_SizeF& size) { |
| 1020 LoadText(); | 1019 LoadText(); |
| 1021 CXFA_TextLayout* pTextLayout = | 1020 CXFA_TextLayout* pTextLayout = |
| 1022 static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout(); | 1021 static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout(); |
| 1023 if (pTextLayout) { | 1022 if (pTextLayout) { |
| 1024 size.x = pTextLayout->StartLayout(size.x); | 1023 size.x = pTextLayout->StartLayout(size.x); |
| 1025 size.y = pTextLayout->GetLayoutHeight(); | 1024 size.y = pTextLayout->GetLayoutHeight(); |
| 1026 } | 1025 } |
| 1027 return CalculateWidgetAutoSize(size); | 1026 return CalculateWidgetAutoSize(size); |
| 1028 } | 1027 } |
| 1029 void CXFA_WidgetAcc::LoadText() { | 1028 void CXFA_WidgetAcc::LoadText() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 case XFA_Element::ExclGroup: | 1148 case XFA_Element::ExclGroup: |
| 1150 CalculateWidgetAutoSize(sz); | 1149 CalculateWidgetAutoSize(sz); |
| 1151 break; | 1150 break; |
| 1152 default: | 1151 default: |
| 1153 break; | 1152 break; |
| 1154 } | 1153 } |
| 1155 fWidth = sz.x; | 1154 fWidth = sz.x; |
| 1156 m_pLayoutData->m_fWidgetHeight = sz.y; | 1155 m_pLayoutData->m_fWidgetHeight = sz.y; |
| 1157 fCalcHeight = sz.y; | 1156 fCalcHeight = sz.y; |
| 1158 } | 1157 } |
| 1159 FX_BOOL CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, | 1158 bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight) { |
| 1160 FX_FLOAT& fCalcHeight) { | |
| 1161 XFA_Element eUIType = GetUIType(); | 1159 XFA_Element eUIType = GetUIType(); |
| 1162 if (eUIType == XFA_Element::Subform) { | 1160 if (eUIType == XFA_Element::Subform) { |
| 1163 return FALSE; | 1161 return false; |
| 1164 } | 1162 } |
| 1165 if (eUIType != XFA_Element::Text && eUIType != XFA_Element::TextEdit && | 1163 if (eUIType != XFA_Element::Text && eUIType != XFA_Element::TextEdit && |
| 1166 eUIType != XFA_Element::NumericEdit && | 1164 eUIType != XFA_Element::NumericEdit && |
| 1167 eUIType != XFA_Element::PasswordEdit) { | 1165 eUIType != XFA_Element::PasswordEdit) { |
| 1168 fCalcHeight = 0; | 1166 fCalcHeight = 0; |
| 1169 return TRUE; | 1167 return true; |
| 1170 } | 1168 } |
| 1171 FX_FLOAT fTopInset = 0; | 1169 FX_FLOAT fTopInset = 0; |
| 1172 FX_FLOAT fBottomInset = 0; | 1170 FX_FLOAT fBottomInset = 0; |
| 1173 if (iBlockIndex == 0) { | 1171 if (iBlockIndex == 0) { |
| 1174 CXFA_Margin mgWidget = GetMargin(); | 1172 CXFA_Margin mgWidget = GetMargin(); |
| 1175 if (mgWidget) { | 1173 if (mgWidget) { |
| 1176 mgWidget.GetTopInset(fTopInset); | 1174 mgWidget.GetTopInset(fTopInset); |
| 1177 mgWidget.GetBottomInset(fBottomInset); | 1175 mgWidget.GetBottomInset(fBottomInset); |
| 1178 } | 1176 } |
| 1179 CFX_RectF rtUIMargin; | 1177 CFX_RectF rtUIMargin; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1191 } | 1189 } |
| 1192 CXFA_TextLayout* pTextLayout = | 1190 CXFA_TextLayout* pTextLayout = |
| 1193 static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout(); | 1191 static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout(); |
| 1194 pTextLayout->DoLayout(iBlockIndex, fCalcHeight, fCalcHeight, | 1192 pTextLayout->DoLayout(iBlockIndex, fCalcHeight, fCalcHeight, |
| 1195 m_pLayoutData->m_fWidgetHeight - fTopInset); | 1193 m_pLayoutData->m_fWidgetHeight - fTopInset); |
| 1196 if (fCalcHeight != 0) { | 1194 if (fCalcHeight != 0) { |
| 1197 if (iBlockIndex == 0) { | 1195 if (iBlockIndex == 0) { |
| 1198 fCalcHeight = fCalcHeight + fTopInset; | 1196 fCalcHeight = fCalcHeight + fTopInset; |
| 1199 } | 1197 } |
| 1200 if (fabs(fHeight - fCalcHeight) < XFA_FLOAT_PERCISION) { | 1198 if (fabs(fHeight - fCalcHeight) < XFA_FLOAT_PERCISION) { |
| 1201 return FALSE; | 1199 return false; |
| 1202 } | 1200 } |
| 1203 } | 1201 } |
| 1204 return TRUE; | 1202 return true; |
| 1205 } | 1203 } |
| 1206 XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; | 1204 XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; |
| 1207 FX_FLOAT fCapReserve = 0; | 1205 FX_FLOAT fCapReserve = 0; |
| 1208 if (iBlockIndex == 0) { | 1206 if (iBlockIndex == 0) { |
| 1209 CXFA_Caption caption = GetCaption(); | 1207 CXFA_Caption caption = GetCaption(); |
| 1210 if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { | 1208 if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { |
| 1211 iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); | 1209 iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); |
| 1212 fCapReserve = caption.GetReserve(); | 1210 fCapReserve = caption.GetReserve(); |
| 1213 } | 1211 } |
| 1214 if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && | 1212 if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && |
| 1215 fCalcHeight < fCapReserve + fTopInset) { | 1213 fCalcHeight < fCapReserve + fTopInset) { |
| 1216 fCalcHeight = 0; | 1214 fCalcHeight = 0; |
| 1217 return TRUE; | 1215 return true; |
| 1218 } | 1216 } |
| 1219 if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && | 1217 if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && |
| 1220 m_pLayoutData->m_fWidgetHeight - fCapReserve - fBottomInset) { | 1218 m_pLayoutData->m_fWidgetHeight - fCapReserve - fBottomInset) { |
| 1221 fCalcHeight = 0; | 1219 fCalcHeight = 0; |
| 1222 return TRUE; | 1220 return true; |
| 1223 } | 1221 } |
| 1224 if (iCapPlacement != XFA_ATTRIBUTEENUM_Top) { | 1222 if (iCapPlacement != XFA_ATTRIBUTEENUM_Top) { |
| 1225 fCapReserve = 0; | 1223 fCapReserve = 0; |
| 1226 } | 1224 } |
| 1227 } | 1225 } |
| 1228 CXFA_FieldLayoutData* pFieldData = | 1226 CXFA_FieldLayoutData* pFieldData = |
| 1229 static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()); | 1227 static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()); |
| 1230 int32_t iLinesCount = 0; | 1228 int32_t iLinesCount = 0; |
| 1231 FX_FLOAT fHeight = m_pLayoutData->m_fWidgetHeight; | 1229 FX_FLOAT fHeight = m_pLayoutData->m_fWidgetHeight; |
| 1232 CFX_WideString wsText; | 1230 CFX_WideString wsText; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1244 if (!pFieldData->m_pFieldSplitArray) { | 1242 if (!pFieldData->m_pFieldSplitArray) { |
| 1245 pFieldData->m_pFieldSplitArray.reset(new CFX_FloatArray); | 1243 pFieldData->m_pFieldSplitArray.reset(new CFX_FloatArray); |
| 1246 } | 1244 } |
| 1247 CFX_FloatArray* pFieldArray = pFieldData->m_pFieldSplitArray.get(); | 1245 CFX_FloatArray* pFieldArray = pFieldData->m_pFieldSplitArray.get(); |
| 1248 int32_t iFieldSplitCount = pFieldArray->GetSize(); | 1246 int32_t iFieldSplitCount = pFieldArray->GetSize(); |
| 1249 for (int32_t i = 0; i < iBlockIndex * 3; i += 3) { | 1247 for (int32_t i = 0; i < iBlockIndex * 3; i += 3) { |
| 1250 iLinesCount -= (int32_t)pFieldArray->GetAt(i + 1); | 1248 iLinesCount -= (int32_t)pFieldArray->GetAt(i + 1); |
| 1251 fHeight -= pFieldArray->GetAt(i + 2); | 1249 fHeight -= pFieldArray->GetAt(i + 2); |
| 1252 } | 1250 } |
| 1253 if (iLinesCount == 0) { | 1251 if (iLinesCount == 0) { |
| 1254 return FALSE; | 1252 return false; |
| 1255 } | 1253 } |
| 1256 FX_FLOAT fLineHeight = GetLineHeight(); | 1254 FX_FLOAT fLineHeight = GetLineHeight(); |
| 1257 FX_FLOAT fFontSize = GetFontSize(); | 1255 FX_FLOAT fFontSize = GetFontSize(); |
| 1258 FX_FLOAT fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize; | 1256 FX_FLOAT fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize; |
| 1259 FX_FLOAT fSpaceAbove = 0; | 1257 FX_FLOAT fSpaceAbove = 0; |
| 1260 FX_FLOAT fStartOffset = 0; | 1258 FX_FLOAT fStartOffset = 0; |
| 1261 if (fHeight > 0.1f && iBlockIndex == 0) { | 1259 if (fHeight > 0.1f && iBlockIndex == 0) { |
| 1262 fStartOffset = fTopInset; | 1260 fStartOffset = fTopInset; |
| 1263 fHeight -= (fTopInset + fBottomInset); | 1261 fHeight -= (fTopInset + fBottomInset); |
| 1264 if (CXFA_Para para = GetPara()) { | 1262 if (CXFA_Para para = GetPara()) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1286 if (fStartOffset < 0.1f) { | 1284 if (fStartOffset < 0.1f) { |
| 1287 fStartOffset = 0; | 1285 fStartOffset = 0; |
| 1288 } | 1286 } |
| 1289 } | 1287 } |
| 1290 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { | 1288 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { |
| 1291 pFieldArray->SetAt(0, fStartOffset); | 1289 pFieldArray->SetAt(0, fStartOffset); |
| 1292 } else { | 1290 } else { |
| 1293 pFieldArray->Add(fStartOffset); | 1291 pFieldArray->Add(fStartOffset); |
| 1294 } | 1292 } |
| 1295 XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode(); | 1293 XFA_VERSION version = GetDoc()->GetXFADoc()->GetCurVersionMode(); |
| 1296 FX_BOOL bCanSplitNoContent = FALSE; | 1294 bool bCanSplitNoContent = false; |
| 1297 XFA_ATTRIBUTEENUM eLayoutMode; | 1295 XFA_ATTRIBUTEENUM eLayoutMode; |
| 1298 GetNode() | 1296 GetNode() |
| 1299 ->GetNodeItem(XFA_NODEITEM_Parent) | 1297 ->GetNodeItem(XFA_NODEITEM_Parent) |
| 1300 ->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, TRUE); | 1298 ->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, true); |
| 1301 if ((eLayoutMode == XFA_ATTRIBUTEENUM_Position || | 1299 if ((eLayoutMode == XFA_ATTRIBUTEENUM_Position || |
| 1302 eLayoutMode == XFA_ATTRIBUTEENUM_Tb || | 1300 eLayoutMode == XFA_ATTRIBUTEENUM_Tb || |
| 1303 eLayoutMode == XFA_ATTRIBUTEENUM_Row || | 1301 eLayoutMode == XFA_ATTRIBUTEENUM_Row || |
| 1304 eLayoutMode == XFA_ATTRIBUTEENUM_Table) && | 1302 eLayoutMode == XFA_ATTRIBUTEENUM_Table) && |
| 1305 version > XFA_VERSION_208) { | 1303 version > XFA_VERSION_208) { |
| 1306 bCanSplitNoContent = TRUE; | 1304 bCanSplitNoContent = true; |
| 1307 } | 1305 } |
| 1308 if ((eLayoutMode == XFA_ATTRIBUTEENUM_Tb || | 1306 if ((eLayoutMode == XFA_ATTRIBUTEENUM_Tb || |
| 1309 eLayoutMode == XFA_ATTRIBUTEENUM_Row || | 1307 eLayoutMode == XFA_ATTRIBUTEENUM_Row || |
| 1310 eLayoutMode == XFA_ATTRIBUTEENUM_Table) && | 1308 eLayoutMode == XFA_ATTRIBUTEENUM_Table) && |
| 1311 version <= XFA_VERSION_208) { | 1309 version <= XFA_VERSION_208) { |
| 1312 if (fStartOffset < fCalcHeight) { | 1310 if (fStartOffset < fCalcHeight) { |
| 1313 bCanSplitNoContent = TRUE; | 1311 bCanSplitNoContent = true; |
| 1314 } else { | 1312 } else { |
| 1315 fCalcHeight = 0; | 1313 fCalcHeight = 0; |
| 1316 return TRUE; | 1314 return true; |
| 1317 } | 1315 } |
| 1318 } | 1316 } |
| 1319 if (bCanSplitNoContent) { | 1317 if (bCanSplitNoContent) { |
| 1320 if ((fCalcHeight - fTopInset - fSpaceAbove < fLineHeight)) { | 1318 if ((fCalcHeight - fTopInset - fSpaceAbove < fLineHeight)) { |
| 1321 fCalcHeight = 0; | 1319 fCalcHeight = 0; |
| 1322 return TRUE; | 1320 return true; |
| 1323 } | 1321 } |
| 1324 if (fStartOffset + XFA_FLOAT_PERCISION >= fCalcHeight) { | 1322 if (fStartOffset + XFA_FLOAT_PERCISION >= fCalcHeight) { |
| 1325 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { | 1323 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { |
| 1326 pFieldArray->SetAt(iBlockIndex * 3 + 1, 0); | 1324 pFieldArray->SetAt(iBlockIndex * 3 + 1, 0); |
| 1327 pFieldArray->SetAt(iBlockIndex * 3 + 2, fCalcHeight); | 1325 pFieldArray->SetAt(iBlockIndex * 3 + 2, fCalcHeight); |
| 1328 } else { | 1326 } else { |
| 1329 pFieldArray->Add(0); | 1327 pFieldArray->Add(0); |
| 1330 pFieldArray->Add(fCalcHeight); | 1328 pFieldArray->Add(fCalcHeight); |
| 1331 } | 1329 } |
| 1332 return FALSE; | 1330 return false; |
| 1333 } | 1331 } |
| 1334 if (fCalcHeight - fStartOffset < fLineHeight) { | 1332 if (fCalcHeight - fStartOffset < fLineHeight) { |
| 1335 fCalcHeight = fStartOffset; | 1333 fCalcHeight = fStartOffset; |
| 1336 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { | 1334 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { |
| 1337 pFieldArray->SetAt(iBlockIndex * 3 + 1, 0); | 1335 pFieldArray->SetAt(iBlockIndex * 3 + 1, 0); |
| 1338 pFieldArray->SetAt(iBlockIndex * 3 + 2, fCalcHeight); | 1336 pFieldArray->SetAt(iBlockIndex * 3 + 2, fCalcHeight); |
| 1339 } else { | 1337 } else { |
| 1340 pFieldArray->Add(0); | 1338 pFieldArray->Add(0); |
| 1341 pFieldArray->Add(fCalcHeight); | 1339 pFieldArray->Add(fCalcHeight); |
| 1342 } | 1340 } |
| 1343 return TRUE; | 1341 return true; |
| 1344 } | 1342 } |
| 1345 FX_FLOAT fTextNum = | 1343 FX_FLOAT fTextNum = |
| 1346 fCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset; | 1344 fCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset; |
| 1347 int32_t iLineNum = | 1345 int32_t iLineNum = |
| 1348 (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight); | 1346 (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight); |
| 1349 if (iLineNum >= iLinesCount) { | 1347 if (iLineNum >= iLinesCount) { |
| 1350 if (fCalcHeight - fStartOffset - fTextHeight >= fFontSize) { | 1348 if (fCalcHeight - fStartOffset - fTextHeight >= fFontSize) { |
| 1351 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { | 1349 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { |
| 1352 pFieldArray->SetAt(iBlockIndex * 3 + 1, (FX_FLOAT)iLinesCount); | 1350 pFieldArray->SetAt(iBlockIndex * 3 + 1, (FX_FLOAT)iLinesCount); |
| 1353 pFieldArray->SetAt(iBlockIndex * 3 + 2, fCalcHeight); | 1351 pFieldArray->SetAt(iBlockIndex * 3 + 2, fCalcHeight); |
| 1354 } else { | 1352 } else { |
| 1355 pFieldArray->Add((FX_FLOAT)iLinesCount); | 1353 pFieldArray->Add((FX_FLOAT)iLinesCount); |
| 1356 pFieldArray->Add(fCalcHeight); | 1354 pFieldArray->Add(fCalcHeight); |
| 1357 } | 1355 } |
| 1358 return FALSE; | 1356 return false; |
| 1359 } | 1357 } |
| 1360 if (fHeight - fStartOffset - fTextHeight < fFontSize) { | 1358 if (fHeight - fStartOffset - fTextHeight < fFontSize) { |
| 1361 iLineNum -= 1; | 1359 iLineNum -= 1; |
| 1362 if (iLineNum == 0) { | 1360 if (iLineNum == 0) { |
| 1363 fCalcHeight = 0; | 1361 fCalcHeight = 0; |
| 1364 return TRUE; | 1362 return true; |
| 1365 } | 1363 } |
| 1366 } else { | 1364 } else { |
| 1367 iLineNum = (int32_t)(fTextNum / fLineHeight); | 1365 iLineNum = (int32_t)(fTextNum / fLineHeight); |
| 1368 } | 1366 } |
| 1369 } | 1367 } |
| 1370 if (iLineNum > 0) { | 1368 if (iLineNum > 0) { |
| 1371 FX_FLOAT fSplitHeight = | 1369 FX_FLOAT fSplitHeight = |
| 1372 iLineNum * fLineHeight + fCapReserve + fStartOffset; | 1370 iLineNum * fLineHeight + fCapReserve + fStartOffset; |
| 1373 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { | 1371 if (iFieldSplitCount / 3 == (iBlockIndex + 1)) { |
| 1374 pFieldArray->SetAt(iBlockIndex * 3 + 1, (FX_FLOAT)iLineNum); | 1372 pFieldArray->SetAt(iBlockIndex * 3 + 1, (FX_FLOAT)iLineNum); |
| 1375 pFieldArray->SetAt(iBlockIndex * 3 + 2, fSplitHeight); | 1373 pFieldArray->SetAt(iBlockIndex * 3 + 2, fSplitHeight); |
| 1376 } else { | 1374 } else { |
| 1377 pFieldArray->Add((FX_FLOAT)iLineNum); | 1375 pFieldArray->Add((FX_FLOAT)iLineNum); |
| 1378 pFieldArray->Add(fSplitHeight); | 1376 pFieldArray->Add(fSplitHeight); |
| 1379 } | 1377 } |
| 1380 if (fabs(fSplitHeight - fCalcHeight) < XFA_FLOAT_PERCISION) { | 1378 if (fabs(fSplitHeight - fCalcHeight) < XFA_FLOAT_PERCISION) { |
| 1381 return FALSE; | 1379 return false; |
| 1382 } | 1380 } |
| 1383 fCalcHeight = fSplitHeight; | 1381 fCalcHeight = fSplitHeight; |
| 1384 return TRUE; | 1382 return true; |
| 1385 } | 1383 } |
| 1386 } | 1384 } |
| 1387 fCalcHeight = 0; | 1385 fCalcHeight = 0; |
| 1388 return TRUE; | 1386 return true; |
| 1389 } | 1387 } |
| 1390 void CXFA_WidgetAcc::InitLayoutData() { | 1388 void CXFA_WidgetAcc::InitLayoutData() { |
| 1391 if (m_pLayoutData) { | 1389 if (m_pLayoutData) { |
| 1392 return; | 1390 return; |
| 1393 } | 1391 } |
| 1394 switch (GetUIType()) { | 1392 switch (GetUIType()) { |
| 1395 case XFA_Element::Text: | 1393 case XFA_Element::Text: |
| 1396 m_pLayoutData.reset(new CXFA_TextLayoutData); | 1394 m_pLayoutData.reset(new CXFA_TextLayoutData); |
| 1397 return; | 1395 return; |
| 1398 case XFA_Element::TextEdit: | 1396 case XFA_Element::TextEdit: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1427 fTextHeight = GetHeightWithoutMargin(fTextHeight); | 1425 fTextHeight = GetHeightWithoutMargin(fTextHeight); |
| 1428 pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight); | 1426 pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight); |
| 1429 return; | 1427 return; |
| 1430 } | 1428 } |
| 1431 if (fCalcWidth > 0 && fCalcHeight < 0) { | 1429 if (fCalcWidth > 0 && fCalcHeight < 0) { |
| 1432 FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth); | 1430 FX_FLOAT fWidth = GetWidthWithoutMargin(fCalcWidth); |
| 1433 pTextLayout->StartLayout(fWidth); | 1431 pTextLayout->StartLayout(fWidth); |
| 1434 } | 1432 } |
| 1435 if (fCalcWidth < 0 && fCalcHeight < 0) { | 1433 if (fCalcWidth < 0 && fCalcHeight < 0) { |
| 1436 FX_FLOAT fMaxWidth = -1; | 1434 FX_FLOAT fMaxWidth = -1; |
| 1437 FX_BOOL bRet = GetWidth(fMaxWidth); | 1435 bool bRet = GetWidth(fMaxWidth); |
| 1438 if (bRet) { | 1436 if (bRet) { |
| 1439 FX_FLOAT fWidth = GetWidthWithoutMargin(fMaxWidth); | 1437 FX_FLOAT fWidth = GetWidthWithoutMargin(fMaxWidth); |
| 1440 pTextLayout->StartLayout(fWidth); | 1438 pTextLayout->StartLayout(fWidth); |
| 1441 } else { | 1439 } else { |
| 1442 FX_FLOAT fWidth = pTextLayout->StartLayout(fMaxWidth); | 1440 FX_FLOAT fWidth = pTextLayout->StartLayout(fMaxWidth); |
| 1443 fMaxWidth = CalculateWidgetAutoWidth(fWidth); | 1441 fMaxWidth = CalculateWidgetAutoWidth(fWidth); |
| 1444 fWidth = GetWidthWithoutMargin(fMaxWidth); | 1442 fWidth = GetWidthWithoutMargin(fMaxWidth); |
| 1445 pTextLayout->StartLayout(fWidth); | 1443 pTextLayout->StartLayout(fWidth); |
| 1446 } | 1444 } |
| 1447 fCalcWidth = fMaxWidth; | 1445 fCalcWidth = fMaxWidth; |
| 1448 } | 1446 } |
| 1449 if (m_pLayoutData->m_fWidgetHeight < 0) { | 1447 if (m_pLayoutData->m_fWidgetHeight < 0) { |
| 1450 m_pLayoutData->m_fWidgetHeight = pTextLayout->GetLayoutHeight(); | 1448 m_pLayoutData->m_fWidgetHeight = pTextLayout->GetLayoutHeight(); |
| 1451 m_pLayoutData->m_fWidgetHeight = | 1449 m_pLayoutData->m_fWidgetHeight = |
| 1452 CalculateWidgetAutoHeight(m_pLayoutData->m_fWidgetHeight); | 1450 CalculateWidgetAutoHeight(m_pLayoutData->m_fWidgetHeight); |
| 1453 } | 1451 } |
| 1454 fTextHeight = m_pLayoutData->m_fWidgetHeight; | 1452 fTextHeight = m_pLayoutData->m_fWidgetHeight; |
| 1455 fTextHeight = GetHeightWithoutMargin(fTextHeight); | 1453 fTextHeight = GetHeightWithoutMargin(fTextHeight); |
| 1456 pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight); | 1454 pTextLayout->DoLayout(0, fTextHeight, -1, fTextHeight); |
| 1457 fCalcHeight = m_pLayoutData->m_fWidgetHeight; | 1455 fCalcHeight = m_pLayoutData->m_fWidgetHeight; |
| 1458 } | 1456 } |
| 1459 FX_BOOL CXFA_WidgetAcc::LoadCaption() { | 1457 bool CXFA_WidgetAcc::LoadCaption() { |
| 1460 InitLayoutData(); | 1458 InitLayoutData(); |
| 1461 return static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()) | 1459 return static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()) |
| 1462 ->LoadCaption(this); | 1460 ->LoadCaption(this); |
| 1463 } | 1461 } |
| 1464 CXFA_TextLayout* CXFA_WidgetAcc::GetCaptionTextLayout() { | 1462 CXFA_TextLayout* CXFA_WidgetAcc::GetCaptionTextLayout() { |
| 1465 return m_pLayoutData | 1463 return m_pLayoutData |
| 1466 ? static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()) | 1464 ? static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()) |
| 1467 ->m_pCapTextLayout.get() | 1465 ->m_pCapTextLayout.get() |
| 1468 : nullptr; | 1466 : nullptr; |
| 1469 } | 1467 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 fLineHeight = GetFontSize() * 1.2f; | 1544 fLineHeight = GetFontSize() * 1.2f; |
| 1547 } | 1545 } |
| 1548 return fLineHeight; | 1546 return fLineHeight; |
| 1549 } | 1547 } |
| 1550 FX_ARGB CXFA_WidgetAcc::GetTextColor() { | 1548 FX_ARGB CXFA_WidgetAcc::GetTextColor() { |
| 1551 if (CXFA_Font font = GetFont()) { | 1549 if (CXFA_Font font = GetFont()) { |
| 1552 return font.GetColor(); | 1550 return font.GetColor(); |
| 1553 } | 1551 } |
| 1554 return 0xFF000000; | 1552 return 0xFF000000; |
| 1555 } | 1553 } |
| 1556 CXFA_Node* CXFA_TextProvider::GetTextNode(FX_BOOL& bRichText) { | 1554 CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { |
| 1557 bRichText = FALSE; | 1555 bRichText = false; |
| 1558 if (m_pTextNode) { | 1556 if (m_pTextNode) { |
| 1559 if (m_pTextNode->GetElementType() == XFA_Element::ExData) { | 1557 if (m_pTextNode->GetElementType() == XFA_Element::ExData) { |
| 1560 CFX_WideString wsContentType; | 1558 CFX_WideString wsContentType; |
| 1561 m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, | 1559 m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, |
| 1562 FALSE); | 1560 false); |
| 1563 if (wsContentType == FX_WSTRC(L"text/html")) { | 1561 if (wsContentType == FX_WSTRC(L"text/html")) { |
| 1564 bRichText = TRUE; | 1562 bRichText = true; |
| 1565 } | 1563 } |
| 1566 } | 1564 } |
| 1567 return m_pTextNode; | 1565 return m_pTextNode; |
| 1568 } | 1566 } |
| 1569 if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { | 1567 if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { |
| 1570 CXFA_Node* pElementNode = m_pWidgetAcc->GetNode(); | 1568 CXFA_Node* pElementNode = m_pWidgetAcc->GetNode(); |
| 1571 CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value); | 1569 CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value); |
| 1572 if (!pValueNode) { | 1570 if (!pValueNode) { |
| 1573 return nullptr; | 1571 return nullptr; |
| 1574 } | 1572 } |
| 1575 CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1573 CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1576 if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { | 1574 if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { |
| 1577 CFX_WideString wsContentType; | 1575 CFX_WideString wsContentType; |
| 1578 pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 1576 pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); |
| 1579 if (wsContentType == FX_WSTRC(L"text/html")) { | 1577 if (wsContentType == FX_WSTRC(L"text/html")) { |
| 1580 bRichText = TRUE; | 1578 bRichText = true; |
| 1581 } | 1579 } |
| 1582 } | 1580 } |
| 1583 return pChildNode; | 1581 return pChildNode; |
| 1584 } else if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) { | 1582 } else if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) { |
| 1585 CXFA_Node* pBind = m_pWidgetAcc->GetDatasets(); | 1583 CXFA_Node* pBind = m_pWidgetAcc->GetDatasets(); |
| 1586 CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); | 1584 CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); |
| 1587 ASSERT(pXMLNode); | 1585 ASSERT(pXMLNode); |
| 1588 for (CFDE_XMLNode* pXMLChild = | 1586 for (CFDE_XMLNode* pXMLChild = |
| 1589 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); | 1587 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); |
| 1590 pXMLChild; | 1588 pXMLChild; |
| 1591 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 1589 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
| 1592 if (pXMLChild->GetType() == FDE_XMLNODE_Element) { | 1590 if (pXMLChild->GetType() == FDE_XMLNODE_Element) { |
| 1593 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLChild); | 1591 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLChild); |
| 1594 if (XFA_RecognizeRichText(pElement)) { | 1592 if (XFA_RecognizeRichText(pElement)) { |
| 1595 bRichText = TRUE; | 1593 bRichText = true; |
| 1596 } | 1594 } |
| 1597 } | 1595 } |
| 1598 } | 1596 } |
| 1599 return pBind; | 1597 return pBind; |
| 1600 } else if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) { | 1598 } else if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) { |
| 1601 CXFA_Node* pCaptionNode = | 1599 CXFA_Node* pCaptionNode = |
| 1602 m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); | 1600 m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); |
| 1603 if (!pCaptionNode) { | 1601 if (!pCaptionNode) { |
| 1604 return nullptr; | 1602 return nullptr; |
| 1605 } | 1603 } |
| 1606 CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value); | 1604 CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value); |
| 1607 if (!pValueNode) { | 1605 if (!pValueNode) { |
| 1608 return nullptr; | 1606 return nullptr; |
| 1609 } | 1607 } |
| 1610 CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1608 CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1611 if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { | 1609 if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { |
| 1612 CFX_WideString wsContentType; | 1610 CFX_WideString wsContentType; |
| 1613 pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 1611 pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); |
| 1614 if (wsContentType == FX_WSTRC(L"text/html")) { | 1612 if (wsContentType == FX_WSTRC(L"text/html")) { |
| 1615 bRichText = TRUE; | 1613 bRichText = true; |
| 1616 } | 1614 } |
| 1617 } | 1615 } |
| 1618 return pChildNode; | 1616 return pChildNode; |
| 1619 } | 1617 } |
| 1620 CXFA_Node* pItemNode = | 1618 CXFA_Node* pItemNode = |
| 1621 m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items); | 1619 m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items); |
| 1622 if (!pItemNode) { | 1620 if (!pItemNode) { |
| 1623 return nullptr; | 1621 return nullptr; |
| 1624 } | 1622 } |
| 1625 CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1623 CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1648 if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { | 1646 if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { |
| 1649 return m_pWidgetAcc->GetFont(); | 1647 return m_pWidgetAcc->GetFont(); |
| 1650 } | 1648 } |
| 1651 CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); | 1649 CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); |
| 1652 pNode = pNode->GetChild(0, XFA_Element::Font); | 1650 pNode = pNode->GetChild(0, XFA_Element::Font); |
| 1653 if (pNode) { | 1651 if (pNode) { |
| 1654 return CXFA_Font(pNode); | 1652 return CXFA_Font(pNode); |
| 1655 } | 1653 } |
| 1656 return m_pWidgetAcc->GetFont(); | 1654 return m_pWidgetAcc->GetFont(); |
| 1657 } | 1655 } |
| 1658 FX_BOOL CXFA_TextProvider::IsCheckButtonAndAutoWidth() { | 1656 bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() { |
| 1659 XFA_Element eType = m_pWidgetAcc->GetUIType(); | 1657 XFA_Element eType = m_pWidgetAcc->GetUIType(); |
| 1660 if (eType == XFA_Element::CheckButton) { | 1658 if (eType == XFA_Element::CheckButton) { |
| 1661 FX_FLOAT fWidth = 0; | 1659 FX_FLOAT fWidth = 0; |
| 1662 return !m_pWidgetAcc->GetWidth(fWidth); | 1660 return !m_pWidgetAcc->GetWidth(fWidth); |
| 1663 } | 1661 } |
| 1664 return FALSE; | 1662 return false; |
| 1665 } | 1663 } |
| 1666 FX_BOOL CXFA_TextProvider::GetEmbbedObj(FX_BOOL bURI, | 1664 bool CXFA_TextProvider::GetEmbbedObj(bool bURI, |
| 1667 FX_BOOL bRaw, | 1665 bool bRaw, |
| 1668 const CFX_WideString& wsAttr, | 1666 const CFX_WideString& wsAttr, |
| 1669 CFX_WideString& wsValue) { | 1667 CFX_WideString& wsValue) { |
| 1670 if (m_eType != XFA_TEXTPROVIDERTYPE_Text) { | 1668 if (m_eType != XFA_TEXTPROVIDERTYPE_Text) { |
| 1671 return FALSE; | 1669 return false; |
| 1672 } | 1670 } |
| 1673 if (bURI) { | 1671 if (bURI) { |
| 1674 CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode(); | 1672 CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode(); |
| 1675 CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent); | 1673 CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1676 CXFA_Document* pDocument = pWidgetNode->GetDocument(); | 1674 CXFA_Document* pDocument = pWidgetNode->GetDocument(); |
| 1677 CXFA_Node* pIDNode = nullptr; | 1675 CXFA_Node* pIDNode = nullptr; |
| 1678 CXFA_WidgetAcc* pEmbAcc = nullptr; | 1676 CXFA_WidgetAcc* pEmbAcc = nullptr; |
| 1679 if (pParent) { | 1677 if (pParent) { |
| 1680 pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC()); | 1678 pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC()); |
| 1681 } | 1679 } |
| 1682 if (!pIDNode) { | 1680 if (!pIDNode) { |
| 1683 pIDNode = pDocument->GetNodeByID( | 1681 pIDNode = pDocument->GetNodeByID( |
| 1684 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), | 1682 ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), |
| 1685 wsAttr.AsStringC()); | 1683 wsAttr.AsStringC()); |
| 1686 } | 1684 } |
| 1687 if (pIDNode) { | 1685 if (pIDNode) { |
| 1688 pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData()); | 1686 pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData()); |
| 1689 } | 1687 } |
| 1690 if (pEmbAcc) { | 1688 if (pEmbAcc) { |
| 1691 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 1689 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
| 1692 return TRUE; | 1690 return true; |
| 1693 } | 1691 } |
| 1694 } | 1692 } |
| 1695 return FALSE; | 1693 return false; |
| 1696 } | 1694 } |
| OLD | NEW |