mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix T name due to Adobe
This commit is contained in:
@ -2324,6 +2324,8 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
|||||||
pChoiceWidget->SetV(pPr->GetArrV());
|
pChoiceWidget->SetV(pPr->GetArrV());
|
||||||
if (nFlags & (1 << 13))
|
if (nFlags & (1 << 13))
|
||||||
pChoiceWidget->SetI(pPr->GetI());
|
pChoiceWidget->SetI(pPr->GetI());
|
||||||
|
else
|
||||||
|
pChoiceWidget->Remove("I");
|
||||||
|
|
||||||
// ВНЕШНИЙ ВИД
|
// ВНЕШНИЙ ВИД
|
||||||
pChoiceWidget->SetFont(m_pFont, dFontSize, isBold, isItalic);
|
pChoiceWidget->SetFont(m_pFont, dFontSize, isBold, isItalic);
|
||||||
@ -2407,8 +2409,9 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
|
|||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
std::vector<CWidgetsInfo::CParent*> arrParents = pFieldInfo->GetParents();
|
std::vector<CWidgetsInfo::CParent*> arrParents = pFieldInfo->GetParents();
|
||||||
for (CWidgetsInfo::CParent* pParent : arrParents)
|
for (int j = 0; j < arrParents.size(); ++j)
|
||||||
{
|
{
|
||||||
|
CWidgetsInfo::CParent* pParent = arrParents[j];
|
||||||
PdfWriter::CDictObject* pParentObj = m_pDocument->GetParent(pParent->nID);
|
PdfWriter::CDictObject* pParentObj = m_pDocument->GetParent(pParent->nID);
|
||||||
if (!pParentObj)
|
if (!pParentObj)
|
||||||
continue;
|
continue;
|
||||||
@ -2416,8 +2419,9 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
|
|||||||
std::vector<std::wstring> arrValue;
|
std::vector<std::wstring> arrValue;
|
||||||
|
|
||||||
int nFlags = pParent->nFlags;
|
int nFlags = pParent->nFlags;
|
||||||
if (nFlags & (1 << 0))
|
// Adobe не может смешивать юникод и utf имена полей
|
||||||
pParentObj->Add("T", new PdfWriter::CStringObject((U_TO_UTF8(pParent->sName)).c_str(), true));
|
// if (nFlags & (1 << 0))
|
||||||
|
// pParentObj->Add("T", new PdfWriter::CStringObject((U_TO_UTF8(pParent->sName)).c_str(), true));
|
||||||
if (nFlags & (1 << 1))
|
if (nFlags & (1 << 1))
|
||||||
{
|
{
|
||||||
std::string sV = U_TO_UTF8(pParent->sV);
|
std::string sV = U_TO_UTF8(pParent->sV);
|
||||||
@ -2563,8 +2567,28 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
|
|||||||
DrawButtonWidget(pAppFonts, pPBWidget, 0, arrForm[pPBWidget->m_nI]);
|
DrawButtonWidget(pAppFonts, pPBWidget, 0, arrForm[pPBWidget->m_nI]);
|
||||||
if (pPBWidget->m_nRI >= 0)
|
if (pPBWidget->m_nRI >= 0)
|
||||||
DrawButtonWidget(pAppFonts, pPBWidget, 1, arrForm[pPBWidget->m_nRI]);
|
DrawButtonWidget(pAppFonts, pPBWidget, 1, arrForm[pPBWidget->m_nRI]);
|
||||||
|
else if (pPBWidget->m_nI >= 0)
|
||||||
|
{
|
||||||
|
PdfWriter::CDictObject* pObj = dynamic_cast<PdfWriter::CDictObject*>(pPBWidget->Get("AP"));
|
||||||
|
if (pObj && pObj->Get("R"))
|
||||||
|
{
|
||||||
|
pObj = dynamic_cast<PdfWriter::CDictObject*>(pPBWidget->Get("MK"));
|
||||||
|
if (pObj && !pObj->Get("RI"))
|
||||||
|
DrawButtonWidget(pAppFonts, pPBWidget, 1, arrForm[pPBWidget->m_nI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pPBWidget->m_nIX >= 0)
|
if (pPBWidget->m_nIX >= 0)
|
||||||
DrawButtonWidget(pAppFonts, pPBWidget, 2, arrForm[pPBWidget->m_nIX]);
|
DrawButtonWidget(pAppFonts, pPBWidget, 2, arrForm[pPBWidget->m_nIX]);
|
||||||
|
else if (pPBWidget->m_nI >= 0)
|
||||||
|
{
|
||||||
|
PdfWriter::CDictObject* pObj = dynamic_cast<PdfWriter::CDictObject*>(pPBWidget->Get("AP"));
|
||||||
|
if (pObj && pObj->Get("D"))
|
||||||
|
{
|
||||||
|
pObj = dynamic_cast<PdfWriter::CDictObject*>(pPBWidget->Get("MK"));
|
||||||
|
if (pObj && !pObj->Get("IX"))
|
||||||
|
DrawButtonWidget(pAppFonts, pPBWidget, 2, arrForm[pPBWidget->m_nI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|||||||
@ -334,7 +334,8 @@ namespace PdfWriter
|
|||||||
void CMarkupAnnotation::SetT(const std::wstring& wsT)
|
void CMarkupAnnotation::SetT(const std::wstring& wsT)
|
||||||
{
|
{
|
||||||
std::string sValue = U_TO_UTF8(wsT);
|
std::string sValue = U_TO_UTF8(wsT);
|
||||||
Add("T", new CStringObject(sValue.c_str(), true));
|
if (!Get("T"))
|
||||||
|
Add("T", new CStringObject(sValue.c_str(), true));
|
||||||
}
|
}
|
||||||
void CMarkupAnnotation::SetRC(const std::wstring& wsRC)
|
void CMarkupAnnotation::SetRC(const std::wstring& wsRC)
|
||||||
{
|
{
|
||||||
@ -1279,8 +1280,10 @@ namespace PdfWriter
|
|||||||
std::string sValue = U_TO_UTF8(wsT);
|
std::string sValue = U_TO_UTF8(wsT);
|
||||||
CDictObject* pOwner = GetObjOwnValue("T");
|
CDictObject* pOwner = GetObjOwnValue("T");
|
||||||
if (!pOwner)
|
if (!pOwner)
|
||||||
|
{
|
||||||
pOwner = this;
|
pOwner = this;
|
||||||
pOwner->Add("T", new CStringObject(sValue.c_str(), true));
|
pOwner->Add("T", new CStringObject(sValue.c_str(), true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void CWidgetAnnotation::SetBC(const std::vector<double>& arrBC)
|
void CWidgetAnnotation::SetBC(const std::vector<double>& arrBC)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user