mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix write Opt radiobutton at child
This commit is contained in:
@ -1042,6 +1042,7 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetCA() {
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetRC() { return m_wsRC; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetAC() { return m_wsAC; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetAP_N_Yes() { return m_wsAP_N_Yes; }
|
||||
const std::vector< std::pair<std::wstring, std::wstring> >& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetOpt() { return m_arrOpt; }
|
||||
void CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags)
|
||||
{
|
||||
if (nType == 27)
|
||||
@ -1082,6 +1083,17 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::Read(NSOnlineOfficeBinToP
|
||||
if (nFlags & (1 << 9))
|
||||
m_wsV = pReader->ReadString();
|
||||
m_nStyle = pReader->ReadByte();
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrOpt.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::wstring s1 = pReader->ReadString();
|
||||
std::wstring s2 = pReader->ReadString();
|
||||
m_arrOpt.push_back(std::make_pair(s1, s2));
|
||||
}
|
||||
}
|
||||
if (nFlags & (1 << 14))
|
||||
m_wsAP_N_Yes = pReader->ReadString();
|
||||
}
|
||||
|
||||
@ -107,6 +107,7 @@ public:
|
||||
const std::wstring& GetRC();
|
||||
const std::wstring& GetAC();
|
||||
const std::wstring& GetAP_N_Yes();
|
||||
const std::vector< std::pair<std::wstring, std::wstring> >& GetOpt();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags);
|
||||
|
||||
@ -125,6 +126,7 @@ public:
|
||||
std::wstring m_wsRC;
|
||||
std::wstring m_wsAC;
|
||||
std::wstring m_wsAP_N_Yes;
|
||||
std::vector< std::pair<std::wstring, std::wstring> > m_arrOpt;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CTextWidgetPr
|
||||
|
||||
@ -2503,6 +2503,8 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
||||
else
|
||||
pButtonWidget->Off();
|
||||
}
|
||||
if (nFlags & (1 << 10))
|
||||
pButtonWidget->SetOpt(pPrB->GetOpt());
|
||||
}
|
||||
}
|
||||
else if (oInfo.IsTextWidget())
|
||||
|
||||
@ -2272,6 +2272,40 @@ namespace PdfWriter
|
||||
sDA += "\012";
|
||||
return sDA;
|
||||
}
|
||||
void CCheckBoxWidget::SetOpt(const std::vector< std::pair<std::wstring, std::wstring> >& arrOpt)
|
||||
{
|
||||
if (arrOpt.empty())
|
||||
return;
|
||||
|
||||
CArrayObject* pArray = new CArrayObject();
|
||||
if (!pArray)
|
||||
return;
|
||||
|
||||
CDictObject* pOwner = GetObjOwnValue("Opt");
|
||||
if (!pOwner)
|
||||
pOwner = this;
|
||||
pOwner->Add("Opt", pArray);
|
||||
|
||||
for (const std::pair<std::wstring, std::wstring>& PV : arrOpt)
|
||||
{
|
||||
if (PV.first.empty())
|
||||
{
|
||||
std::string sValue = U_TO_UTF8(PV.second);
|
||||
pArray->Add(new CStringObject(sValue.c_str(), true));
|
||||
}
|
||||
else
|
||||
{
|
||||
CArrayObject* pArray2 = new CArrayObject();
|
||||
pArray->Add(pArray2);
|
||||
|
||||
std::string sValue = U_TO_UTF8(PV.first);
|
||||
pArray2->Add(new CStringObject(sValue.c_str(), true));
|
||||
|
||||
sValue = U_TO_UTF8(PV.second);
|
||||
pArray2->Add(new CStringObject(sValue.c_str(), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
// CTextWidget
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
@ -555,6 +555,7 @@ namespace PdfWriter
|
||||
CCheckBoxWidget(CXref* pXref, EWidgetType nSubtype = WidgetCheckbox);
|
||||
|
||||
void SetV(const std::wstring& wsV);
|
||||
void SetOpt(const std::vector< std::pair<std::wstring, std::wstring> >& arrOpt);
|
||||
void SetStyle(BYTE nStyle);
|
||||
ECheckBoxStyle GetStyle() { return m_nStyle; }
|
||||
void SetAP_N_Yes(const std::wstring& wsAP_N_Yes);
|
||||
|
||||
Reference in New Issue
Block a user