mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix NM field for pdf annot Writer
This commit is contained in:
@ -267,6 +267,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
|||||||
int nFlags = pReader->ReadInt();
|
int nFlags = pReader->ReadInt();
|
||||||
SetFlag(nFlags);
|
SetFlag(nFlags);
|
||||||
|
|
||||||
|
if (nFlags & (1 << 0))
|
||||||
|
SetNM(pReader->ReadString());
|
||||||
if (nFlags & (1 << 1))
|
if (nFlags & (1 << 1))
|
||||||
SetContents(pReader->ReadString());
|
SetContents(pReader->ReadString());
|
||||||
if (nFlags & (1 << 2))
|
if (nFlags & (1 << 2))
|
||||||
@ -291,6 +293,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
|||||||
}
|
}
|
||||||
SetBorder(nType, dWidth, d1, d2);
|
SetBorder(nType, dWidth, d1, d2);
|
||||||
}
|
}
|
||||||
|
// nFlags & (1 << 5) LastModified вычисляется в PdfWriter::CAnnotation
|
||||||
|
|
||||||
if (isMarkup())
|
if (isMarkup())
|
||||||
{
|
{
|
||||||
@ -306,6 +309,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
|||||||
pPr->SetCA(pReader->ReadDouble());
|
pPr->SetCA(pReader->ReadDouble());
|
||||||
if (nFlags & (1 << 3))
|
if (nFlags & (1 << 3))
|
||||||
pPr->SetRC(pReader->ReadString());
|
pPr->SetRC(pReader->ReadString());
|
||||||
|
// nFlags & (1 << 4) CreationDate вычисляется в PdfWriter::CMarkupAnnotation
|
||||||
if (nFlags & (1 << 5))
|
if (nFlags & (1 << 5))
|
||||||
pPr->SetIRTID(pReader->ReadInt());
|
pPr->SetIRTID(pReader->ReadInt());
|
||||||
if (nFlags & (1 << 6))
|
if (nFlags & (1 << 6))
|
||||||
|
|||||||
@ -274,6 +274,7 @@ public:
|
|||||||
void SetAnnotFlag(const int& nAnnotFlag) { m_nAnnotFlag = nAnnotFlag; }
|
void SetAnnotFlag(const int& nAnnotFlag) { m_nAnnotFlag = nAnnotFlag; }
|
||||||
void SetPage(const int& nPage) { m_nPage = nPage; }
|
void SetPage(const int& nPage) { m_nPage = nPage; }
|
||||||
void SetBE(const double& dBE) { m_dBE = dBE; }
|
void SetBE(const double& dBE) { m_dBE = dBE; }
|
||||||
|
void SetNM(const std::wstring& wsNM) { m_wsNM = wsNM; }
|
||||||
void SetContents(const std::wstring& wsContents) { m_wsContents = wsContents; }
|
void SetContents(const std::wstring& wsContents) { m_wsContents = wsContents; }
|
||||||
void SetC(const std::vector<double>& arrC) { m_arrC = arrC; }
|
void SetC(const std::vector<double>& arrC) { m_arrC = arrC; }
|
||||||
|
|
||||||
@ -284,6 +285,7 @@ public:
|
|||||||
int GetAnnotFlag() const { return m_nAnnotFlag; }
|
int GetAnnotFlag() const { return m_nAnnotFlag; }
|
||||||
int GetPage() const { return m_nPage; }
|
int GetPage() const { return m_nPage; }
|
||||||
double GetBE() const { return m_dBE; }
|
double GetBE() const { return m_dBE; }
|
||||||
|
const std::wstring& GetNM() const { return m_wsNM; }
|
||||||
const std::wstring& GetContents() const { return m_wsContents; }
|
const std::wstring& GetContents() const { return m_wsContents; }
|
||||||
const std::vector<double>& GetC() const { return m_arrC; }
|
const std::vector<double>& GetC() const { return m_arrC; }
|
||||||
|
|
||||||
@ -323,6 +325,7 @@ private:
|
|||||||
int m_nAnnotFlag;
|
int m_nAnnotFlag;
|
||||||
int m_nPage;
|
int m_nPage;
|
||||||
double m_dBE;
|
double m_dBE;
|
||||||
|
std::wstring m_wsNM;
|
||||||
std::wstring m_wsContents;
|
std::wstring m_wsContents;
|
||||||
std::vector<double> m_arrC;
|
std::vector<double> m_arrC;
|
||||||
CBorder m_oBorder;
|
CBorder m_oBorder;
|
||||||
|
|||||||
@ -1741,6 +1741,8 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
|||||||
pAnnot->SetRect(oRect);
|
pAnnot->SetRect(oRect);
|
||||||
|
|
||||||
int nFlags = oInfo.GetFlag();
|
int nFlags = oInfo.GetFlag();
|
||||||
|
if (nFlags & (1 << 0))
|
||||||
|
pAnnot->SetNM(oInfo.GetNM());
|
||||||
if (nFlags & (1 << 1))
|
if (nFlags & (1 << 1))
|
||||||
pAnnot->SetContents(oInfo.GetContents());
|
pAnnot->SetContents(oInfo.GetContents());
|
||||||
if (nFlags & (1 << 2))
|
if (nFlags & (1 << 2))
|
||||||
|
|||||||
@ -175,6 +175,11 @@ namespace PdfWriter
|
|||||||
std::string sValue = U_TO_UTF8(wsText);
|
std::string sValue = U_TO_UTF8(wsText);
|
||||||
Add("Contents", new CStringObject(sValue.c_str()));
|
Add("Contents", new CStringObject(sValue.c_str()));
|
||||||
}
|
}
|
||||||
|
void CAnnotation::SetNM(const std::wstring& wsNM)
|
||||||
|
{
|
||||||
|
std::string sValue = U_TO_UTF8(wsNM);
|
||||||
|
Add("NM", new CStringObject(sValue.c_str()));
|
||||||
|
}
|
||||||
void CAnnotation::SetC(const std::vector<double>& arrC)
|
void CAnnotation::SetC(const std::vector<double>& arrC)
|
||||||
{
|
{
|
||||||
CArrayObject* pArray = new CArrayObject();
|
CArrayObject* pArray = new CArrayObject();
|
||||||
|
|||||||
@ -120,7 +120,9 @@ namespace PdfWriter
|
|||||||
void SetPage(CPage* pPage);
|
void SetPage(CPage* pPage);
|
||||||
void SetBE(const double& dBE);
|
void SetBE(const double& dBE);
|
||||||
void SetContents(const std::wstring& wsText);
|
void SetContents(const std::wstring& wsText);
|
||||||
|
void SetNM(const std::wstring& wsNM);
|
||||||
void SetC(const std::vector<double>& arrC);
|
void SetC(const std::vector<double>& arrC);
|
||||||
|
// TODO AP Необходимо генерировать внешний вид аннотации как у Widget
|
||||||
};
|
};
|
||||||
class CMarkupAnnotation : public CAnnotation
|
class CMarkupAnnotation : public CAnnotation
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user