bool CXFA_FFComboBox::LoadWidget() { CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); pComboBox->Initialize(); m_pNormalWidget = (CFWL_Widget*)pComboBox; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideStringArray wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, false); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { pComboBox->AddString(wsLabelArray[i].AsStringC()); } CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); int32_t iSelCount = iSelArray.GetSize(); if (iSelCount > 0) { pComboBox->SetCurSel(iSelArray[0]); } else { CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); pComboBox->SetEditText(wsText); } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
FX_BOOL CXFA_FFListBox::LoadWidget() { CFWL_ListBox* pListBox = CFWL_ListBox::Create(); pListBox->Initialize(); pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, 0xFFFFFFFF); m_pNormalWidget = (CFWL_Widget*)pListBox; IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); m_pNormalWidget->SetPrivateData(pWidget, this, NULL); IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideStringArray wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { pListBox->AddString(wsLabelArray[i]); } FX_DWORD dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; } dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); int32_t iSelCount = iSelArray.GetSize(); for (int32_t j = 0; j < iSelCount; j++) { FWL_HLISTITEM item = pListBox->GetItem(iSelArray[j]); pListBox->SetSelItem(item, TRUE); } m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
void PDF_GetPageText(CFX_ByteStringArray& lines, CPDF_Document* pDoc, CPDF_Dictionary* pPage, int iMinWidth, FX_DWORD flags) { lines.RemoveAll(); CFX_WideStringArray wlines; PDF_GetPageText_Unicode(wlines, pDoc, pPage, iMinWidth, flags); for (int i = 0; i < wlines.GetSize(); i ++) { CFX_WideString wstr = wlines[i]; CFX_ByteString str; for (int c = 0; c < wstr.GetLength(); c ++) { str += CharFromUnicodeAlt(wstr[c], FXSYS_GetACP(), "?"); } lines.Add(str); } }
bool CXFA_FFListBox::LoadWidget() { CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp()); pListBox->Initialize(); pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, 0xFFFFFFFF); m_pNormalWidget = (CFWL_Widget*)pListBox; m_pNormalWidget->SetLayoutItem(this); IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->RegisterEventTarget(pWidget, pWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); CFX_WideStringArray wsLabelArray; m_pDataAcc->GetChoiceListItems(wsLabelArray, false); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { pListBox->AddString(wsLabelArray[i].AsStringC()); } uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { dwExtendedStyle |= FWL_STYLEEXT_LTB_MultiSelection; } dwExtendedStyle |= GetAlignment(); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); int32_t iSelCount = iSelArray.GetSize(); for (int32_t j = 0; j < iSelCount; j++) { CFWL_ListItem* item = pListBox->GetItem(iSelArray[j]); pListBox->SetSelItem(item, true); } m_pNormalWidget->UnlockUpdate(); return CXFA_FFField::LoadWidget(); }
FX_BOOL CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, const CFX_WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const { wsResult.clear(); FX_BOOL bRet = FALSE; CFX_FormatString* pFormat = nullptr; if (m_pLocaleMgr) pFormat = new CFX_FormatString(m_pLocaleMgr, FALSE); CFX_WideStringArray wsPatterns; pFormat->SplitFormatString(wsFormat, wsPatterns); int32_t iCount = wsPatterns.GetSize(); for (int32_t i = 0; i < iCount; i++) { bRet = FormatSinglePattern(wsResult, wsPatterns[i], pLocale, eValueType); if (bRet) { break; } } pFormat->Release(); return bRet; }
FX_BOOL CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, const CFX_WideString& wsPattern, IFX_Locale* pLocale, CFX_WideString* pMatchFormat) { CFX_WideString wsOutput; IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); if (pLocale) { m_pLocaleMgr->SetDefLocale(pLocale); } CFX_FormatString* pFormat = nullptr; if (m_pLocaleMgr) pFormat = new CFX_FormatString(m_pLocaleMgr, FALSE); CFX_WideStringArray wsPatterns; pFormat->SplitFormatString(wsPattern, wsPatterns); FX_BOOL bRet = FALSE; int32_t iCount = wsPatterns.GetSize(); int32_t i = 0; for (; i < iCount && !bRet; i++) { CFX_WideString wsFormat = wsPatterns[i]; FX_LOCALECATEGORY eCategory = pFormat->GetCategory(wsFormat); eCategory = XFA_ValugeCategory(eCategory, m_dwType); switch (eCategory) { case FX_LOCALECATEGORY_Null: bRet = pFormat->ParseNull(wsValue, wsFormat); if (!bRet) { bRet = wsValue.IsEmpty(); } break; case FX_LOCALECATEGORY_Zero: bRet = pFormat->ParseZero(wsValue, wsFormat); if (!bRet) { bRet = wsValue == FX_WSTRC(L"0"); } break; case FX_LOCALECATEGORY_Num: { CFX_WideString fNum; bRet = pFormat->ParseNum(wsValue, wsFormat, fNum); if (!bRet) { bRet = pFormat->FormatNum(wsValue, wsFormat, wsOutput); } break; } case FX_LOCALECATEGORY_Text: bRet = pFormat->ParseText(wsValue, wsFormat, wsOutput); wsOutput.clear(); if (!bRet) { bRet = pFormat->FormatText(wsValue, wsFormat, wsOutput); } break; case FX_LOCALECATEGORY_Date: { CFX_Unitime dt; bRet = ValidateCanonicalDate(wsValue, dt); if (!bRet) { bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Date, dt); if (!bRet) { bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, FX_DATETIMETYPE_Date); } } break; } case FX_LOCALECATEGORY_Time: { CFX_Unitime dt; bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_Time, dt); if (!bRet) { bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, FX_DATETIMETYPE_Time); } break; } case FX_LOCALECATEGORY_DateTime: { CFX_Unitime dt; bRet = pFormat->ParseDateTime(wsValue, wsFormat, FX_DATETIMETYPE_DateTime, dt); if (!bRet) { bRet = pFormat->FormatDateTime(wsValue, wsFormat, wsOutput, FX_DATETIMETYPE_DateTime); } break; } default: bRet = FALSE; break; } } if (bRet && pMatchFormat) { *pMatchFormat = wsPatterns[i - 1]; } pFormat->Release(); if (pLocale) { m_pLocaleMgr->SetDefLocale(locale); } return bRet; }