mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix Opt radiobutton at child
This commit is contained in:
@ -1206,6 +1206,20 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["value"] = readStringFunc.call(reader);
|
||||
// 0 - check, 1 - cross, 2 - diamond, 3 - circle, 4 - star, 5 - square
|
||||
rec["style"] = reader.readByte();
|
||||
if (flags & (1 << 10))
|
||||
{
|
||||
let n = reader.readInt();
|
||||
rec["opt"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
{
|
||||
let opt1 = readStringFunc.call(reader);
|
||||
let opt2 = readStringFunc.call(reader);
|
||||
if (opt1 == "")
|
||||
rec["opt"].push(opt2);
|
||||
else
|
||||
rec["opt"].push([opt2, opt1]);
|
||||
}
|
||||
}
|
||||
if (flags & (1 << 14))
|
||||
rec["ExportValue"] = readStringFunc.call(reader);
|
||||
// 12.7.4.2.1
|
||||
|
||||
@ -704,6 +704,23 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
i += 1;
|
||||
std::cout << "Style " << arrStyle[nPathLength] << ", ";
|
||||
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
int nOptLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
for (int j = 0; j < nOptLength; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << std::to_string(j) << " Opt1 " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << std::to_string(j) << " Opt2 " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
}
|
||||
if (nFlags & (1 << 14))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
|
||||
@ -1164,8 +1164,54 @@ CAnnotWidgetBtn::CAnnotWidgetBtn(PDFDoc* pdfDoc, AcroFormField* pField, int nSta
|
||||
}
|
||||
oObj.free();
|
||||
|
||||
Object oMK;
|
||||
AcroFormFieldType oType = pField->getAcroFormFieldType();
|
||||
Object oOpt;
|
||||
// 10 - Список значений
|
||||
if (oType != acroFormFieldPushbutton && oField.dictLookup("Opt", &oOpt)->isArray())
|
||||
{
|
||||
m_unFlags |= (1 << 10);
|
||||
int nOptLength = oOpt.arrayGetLength();
|
||||
for (int j = 0; j < nOptLength; ++j)
|
||||
{
|
||||
Object oOptJ;
|
||||
if (!oOpt.arrayGet(j, &oOptJ) || !(oOptJ.isString() || oOptJ.isArray()))
|
||||
{
|
||||
oOptJ.free();
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string sOpt1, sOpt2;
|
||||
if (oOptJ.isArray() && oOptJ.arrayGetLength() > 1)
|
||||
{
|
||||
Object oOptJ2;
|
||||
if (oOptJ.arrayGet(0, &oOptJ2)->isString())
|
||||
{
|
||||
TextString* s = new TextString(oOptJ2.getString());
|
||||
sOpt1 = NSStringExt::CConverter::GetUtf8FromUTF32(s->getUnicode(), s->getLength());
|
||||
delete s;
|
||||
}
|
||||
oOptJ2.free();
|
||||
if (oOptJ.arrayGet(1, &oOptJ2)->isString())
|
||||
{
|
||||
TextString* s = new TextString(oOptJ2.getString());
|
||||
sOpt2 = NSStringExt::CConverter::GetUtf8FromUTF32(s->getUnicode(), s->getLength());
|
||||
delete s;
|
||||
}
|
||||
oOptJ2.free();
|
||||
}
|
||||
else if (oOptJ.isString())
|
||||
{
|
||||
TextString* s = new TextString(oOptJ.getString());
|
||||
sOpt2 = NSStringExt::CConverter::GetUtf8FromUTF32(s->getUnicode(), s->getLength());
|
||||
delete s;
|
||||
}
|
||||
m_arrOpt.push_back(std::make_pair(sOpt1, sOpt2));
|
||||
oOptJ.free();
|
||||
}
|
||||
}
|
||||
oOpt.free();
|
||||
|
||||
Object oMK;
|
||||
m_nStyle = (oType == acroFormFieldRadioButton ? 3 : 0);
|
||||
if (pField->fieldLookup("MK", &oMK)->isDict())
|
||||
{
|
||||
@ -1255,7 +1301,6 @@ CAnnotWidgetBtn::CAnnotWidgetBtn(PDFDoc* pdfDoc, AcroFormField* pField, int nSta
|
||||
}
|
||||
oMK.free();
|
||||
|
||||
Object oOpt;
|
||||
pField->fieldLookup("Opt", &oOpt);
|
||||
|
||||
// 14 - Имя вкл состояния - AP - N - Yes
|
||||
@ -4386,6 +4431,15 @@ void CAnnotWidgetBtn::ToWASM(NSWasm::CData& oRes)
|
||||
else
|
||||
{
|
||||
oRes.WriteBYTE(m_nStyle);
|
||||
if (m_unFlags & (1 << 10))
|
||||
{
|
||||
oRes.AddInt(m_arrOpt.size());
|
||||
for (int i = 0; i < m_arrOpt.size(); ++i)
|
||||
{
|
||||
oRes.WriteString(m_arrOpt[i].first);
|
||||
oRes.WriteString(m_arrOpt[i].second);
|
||||
}
|
||||
}
|
||||
if (m_unFlags & (1 << 14))
|
||||
oRes.WriteString(m_sAP_N_Yes);
|
||||
}
|
||||
|
||||
@ -280,6 +280,7 @@ private:
|
||||
std::string m_sAC;
|
||||
std::string m_sAP_N_Yes;
|
||||
double m_dA1, m_dA2;
|
||||
std::vector< std::pair<std::string, std::string> > m_arrOpt;
|
||||
};
|
||||
|
||||
class CAnnotWidgetTx final : public CAnnotWidget
|
||||
|
||||
Reference in New Issue
Block a user