mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 08:39:50 +08:00
Link RD read and write
This commit is contained in:
@ -864,6 +864,7 @@ CAnnotFieldInfo::CLinkAnnotPr::~CLinkAnnotPr()
|
||||
}
|
||||
BYTE CAnnotFieldInfo::CLinkAnnotPr::GetH() const { return m_nH; }
|
||||
int CAnnotFieldInfo::CLinkAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
void CAnnotFieldInfo::CLinkAnnotPr::GetRD(double& dRD1, double& dRD2, double& dRD3, double& dRD4) { dRD1 = m_dRD[0]; dRD2 = m_dRD[1]; dRD3 = m_dRD[2]; dRD4 = m_dRD[3]; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CLinkAnnotPr::GetQuadPoints() { return m_arrQuadPoints; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetA() { return m_pAction; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetPA() { return m_pPA; }
|
||||
@ -889,6 +890,13 @@ void CAnnotFieldInfo::CLinkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 4))
|
||||
{
|
||||
m_dRD[0] = pReader->ReadDouble();
|
||||
m_dRD[1] = pReader->ReadDouble();
|
||||
m_dRD[2] = pReader->ReadDouble();
|
||||
m_dRD[3] = pReader->ReadDouble();
|
||||
}
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr::CFileAttachmentAnnotPr()
|
||||
|
||||
@ -489,6 +489,7 @@ public:
|
||||
|
||||
BYTE GetH() const;
|
||||
int GetFlags() const;
|
||||
void GetRD(double& dRD1, double& dRD2, double& dRD3, double& dRD4);
|
||||
const std::vector<double>& GetQuadPoints();
|
||||
CActionFieldPr* GetA();
|
||||
CActionFieldPr* GetPA();
|
||||
@ -498,6 +499,7 @@ public:
|
||||
private:
|
||||
BYTE m_nH;
|
||||
int m_nFlags;
|
||||
double m_dRD[4]{};
|
||||
std::vector<double> m_arrQuadPoints;
|
||||
CActionFieldPr* m_pAction;
|
||||
CActionFieldPr* m_pPA;
|
||||
|
||||
@ -1085,8 +1085,15 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
for (let i = 0; i < n; ++i)
|
||||
rec["QuadPoints"].push(readDoubleFunc.call(reader));
|
||||
}
|
||||
// Rect and RD differenses
|
||||
if (flags & (1 << 4))
|
||||
{
|
||||
rec["RD"] = [];
|
||||
for (let i = 0; i < 4; ++i)
|
||||
rec["RD"].push(readDoubleFunc.call(reader));
|
||||
}
|
||||
}
|
||||
// Link
|
||||
// Screen
|
||||
else if (rec["type"] == 20)
|
||||
{
|
||||
flags = reader.readInt();
|
||||
|
||||
@ -2228,6 +2228,17 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
std::cout << ", ";
|
||||
}
|
||||
if (nFlags & (1 << 4))
|
||||
{
|
||||
std::cout << "RD";
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << " " << (double)nPathLength / 100.0;
|
||||
}
|
||||
std::cout << ", ";
|
||||
}
|
||||
}
|
||||
else if (sType == "Screen")
|
||||
{
|
||||
|
||||
@ -2734,6 +2734,12 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
|
||||
pLinkAnnot->SetH(pPr->GetH());
|
||||
if (nFlags & (1 << 3))
|
||||
pLinkAnnot->SetQuadPoints(pPr->GetQuadPoints());
|
||||
if (nFlags & (1 << 4))
|
||||
{
|
||||
double dRD1, dRD2, dRD3, dRD4;
|
||||
pPr->GetRD(dRD1, dRD2, dRD3, dRD4);
|
||||
pLinkAnnot->SetRD(dRD1, dRD2, dRD3, dRD4);
|
||||
}
|
||||
|
||||
if (bRender)
|
||||
{
|
||||
|
||||
@ -1247,6 +1247,17 @@ CAnnotLink::CAnnotLink(PDFDoc* pdfDoc, Object* oAnnotRef, int nPageIndex, int nS
|
||||
}
|
||||
oObj.free();
|
||||
|
||||
// 4 - Различия Rect и фактического размера - RD
|
||||
if (oAnnot.dictLookup("RD", &oObj)->isArray() && oObj.arrayGetLength() == 4)
|
||||
{
|
||||
m_unFlags |= (1 << 4);
|
||||
m_pRD[0] = ArrGetNum(&oObj, 0);
|
||||
m_pRD[3] = ArrGetNum(&oObj, 1);
|
||||
m_pRD[2] = ArrGetNum(&oObj, 2);
|
||||
m_pRD[1] = ArrGetNum(&oObj, 3);
|
||||
}
|
||||
oObj.free();
|
||||
|
||||
oAnnot.free();
|
||||
}
|
||||
CAnnotLink::~CAnnotLink()
|
||||
@ -4060,6 +4071,11 @@ void CAnnotLink::ToWASM(NSWasm::CData& oRes)
|
||||
for (int i = 0; i < m_arrQuadPoints.size(); ++i)
|
||||
oRes.AddDouble(m_arrQuadPoints[i]);
|
||||
}
|
||||
if (m_unFlags & (1 << 4))
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
oRes.AddDouble(m_pRD[i]);
|
||||
}
|
||||
}
|
||||
void CAnnotScreen::ToWASM(NSWasm::CData& oRes)
|
||||
{
|
||||
|
||||
@ -351,6 +351,7 @@ public:
|
||||
|
||||
private:
|
||||
BYTE m_nH; // Режим выделения - H
|
||||
double m_pRD[4]{}; // Различия Rect и фактического размера
|
||||
std::vector<double> m_arrQuadPoints; // Координаты - QuadPoints
|
||||
CAction* m_pAction; // Действие - A&Dest
|
||||
CAction* m_pPA; // URI действие - PA
|
||||
|
||||
@ -836,6 +836,10 @@ namespace PdfWriter
|
||||
}
|
||||
Add("H", sValue.c_str());
|
||||
}
|
||||
void CLinkAnnotation::SetRD(const double& dRD1, const double& dRD2, const double& dRD3, const double& dRD4)
|
||||
{
|
||||
AddRD(this, dRD1, dRD2, dRD3, dRD4);
|
||||
}
|
||||
void CLinkAnnotation::SetQuadPoints(const std::vector<double>& arrQuadPoints)
|
||||
{
|
||||
CArrayObject* pArray = new CArrayObject();
|
||||
|
||||
@ -235,6 +235,7 @@ namespace PdfWriter
|
||||
}
|
||||
|
||||
void SetH(BYTE nH);
|
||||
void SetRD(const double& dRD1, const double& dRD2, const double& dRD3, const double& dRD4);
|
||||
void SetQuadPoints(const std::vector<double>& arrQuadPoints);
|
||||
void SetA(CAction* pAction);
|
||||
void SetPA(CAction* pAction);
|
||||
|
||||
Reference in New Issue
Block a user