Fix Opt for radiobutton, fix unicode for JS

This commit is contained in:
Svetlana Kulikova
2024-01-26 18:19:32 +03:00
parent 18d274cff2
commit 84b19f48c7
8 changed files with 127 additions and 20 deletions

View File

@ -2253,16 +2253,17 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
pTextWidget->SetMaxLen(pPr->GetMaxLen());
if (nWidgetFlag & (1 << 25))
pTextWidget->SetRV(pPr->GetRV());
bool bAPValue = false;
if (nFlags & (1 << 12))
{
bValue = true;
bAPValue = true;
wsValue = pPr->GetAPV();
pTextWidget->SetAPV();
}
// ВНЕШНИЙ ВИД
pTextWidget->SetFont(m_pFont, dFontSize, isBold, isItalic);
if (bValue)
if ((bValue && pTextWidget->Get("T")) || bAPValue)
DrawTextWidget(pAppFonts, pTextWidget, wsValue);
}
else if (oInfo.IsChoiceWidget())
@ -2383,7 +2384,7 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
if (nFlags & (1 << 1))
{
std::string sV = U_TO_UTF8(pParent->sV);
pParentObj->Add("V", new PdfWriter::CStringObject(sV.c_str(), true));
bool bName = !sV.empty() && (iswdigit(pParent->sV[0]) || sV == "Off");
PdfWriter::CObjectBase* pKids = pParentObj->Get("Kids");
if (pKids && pKids->GetType() == PdfWriter::object_type_ARRAY)
@ -2407,15 +2408,22 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
{
PdfWriter::CChoiceWidget* pKid = dynamic_cast<PdfWriter::CChoiceWidget*>(pObj);
DrawChoiceWidget(pAppFonts, pKid, {pParent->sV});
bName = false;
}
if (nType == PdfWriter::WidgetText)
{
PdfWriter::CTextWidget* pKid = dynamic_cast<PdfWriter::CTextWidget*>(pObj);
if (!pKid->HaveAPV())
DrawTextWidget(pAppFonts, pKid, pParent->sV);
bName = false;
}
}
}
if (bName)
pParentObj->Add("V", sV.c_str());
else
pParentObj->Add("V", new PdfWriter::CStringObject(sV.c_str(), true));
}
if (nFlags & (1 << 2))
pParentObj->Add("DV", new PdfWriter::CStringObject((U_TO_UTF8(pParent->sDV)).c_str(), true));