mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Merge remote-tracking branch 'origin/release/v9.0.0' into feature/pdf-page
# Conflicts: # DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js # PdfFile/OnlineOfficeBinToPdf.cpp # PdfFile/PdfEditor.cpp # PdfFile/PdfFile.cpp # PdfFile/PdfFile.h # PdfFile/SrcReader/PdfAnnot.cpp # PdfFile/SrcReader/PdfAnnot.h # PdfFile/SrcWriter/Document.cpp # PdfFile/SrcWriter/Document.h # PdfFile/test/test.cpp
This commit is contained in:
@ -48,7 +48,7 @@
|
||||
|
||||
CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annotaion)
|
||||
{
|
||||
m_nType = -1;
|
||||
m_nType = EAnnotType::Unknown;
|
||||
|
||||
m_nFlag = 0;
|
||||
m_nID = 0;
|
||||
@ -94,118 +94,108 @@ CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
}
|
||||
|
||||
void CAnnotFieldInfo::CreateMarkup()
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
}
|
||||
void CAnnotFieldInfo::SetType(int nType)
|
||||
{
|
||||
m_nType = nType;
|
||||
switch (nType)
|
||||
m_nType = static_cast<EAnnotType>(nType);
|
||||
switch (m_nType)
|
||||
{
|
||||
case 0:
|
||||
case EAnnotType::Text:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pTextPr);
|
||||
m_pTextPr = new CAnnotFieldInfo::CTextAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case EAnnotType::FreeText:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pFreeTextPr);
|
||||
m_pFreeTextPr = new CAnnotFieldInfo::CFreeTextAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case EAnnotType::Line:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pLinePr);
|
||||
m_pLinePr = new CAnnotFieldInfo::CLineAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
case EAnnotType::Square:
|
||||
case EAnnotType::Circle:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pSquareCirclePr);
|
||||
m_pSquareCirclePr = new CAnnotFieldInfo::CSquareCircleAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
case 7:
|
||||
case EAnnotType::PolygonLine:
|
||||
case EAnnotType::PolyLine:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pPolygonLinePr);
|
||||
m_pPolygonLinePr = new CAnnotFieldInfo::CPolygonLineAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case EAnnotType::Highlight:
|
||||
case EAnnotType::Underline:
|
||||
case EAnnotType::Squiggly:
|
||||
case EAnnotType::Strikeout:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pTextMarkupPr);
|
||||
m_pTextMarkupPr = new CAnnotFieldInfo::CTextMarkupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
case EAnnotType::Stamp:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pStampPr);
|
||||
m_pStampPr = new CAnnotFieldInfo::CStampAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
case EAnnotType::Caret:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pCaretPr);
|
||||
m_pCaretPr = new CAnnotFieldInfo::CCaretAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
case EAnnotType::Ink:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pInkPr);
|
||||
m_pInkPr = new CAnnotFieldInfo::CInkAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
case EAnnotType::Popup:
|
||||
{
|
||||
RELEASEOBJECT(m_pPopupPr);
|
||||
m_pPopupPr = new CAnnotFieldInfo::CPopupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 29:
|
||||
case 30:
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:
|
||||
case EAnnotType::Widget:
|
||||
case EAnnotType::WidgetPushButton:
|
||||
case EAnnotType::WidgetRadioButton:
|
||||
case EAnnotType::WidgetCheckBox:
|
||||
case EAnnotType::WidgetText:
|
||||
case EAnnotType::WidgetCombobox:
|
||||
case EAnnotType::WidgetListbox:
|
||||
case EAnnotType::WidgetSignature:
|
||||
{
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
m_pWidgetPr = new CAnnotFieldInfo::CWidgetAnnotPr(nType);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
CAnnotFieldInfo::EAnnotType CAnnotFieldInfo::GetType() { return m_nType; }
|
||||
|
||||
void CAnnotFieldInfo::GetBounds(double& dX1, double& dY1, double& dX2, double& dY2)
|
||||
{
|
||||
@ -344,6 +334,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -354,6 +345,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
if (m_oBorder.nType == 2)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_oBorder.arrDash.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_oBorder.arrDash.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -431,6 +423,7 @@ void CAnnotFieldInfo::CMarkupAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
int nFont = pReader->ReadInt();
|
||||
m_arrRC.reserve(nFont);
|
||||
for (int i = 0; i < nFont; ++i)
|
||||
{
|
||||
CFontData* pFont = new CFontData();
|
||||
@ -483,6 +476,7 @@ void CAnnotFieldInfo::CInkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* p
|
||||
{
|
||||
std::vector<double> arrLine;
|
||||
int m = pReader->ReadInt();
|
||||
arrLine.reserve(m);
|
||||
for (int j = 0; j < m; ++j)
|
||||
arrLine.push_back(pReader->ReadDouble());
|
||||
if (!arrLine.empty())
|
||||
@ -515,6 +509,7 @@ void CAnnotFieldInfo::CLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrIC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrIC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -542,6 +537,7 @@ void CAnnotFieldInfo::CTextMarkupAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRe
|
||||
{
|
||||
m_nSubtype = nType;
|
||||
int n = pReader->ReadInt();
|
||||
m_arrQuadPoints.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -562,6 +558,7 @@ void CAnnotFieldInfo::CSquareCircleAnnotPr::Read(NSOnlineOfficeBinToPdf::CBuffer
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrIC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrIC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -575,6 +572,7 @@ const std::vector<double>& CAnnotFieldInfo::CPolygonLineAnnotPr::GetVertices() {
|
||||
void CAnnotFieldInfo::CPolygonLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrVertices.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrVertices.push_back(pReader->ReadDouble());
|
||||
|
||||
@ -587,6 +585,7 @@ void CAnnotFieldInfo::CPolygonLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferR
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrIC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrIC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -616,6 +615,7 @@ void CAnnotFieldInfo::CFreeTextAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRead
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrCL.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrCL.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -628,6 +628,7 @@ void CAnnotFieldInfo::CFreeTextAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRead
|
||||
if (nFlags & (1 << 21))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrIC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrIC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -688,6 +689,7 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetDV() { return m_wsDV; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetT() { return m_wsT; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontName() { return m_wsFN; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontKey() { return m_wsFK; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetOMetadata() { return m_wsOMetadata; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetTC() { return m_arrTC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBC() { return m_arrBC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBG() { return m_arrBG; }
|
||||
@ -817,6 +819,7 @@ CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPd
|
||||
{
|
||||
pRes->nKind = pReader->ReadByte();
|
||||
int n = pReader->ReadInt();
|
||||
pRes->arrStr.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pRes->arrStr.push_back(pReader->ReadString());
|
||||
break;
|
||||
@ -825,6 +828,7 @@ CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPd
|
||||
{
|
||||
pRes->nInt1 = pReader->ReadInt();
|
||||
int n = pReader->ReadInt();
|
||||
pRes->arrStr.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pRes->arrStr.push_back(pReader->ReadString());
|
||||
break;
|
||||
@ -844,6 +848,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
m_nFontStyle = pReader->ReadInt();
|
||||
|
||||
int n = pReader->ReadInt();
|
||||
m_arrTC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrTC.push_back(pReader->ReadDouble());
|
||||
|
||||
@ -866,6 +871,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
if (nFlags & (1 << 5))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -874,6 +880,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
if (nFlags & (1 << 7))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBG.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBG.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -883,6 +890,8 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
m_nParentID = pReader->ReadInt();
|
||||
if (nFlags & (1 << 18))
|
||||
m_wsT = pReader->ReadString();
|
||||
if (nFlags & (1 << 20))
|
||||
m_wsOMetadata = pReader->ReadString();
|
||||
|
||||
// Action
|
||||
int nAction = pReader->ReadInt();
|
||||
@ -979,7 +988,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CTextWidgetPr::Read(NSOnlineOfficeBinToPdf
|
||||
m_wsV = pReader->ReadString();
|
||||
if (nFlags & (1 << 10))
|
||||
m_nMaxLen = pReader->ReadInt();
|
||||
if (nWidgetFlag & (1 << 25))
|
||||
if (nFlags & (1 << 11))
|
||||
m_wsRV = pReader->ReadString();
|
||||
if (nFlags & (1 << 12))
|
||||
m_wsAPV = pReader->ReadString();
|
||||
@ -1009,6 +1018,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr::Read(NSOnlineOfficeBinToP
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrOpt.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::wstring s1 = pReader->ReadString();
|
||||
@ -1023,12 +1033,14 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr::Read(NSOnlineOfficeBinToP
|
||||
if (nFlags & (1 << 13))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrV.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrV.push_back(pReader->ReadString());
|
||||
}
|
||||
if (nFlags & (1 << 14))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrI.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrI.push_back(pReader->ReadInt());
|
||||
}
|
||||
@ -1061,10 +1073,12 @@ const std::vector<CWidgetsInfo::CParent*>& CWidgetsInfo::GetParents() { return m
|
||||
bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrCO.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrCO.push_back(pReader->ReadInt());
|
||||
|
||||
n = pReader->ReadInt();
|
||||
m_arrParents.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
CParent* pParent = new CParent();
|
||||
@ -1080,6 +1094,7 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
pParent->arrI.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pParent->arrI.push_back(pReader->ReadInt());
|
||||
}
|
||||
@ -1088,13 +1103,43 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
if (nFlags & (1 << 5))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
pParent->arrV.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pParent->arrV.push_back(pReader->ReadString());
|
||||
}
|
||||
if (nFlags & (1 << 6))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
pParent->arrOpt.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::wstring s1 = pReader->ReadString();
|
||||
std::wstring s2 = pReader->ReadString();
|
||||
pParent->arrOpt.push_back(std::make_pair(s1, s2));
|
||||
}
|
||||
}
|
||||
if (nFlags & (1 << 7))
|
||||
pParent->nFieldFlag = pReader->ReadInt();
|
||||
if (nFlags & (1 << 8))
|
||||
{
|
||||
// Action
|
||||
int nAction = pReader->ReadInt();
|
||||
for (int i = 0; i < nAction; ++i)
|
||||
{
|
||||
std::wstring wsType = pReader->ReadString();
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* pA = ReadAction(pReader);
|
||||
if (pA)
|
||||
{
|
||||
pA->wsType = wsType;
|
||||
pParent->arrAction.push_back(pA);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_arrParents.push_back(pParent);
|
||||
}
|
||||
|
||||
n = pReader->ReadInt();
|
||||
m_arrButtonImg.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::string sImagePath = pReader->ReadStringA();
|
||||
|
||||
@ -39,6 +39,36 @@ class IMetafileToRenderter;
|
||||
class GRAPHICS_DECL CAnnotFieldInfo : public IAdvancedCommand
|
||||
{
|
||||
public:
|
||||
enum EAnnotType
|
||||
{
|
||||
Unknown = -1,
|
||||
Text = 0,
|
||||
Link = 1,
|
||||
FreeText = 2,
|
||||
Line = 3,
|
||||
Square = 4,
|
||||
Circle = 5,
|
||||
PolygonLine = 6,
|
||||
PolyLine = 7,
|
||||
Highlight = 8,
|
||||
Underline = 9,
|
||||
Squiggly = 10,
|
||||
Strikeout = 11,
|
||||
Stamp = 12,
|
||||
Caret = 13,
|
||||
Ink = 14,
|
||||
Popup = 15,
|
||||
FileAttachment = 16,
|
||||
Widget = 26,
|
||||
WidgetPushButton = 27,
|
||||
WidgetRadioButton = 28,
|
||||
WidgetCheckBox = 29,
|
||||
WidgetText = 30,
|
||||
WidgetCombobox = 31,
|
||||
WidgetListbox = 32,
|
||||
WidgetSignature = 33
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CWidgetAnnotPr
|
||||
{
|
||||
public:
|
||||
@ -164,6 +194,7 @@ public:
|
||||
const std::wstring& GetT();
|
||||
const std::wstring& GetFontName();
|
||||
const std::wstring& GetFontKey();
|
||||
const std::wstring& GetOMetadata();
|
||||
const std::vector<double>& GetTC();
|
||||
const std::vector<double>& GetBC();
|
||||
const std::vector<double>& GetBG();
|
||||
@ -193,6 +224,7 @@ public:
|
||||
std::wstring m_wsT;
|
||||
std::wstring m_wsFN;
|
||||
std::wstring m_wsFK;
|
||||
std::wstring m_wsOMetadata;
|
||||
std::vector<double> m_arrTC;
|
||||
std::vector<double> m_arrBC;
|
||||
std::vector<double> m_arrBG;
|
||||
@ -423,7 +455,9 @@ public:
|
||||
CAnnotFieldInfo();
|
||||
virtual ~CAnnotFieldInfo();
|
||||
|
||||
void CreateMarkup();
|
||||
void SetType(int nType);
|
||||
EAnnotType GetType();
|
||||
|
||||
void GetBounds(double& dX1, double& dY1, double& dX2, double& dY2);
|
||||
void GetBorder(BYTE& nType, double& dWidth, std::vector<double>& arrDash);
|
||||
@ -480,7 +514,7 @@ private:
|
||||
std::vector<double> arrDash;
|
||||
};
|
||||
|
||||
int m_nType;
|
||||
EAnnotType m_nType;
|
||||
double m_dX1;
|
||||
double m_dY1;
|
||||
double m_dX2;
|
||||
@ -536,11 +570,14 @@ public:
|
||||
int nID;
|
||||
int nFlags;
|
||||
int nParentID;
|
||||
int nFieldFlag;
|
||||
std::wstring sName;
|
||||
std::wstring sV;
|
||||
std::wstring sDV;
|
||||
std::vector<int> arrI;
|
||||
std::vector<std::wstring> arrV;
|
||||
std::vector<CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget*> arrAction;
|
||||
std::vector< std::pair<std::wstring, std::wstring> > arrOpt;
|
||||
};
|
||||
|
||||
CWidgetsInfo();
|
||||
|
||||
@ -975,9 +975,12 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["alignment"] = reader.readByte();
|
||||
rec["flag"] = reader.readInt();
|
||||
// 12.7.3.1
|
||||
rec["readOnly"] = (rec["flag"] >> 0) & 1; // ReadOnly
|
||||
rec["required"] = (rec["flag"] >> 1) & 1; // Required
|
||||
rec["noexport"] = (rec["flag"] >> 2) & 1; // NoExport
|
||||
if (rec["flag"] >= 0)
|
||||
{
|
||||
rec["readOnly"] = (rec["flag"] >> 0) & 1; // ReadOnly
|
||||
rec["required"] = (rec["flag"] >> 1) & 1; // Required
|
||||
rec["noexport"] = (rec["flag"] >> 2) & 1; // NoExport
|
||||
}
|
||||
let flags = reader.readInt();
|
||||
// Alternative field name, used in tooltip and error messages - TU
|
||||
if (flags & (1 << 0))
|
||||
@ -1025,6 +1028,8 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["name"] = readStringFunc.call(reader);
|
||||
if (flags & (1 << 19))
|
||||
rec["font"]["AP"] = readStringFunc.call(reader);
|
||||
if (flags & (1 << 20))
|
||||
rec["meta"] = readStringFunc.call(reader);
|
||||
// Action
|
||||
let nAction = reader.readInt();
|
||||
if (nAction > 0)
|
||||
@ -1093,8 +1098,11 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
if (flags & (1 << 14))
|
||||
rec["ExportValue"] = readStringFunc.call(reader);
|
||||
// 12.7.4.2.1
|
||||
rec["NoToggleToOff"] = (rec["flag"] >> 14) & 1; // NoToggleToOff
|
||||
rec["radiosInUnison"] = (rec["flag"] >> 25) & 1; // RadiosInUnison
|
||||
if (rec["flag"] >= 0)
|
||||
{
|
||||
rec["NoToggleToOff"] = (rec["flag"] >> 14) & 1; // NoToggleToOff
|
||||
rec["radiosInUnison"] = (rec["flag"] >> 25) & 1; // RadiosInUnison
|
||||
}
|
||||
}
|
||||
else if (rec["type"] == 30)
|
||||
{
|
||||
@ -1112,13 +1120,16 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["AP"]["render"] = reader.readData(); // TODO use Render - Uint8Array
|
||||
}
|
||||
// 12.7.4.3
|
||||
rec["multiline"] = (rec["flag"] >> 12) & 1; // Multiline
|
||||
rec["password"] = (rec["flag"] >> 13) & 1; // Password
|
||||
rec["fileSelect"] = (rec["flag"] >> 20) & 1; // FileSelect
|
||||
rec["doNotSpellCheck"] = (rec["flag"] >> 22) & 1; // DoNotSpellCheck
|
||||
rec["doNotScroll"] = (rec["flag"] >> 23) & 1; // DoNotScroll
|
||||
rec["comb"] = (rec["flag"] >> 24) & 1; // Comb
|
||||
rec["richText"] = (rec["flag"] >> 25) & 1; // RichText
|
||||
if (rec["flag"] >= 0)
|
||||
{
|
||||
rec["multiline"] = (rec["flag"] >> 12) & 1; // Multiline
|
||||
rec["password"] = (rec["flag"] >> 13) & 1; // Password
|
||||
rec["fileSelect"] = (rec["flag"] >> 20) & 1; // FileSelect
|
||||
rec["doNotSpellCheck"] = (rec["flag"] >> 22) & 1; // DoNotSpellCheck
|
||||
rec["doNotScroll"] = (rec["flag"] >> 23) & 1; // DoNotScroll
|
||||
rec["comb"] = (rec["flag"] >> 24) & 1; // Comb
|
||||
rec["richText"] = (rec["flag"] >> 25) & 1; // RichText
|
||||
}
|
||||
}
|
||||
else if (rec["type"] == 31 || rec["type"] == 32)
|
||||
{
|
||||
@ -1175,15 +1186,21 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["AP"]["render"] = reader.readData(); // TODO use Render - Uint8Array
|
||||
}
|
||||
// 12.7.4.4
|
||||
rec["editable"] = (rec["flag"] >> 18) & 1; // Edit
|
||||
rec["multipleSelection"] = (rec["flag"] >> 21) & 1; // MultiSelect
|
||||
rec["doNotSpellCheck"] = (rec["flag"] >> 22) & 1; // DoNotSpellCheck
|
||||
rec["commitOnSelChange"] = (rec["flag"] >> 26) & 1; // CommitOnSelChange
|
||||
if (rec["flag"] >= 0)
|
||||
{
|
||||
rec["editable"] = (rec["flag"] >> 18) & 1; // Edit
|
||||
rec["multipleSelection"] = (rec["flag"] >> 21) & 1; // MultiSelect
|
||||
rec["doNotSpellCheck"] = (rec["flag"] >> 22) & 1; // DoNotSpellCheck
|
||||
rec["commitOnSelChange"] = (rec["flag"] >> 26) & 1; // CommitOnSelChange
|
||||
}
|
||||
|
||||
}
|
||||
else if (rec["type"] == 33)
|
||||
{
|
||||
rec["Sig"] = (flags >> 9) & 1;
|
||||
}
|
||||
if (rec["flag"] < 0)
|
||||
delete rec["flag"];
|
||||
}
|
||||
|
||||
CFile.prototype["getInteractiveFormsInfo"] = function()
|
||||
@ -1234,13 +1251,57 @@ CFile.prototype["getInteractiveFormsInfo"] = function()
|
||||
if (flags & (1 << 6))
|
||||
{
|
||||
let n = reader.readInt();
|
||||
rec["Opt"] = [];
|
||||
rec["opt"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
rec["Opt"].push(reader.readString());
|
||||
{
|
||||
let opt1 = reader.readString();
|
||||
let opt2 = reader.readString();
|
||||
if (opt1 == "")
|
||||
rec["opt"].push(opt2);
|
||||
else
|
||||
rec["opt"].push([opt2, opt1]);
|
||||
}
|
||||
}
|
||||
if (flags & (1 << 7))
|
||||
{
|
||||
rec["flag"] = reader.readInt();
|
||||
|
||||
rec["readOnly"] = (rec["flag"] >> 0) & 1; // ReadOnly
|
||||
rec["required"] = (rec["flag"] >> 1) & 1; // Required
|
||||
rec["noexport"] = (rec["flag"] >> 2) & 1; // NoExport
|
||||
|
||||
rec["NoToggleToOff"] = (rec["flag"] >> 14) & 1; // NoToggleToOff
|
||||
if ((rec["flag"] >> 15) & 1) // If radiobutton
|
||||
rec["radiosInUnison"] = (rec["flag"] >> 25) & 1; // RadiosInUnison
|
||||
else
|
||||
rec["richText"] = (rec["flag"] >> 25) & 1; // RichText
|
||||
|
||||
rec["multiline"] = (rec["flag"] >> 12) & 1; // Multiline
|
||||
rec["password"] = (rec["flag"] >> 13) & 1; // Password
|
||||
rec["fileSelect"] = (rec["flag"] >> 20) & 1; // FileSelect
|
||||
rec["doNotSpellCheck"] = (rec["flag"] >> 22) & 1; // DoNotSpellCheck
|
||||
rec["doNotScroll"] = (rec["flag"] >> 23) & 1; // DoNotScroll
|
||||
rec["comb"] = (rec["flag"] >> 24) & 1; // Comb
|
||||
|
||||
rec["editable"] = (rec["flag"] >> 18) & 1; // Edit
|
||||
rec["multipleSelection"] = (rec["flag"] >> 21) & 1; // MultiSelect
|
||||
rec["commitOnSelChange"] = (rec["flag"] >> 26) & 1; // CommitOnSelChange
|
||||
}
|
||||
if (flags & (1 << 8))
|
||||
{
|
||||
let nAction = reader.readInt();
|
||||
if (nAction > 0)
|
||||
rec["AA"] = {};
|
||||
for (let i = 0; i < nAction; ++i)
|
||||
{
|
||||
let AAType = reader.readString();
|
||||
rec["AA"][AAType] = {};
|
||||
readAction(reader, rec["AA"][AAType]);
|
||||
}
|
||||
}
|
||||
res["Parents"].push(rec);
|
||||
}
|
||||
|
||||
|
||||
k = reader.readInt();
|
||||
if (k > 0 && res["Fields"] == undefined)
|
||||
res["Fields"] = [];
|
||||
@ -1254,7 +1315,7 @@ CFile.prototype["getInteractiveFormsInfo"] = function()
|
||||
readAnnot(reader, rec, reader.readDouble, reader.readDouble2, reader.readString);
|
||||
// Widget type
|
||||
readWidgetType(reader, rec, reader.readDouble, reader.readDouble2, reader.readString);
|
||||
|
||||
|
||||
res["Fields"].push(rec);
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,9 +380,36 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
i += 4;
|
||||
std::cout << " " << std::string((char*)(pWidgets + i), nPathLength);
|
||||
i += nPathLength;
|
||||
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << " " << std::string((char*)(pWidgets + i), nPathLength);
|
||||
i += nPathLength;
|
||||
}
|
||||
std::cout << " ], ";
|
||||
}
|
||||
if (nFlags & (1 << 7))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << "Ff " << nPathLength;
|
||||
}
|
||||
if (nFlags & (1 << 8))
|
||||
{
|
||||
int nActLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
for (int j = 0; j < nActLength; ++j)
|
||||
{
|
||||
std::cout << std::endl;
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << std::to_string(j) << " Action " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
|
||||
ReadAction(pWidgets, i);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
@ -542,6 +569,13 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
std::cout << "Font button " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
if (nFlags & (1 << 20))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << "OMetadata " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
|
||||
//Action
|
||||
|
||||
@ -669,7 +703,7 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
i += 4;
|
||||
std::cout << "MaxLen " << nPathLength << ", ";
|
||||
}
|
||||
if (nFieldFlag & (1 << 25))
|
||||
if (nFlags & (1 << 11))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
@ -806,7 +840,7 @@ void ReadAnnotAP(BYTE* pWidgetsAP, int& i)
|
||||
i += 1;
|
||||
std::string arrBlendMode[] = { "Normal", "Multiply", "Screen", "Overlay", "Darken", "Lighten", "ColorDodge", "ColorBurn", "HardLight",
|
||||
"SoftLight", "Difference", "Exclusion", "Hue", "Saturation", "Color", "Luminosity" };
|
||||
std::cout << "Type " << arrBlendMode[nPathLength] << ", ";
|
||||
std::cout << "Type " << arrBlendMode[nPathLength];
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
@ -19,6 +19,10 @@ core_linux {
|
||||
QMAKE_CXXFLAGS += -Wno-narrowing
|
||||
}
|
||||
|
||||
core_linux_clang {
|
||||
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
|
||||
}
|
||||
|
||||
core_mac {
|
||||
DEFINES += HAVE_UNISTD_H HAVE_FCNTL_H
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user