diff --git a/DesktopEditor/graphics/commands/AnnotField.cpp b/DesktopEditor/graphics/commands/AnnotField.cpp index 324ec84322..1821e6e371 100644 --- a/DesktopEditor/graphics/commands/AnnotField.cpp +++ b/DesktopEditor/graphics/commands/AnnotField.cpp @@ -1132,6 +1132,8 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil } } } + if (nFlags & (1 << 9)) + pParent->nMaxLen = pReader->ReadInt(); m_arrParents.push_back(pParent); } diff --git a/DesktopEditor/graphics/commands/AnnotField.h b/DesktopEditor/graphics/commands/AnnotField.h index 9276b06560..078d0e5d60 100644 --- a/DesktopEditor/graphics/commands/AnnotField.h +++ b/DesktopEditor/graphics/commands/AnnotField.h @@ -567,6 +567,7 @@ public: { int nID; int nFlags; + int nMaxLen; int nParentID; int nFieldFlag; std::wstring sName; diff --git a/DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js b/DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js index 2d9ac49213..095138c629 100644 --- a/DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js +++ b/DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js @@ -616,6 +616,8 @@ CFile.prototype["getInteractiveFormsInfo"] = function() readAction(reader, rec["AA"][AAType]); } } + if (flags & (1 << 9)) + rec["maxLen"] = reader.readInt(); res["Parents"].push(rec); } diff --git a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp index 6324203b62..f7e1044f19 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp +++ b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp @@ -351,7 +351,7 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i) { nPathLength = READ_INT(pWidgets + i); i += 4; - std::cout << "Parent " << nPathLength; + std::cout << "Parent " << nPathLength << ", "; } if (nFlags & (1 << 5)) { @@ -392,7 +392,7 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i) { nPathLength = READ_INT(pWidgets + i); i += 4; - std::cout << "Ff " << nPathLength; + std::cout << "Ff " << nPathLength << ", "; } if (nFlags & (1 << 8)) { @@ -410,6 +410,12 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i) } std::cout << std::endl; } + if (nFlags & (1 << 9)) + { + nPathLength = READ_INT(pWidgets + i); + i += 4; + std::cout << "MaxLen " << nPathLength << ", "; + } std::cout << std::endl; } diff --git a/PdfFile/PdfWriter.cpp b/PdfFile/PdfWriter.cpp index 2a7592fe5a..7ea98f6a71 100644 --- a/PdfFile/PdfWriter.cpp +++ b/PdfFile/PdfWriter.cpp @@ -2777,6 +2777,8 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi } } } + if (nFlags & (1 << 9)) + pParentObj->Add("MaxLen", pParent->nMaxLen); } std::vector arrBI = pFieldInfo->GetButtonImg(); diff --git a/PdfFile/SrcReader/PdfAnnot.cpp b/PdfFile/SrcReader/PdfAnnot.cpp index e5f3ffb6b6..e722698622 100644 --- a/PdfFile/SrcReader/PdfAnnot.cpp +++ b/PdfFile/SrcReader/PdfAnnot.cpp @@ -1214,12 +1214,12 @@ CAnnotWidgetTx::CAnnotWidgetTx(PDFDoc* pdfDoc, AcroFormField* pField) : CAnnotWi oField.free(); // 10 - Максимальное количество символов в Tx - MaxLen - int nMaxLen = pField->getMaxLen(); - if (nMaxLen > 0) + if (oField.dictLookup("MaxLen", &oObj)->isInt()) { m_unFlags |= (1 << 10); - m_unMaxLen = nMaxLen; + m_unMaxLen = oObj.getInt(); } + oObj.free(); // 11 - Расширенный текст RV - RichText if (pField->getFlags() & (1 << 25)) @@ -2678,6 +2678,14 @@ void CAnnots::getParents(PDFDoc* pdfDoc, Object* oFieldRef) } oAA.free(); + // 9 - MaxLen + if (oField.dictLookup("MaxLen", &oObj)->isInt()) + { + pAnnotParent->unMaxLen = oObj.getInt(); + pAnnotParent->unFlags |= (1 << 9); + } + oObj.free(); + m_arrParents.push_back(pAnnotParent); Object oParentRefObj; @@ -3644,6 +3652,8 @@ void CAnnots::CAnnotParent::ToWASM(NSWasm::CData& oRes) arrAction[i]->ToWASM(oRes); } } + if (unFlags & (1 << 9)) + oRes.AddInt(unMaxLen); } void CAnnot::ToWASM(NSWasm::CData& oRes) { diff --git a/PdfFile/SrcReader/PdfAnnot.h b/PdfFile/SrcReader/PdfAnnot.h index 5d176ef7a2..ed8782e739 100644 --- a/PdfFile/SrcReader/PdfAnnot.h +++ b/PdfFile/SrcReader/PdfAnnot.h @@ -610,6 +610,7 @@ private: unsigned int unFlags; unsigned int unRefNum; // Номер ссылки на объект + unsigned int unMaxLen; // Ограничение на максимальную длину text field unsigned int unFieldFlag; // Флаг Ff unsigned int unRefNumParent; // Номер ссылки на объект родителя std::vector arrI;