mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix saving annots
This commit is contained in:
@ -1830,6 +1830,12 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
||||
PdfWriter::CAnnotation* pIRTAnnot = m_pDocument->GetAnnot(nIRTID);
|
||||
if (pIRTAnnot)
|
||||
pMarkupAnnot->SetIRTID(pIRTAnnot);
|
||||
else
|
||||
{
|
||||
PdfWriter::CObjectBase* pBase = new PdfWriter::CObjectBase();
|
||||
pBase->SetRef(nIRTID, 0);
|
||||
pMarkupAnnot->Add("IRT", new PdfWriter::CProxyObject(pBase, true));
|
||||
}
|
||||
}
|
||||
if (nFlags & (1 << 6))
|
||||
pMarkupAnnot->SetRT(pPr->GetRT());
|
||||
@ -1999,22 +2005,22 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
||||
std::wstring wsFontName = pPr->GetFontName();
|
||||
if (wsFontName == L"Times-Roman" || wsFontName == L"Times-Bold" || wsFontName == L"Times-BoldItalic" || wsFontName == L"Times-Italic")
|
||||
wsFontName = L"Times New Roman";
|
||||
|
||||
put_FontName(wsFontName);
|
||||
int nStyle = pPr->GetFontStyle();
|
||||
double dFontSize = pPr->GetFontSizeAP();
|
||||
put_FontName(wsFontName);
|
||||
put_FontStyle(nStyle);
|
||||
put_FontSize(dFontSize);
|
||||
|
||||
if (m_bNeedUpdateTextFont)
|
||||
UpdateFont();
|
||||
|
||||
PdfWriter::CFontTrueType* pFontTT = NULL;
|
||||
if (m_pFont)
|
||||
pFontTT = m_pDocument->CreateTrueTypeFont(m_pFont);
|
||||
|
||||
pWidgetAnnot->SetDocument(m_pDocument);
|
||||
pWidgetAnnot->SetDA(pFontTT, pPr->GetFontSize(), dFontSize, pPr->GetTC());
|
||||
if (nWidgetType != 28 && nWidgetType != 29)
|
||||
{
|
||||
if (m_bNeedUpdateTextFont)
|
||||
UpdateFont();
|
||||
if (m_pFont)
|
||||
pFontTT = m_pDocument->CreateTrueTypeFont(m_pFont);
|
||||
pWidgetAnnot->SetDA(pFontTT, pPr->GetFontSize(), dFontSize, pPr->GetTC());
|
||||
}
|
||||
|
||||
BYTE nAlign = pPr->GetQ();
|
||||
if (nWidgetType != 27 && nWidgetType != 28 && nWidgetType != 29)
|
||||
@ -2204,19 +2210,19 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
||||
}
|
||||
else
|
||||
{
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr* pPr = oInfo.GetWidgetAnnotPr()->GetButtonWidgetPr();
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr* pPrB = oInfo.GetWidgetAnnotPr()->GetButtonWidgetPr();
|
||||
PdfWriter::CCheckBoxWidget* pButtonWidget = (PdfWriter::CCheckBoxWidget*)pAnnot;
|
||||
|
||||
std::wstring wsValue;
|
||||
if (nFlags & (1 << 14))
|
||||
pButtonWidget->SetAP_N_Yes(pPr->GetAP_N_Yes());
|
||||
pButtonWidget->SetAP_N_Yes(pPrB->GetAP_N_Yes());
|
||||
if (nFlags & (1 << 9))
|
||||
{
|
||||
wsValue = pPr->GetV();
|
||||
wsValue = pPrB->GetV();
|
||||
pButtonWidget->SetV(wsValue);
|
||||
}
|
||||
|
||||
std::wstring wsStyleValue = pButtonWidget->SetStyle(pPr->GetStyle());
|
||||
std::wstring wsStyleValue = pButtonWidget->SetStyle(pPrB->GetStyle());
|
||||
|
||||
// ВНЕШНИЙ ВИД
|
||||
// Если изменился текущий внешний вид
|
||||
@ -2227,6 +2233,13 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (m_bNeedUpdateTextFont)
|
||||
UpdateFont();
|
||||
|
||||
if (m_pFont)
|
||||
pFontTT = m_pDocument->CreateTrueTypeFont(m_pFont);
|
||||
pWidgetAnnot->SetDA(pFontTT, pPr->GetFontSize(), dFontSize, pPr->GetTC());
|
||||
|
||||
pButtonWidget->SetFont(m_pFont, dFontSize, isBold, isItalic);
|
||||
if (!wsStyleValue.empty())
|
||||
{
|
||||
@ -2434,6 +2447,8 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
|
||||
for (int i = 0; i < pParent->arrI.size(); ++i)
|
||||
pArray->Add(pParent->arrI[i]);
|
||||
}
|
||||
else
|
||||
pParentObj->Remove("I");
|
||||
if (nFlags & (1 << 4))
|
||||
{
|
||||
PdfWriter::CDictObject* pParentObj2 = m_pDocument->GetParent(pParent->nParentID);
|
||||
|
||||
Reference in New Issue
Block a user